DEX API
Create limit order

Create limit order#

Create a DEX limit order.

Request address#

POST https://www.okx.com/api/v5/dex/aggregator/limit-order/save-order

Request parameters#

ParameterTypeRequiredDescription
orderHashStringYesorder hash
signatureStringYessignature
chainIdStringYesChain ID (e.g., 1 for Ethereum. See Chain IDs)
dataObjectYesdata object
saltStringYesrandom number salt as idempotent identifier
Current timestamp (second value) (e.g.,1691499249
makingAmountStringYesThe number of a token to be sold (set in minimal divisible units, e.g., 1.00 USDT set as 1000000, 1.00 DAI set as 1000000000000000000)
takingAmountStringYesThe number of a token to be bought (set in minimal divisible units, e.g., 1.00 USDT set as 1000000, 1.00 DAI set as 1000000000000000000)
makerTokenStringYesThe contract address of a token to be sold (e.g.,0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39)
takerTokenStringYesThe contract address of a token to be bought (e.g.,0x2791bca1f2de4661ed88a30c99a7a9449aa84174)
makerStringYesThe wallet address for current transaction (e.g.,0x6f9ffea7370310cd0f890dfde5e0e061059dcfd9)
deadLineStringYesCurrent order’s effective deadline
timestamp (second value) (e.g.,1699520029
allowedSenderStringYesSetting up a zero address (0x0000000000000000000000000000000000000000) Everyone can deal with the current limit order. If you set a value, the limit order will only be executable at the specified address. (e.g.,0x6f9ffea7370310cd0f890dfde5e0e061059dcfd9)
receiverStringYesAssets will be sent to the current receiver's address. (e.g.,0x6f9ffea7370310cd0f890dfde5e0e061059dcfd9)
minReturnStringYesMinimum number of coins to be bought
(the number must include precision, e.g. for 1.00 USDT set as 1000000, for 1.00 DAI set as 1000000000000000000).
partiallyAbleBoolYesWhether partial transactions are supported (true for yes, false for no)

Response parameters#

ParameterTypeDescription
codeStringStatus code (e.g. 0: operation successful, 51000: mandatory parameter cannot be null. See error codes list for more information.)
msgStringServer-side response information. If interface is normal, then no value; if abnormal, it will return an exception.

Request example#

shell
{
  "orderHash":"0xf1852a5c82b9ff891123456731325f4a778603471c2e8fa8d80583824c21e97a",
  "signature":"0x78645ba7ed8c0266e01e46302160aad1234567ac9a0c751b9c315a516f44f54765acd11c11ffc88c9dd7f74fa63c606506ab145f94592bbbcb3cf2bac1cb13a01b",
  "chainId":"137",
  "data":{
      "salt":"1697032618",
      "makingAmount":"5900000",
      "takingAmount":"6000000",
      "makerToken":"0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
      "takerToken":"0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
      "maker":"0x230293u8238sh823472hjskq92j38ahj2i391k20",
      "deadLine":"1697784060",
      "allowedSender":"0x0000000000000000000000000000000000000000",
      "receiver":"0x230293u8238sh823472hjskq92j38ahj2i391k20",
      "minReturn":"6000000",
      "partiallyAble" : true
  }
}

Response example#

200
{
        "code":"0",
        "msg":"save order success"
      }