Place a new order.
Note: See the AssetPairs endpoint for details on the available trading pairs, their price and quantity precisions, order minimums, available leverage, etc.
API Key Permissions Required: Orders and trades - Create & modify orders
curl --request POST \
--url https://api.kraken.com/0/private/AddOrder \
--header 'API-Key: <api-key>' \
--header 'API-Sign: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"nonce": 163245617,
"ordertype": "limit",
"type": "buy",
"volume": "1.25",
"pair": "XBTUSD",
"price": "27500",
"cl_ord_id": "6d1b345e-2821-40e2-ad83-4ecb18a06876"
}
'{
"error": [],
"result": {
"descr": {
"order": "buy 2.12340000 XBTUSD @ limit 25000.1 with 2:1 leverage",
"close": "close position @ stop loss 22000.0 -> limit 21000.0"
},
"txid": [
"OUF4EM-FRGI2-MQMWZD"
]
}
}Documentation Index
Fetch the complete documentation index at: https://kraken-sandbox.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
The "API-Key" header should contain your API key.
Authenticated requests should be signed with the "API-Sign" header, using a signature generated with your private key, nonce, encoded payload, and URI path.
Nonce used in construction of API-Sign header
The execution model of the order.
market, limit, iceberg, stop-loss, take-profit, stop-loss-limit, take-profit-limit, trailing-stop, trailing-stop-limit, settle-position "limit"
Order direction (buy/sell)
buy, sell Order quantity in terms of the base asset
Note: Volume can be specified as
0for closing margin orders to automatically fill the requisite quantity.
"1.25"
Asset pair id or altname
"XBTUSD"
This is an optional non-unique, numeric identifier which can associated with a number of orders by the client. This field is mutually exclusive with cl_ord_id parameter.
userref is an optional user-specified integer id that can be associated with any number of orders. Many clients choose a userref corresponding to a unique integer id generated by their systems (e.g. a timestamp). However, because we don't enforce uniqueness on our side, it can also be used to easily group orders by pair, side, strategy, etc. This allows clients to more readily cancel or query information about orders in a particular group, with fewer API calls by using userref instead of our txid, where supported.
Adds an alphanumeric client order identifier which uniquely identifies an open order for each client. This field is mutually exclusive with userref parameter.
The cl_ord_id parameter can be one of the following formats:
6d1b345e-2821-40e2-ad83-4ecb18a06876 32 hex characters separated with 4 dashes.da8e4ad59b78481c93e589746b0cf91f 32 hex characters with no dashes.arb-20240509-00010 Free format ascii text up to 18 characters.For iceberg orders only, it defines the quantity to show in the book while the rest of order quantity remains hidden. Minimum value is 1 / 15 of volume.
This parameter is required on requests for non-crypto pairs, i.e. use tokenized_asset for xstocks.
tokenized_asset Price:
limit and iceberg ordersstop-loss, stop-loss-limit, take-profit, take-profit-limit, trailing-stop and trailing-stop-limit ordersNotes:
price or price2 can be preceded by +, -, or # to specify the order price as an offset relative to the last traded price. + adds the amount to, and - subtracts the amount from the last traded price. # will either add or subtract the amount to the last traded price, depending on the direction and order type used. Prices can also be suffixed with a % to signify the relative amount as a percentage, rather than an absolute price difference.+ prefix, from which the direction will be automatic based on if the original order is a buy or sell (no need to use - or #). The % suffix also works for these order types to use a relative percentage price."40000.0"
Secondary Price:
stop-loss-limit, take-profit-limit and trailing-stop-limit ordersNote:
+ or - prefixes. This will provide the offset from the trigger price to the limit price, i.e. +0 would set the limit price equal to the trigger price. The % suffix also works for this field to use a relative percentage limit price.Price signal used to trigger stop-loss, stop-loss-limit, take-profit, take-profit-limit, trailing-stop and trailing-stop-limit orders
Notes:
trigger type will also be used for any associated conditional close orders.index, last Amount of leverage desired (default: none)
5
If true, order will only reduce a currently open position, not increase it or open a new position.
true
Self Trade Prevention (STP) is a protection feature to prevent users from inadvertently or deliberately trading against themselves. To prevent a self-match, one of the following STP modes can be used to define which order(s) will be expired:
cancel-newest: arriving order will be canceledcancel-oldest: resting order will be canceledcancel-both: both arriving and resting orders will be canceledcancel-newest, cancel-oldest, cancel-both Comma delimited list of order flags
post post-only order (available when ordertype = limit)fcib prefer fee in base currency (default if selling)fciq prefer fee in quote currency (default if buying, mutually exclusive with fcib)nompp (DEPRECATED) — disabling Market Price Protection for market orders is no longer supported. If supplied, the flag is accepted but ignored.viqc order volume expressed in quote currency. This option is supported only for buy market orders. Also not available on margin orders."post"
Time-in-force of the order to specify how long it should remain in the order book before being cancelled. GTC (Good-'til-cancelled) is default if the parameter is omitted. IOC (immediate-or-cancel) will immediately execute the amount possible and cancel any remaining balance rather than resting in the book. GTD (good-'til-date), if specified, must coincide with a desired expiretm. FOK (fill-or-kill) will execute the full order immediately or cancel it entirely.
GTC, IOC, GTD, FOK Scheduled start time, can be specified as an absolute timestamp or as a number of seconds in the future:
0 now (default)<n> = unix timestamp of start time+<n> = schedule start time <n> seconds from now
+ character changes it to a space, so please use %2b followed by the number of seconds instead of +Expiry time on GTD orders can be set up to one month in future, it is specified as an absolute timestamp or as a number of seconds from now:
0 no expiration (default)<n> = unix timestamp of expiration time+<n> = expire <n> seconds from now, minimum 5 seconds
+ character changes it to a space, so please use %2b followed by the number of seconds instead of +Conditional close order type
Note: Conditional close orders are triggered by execution of the primary order in the same quantity and opposite direction, but once triggered are independent orders that may reduce or increase net position
limit, iceberg, stop-loss, take-profit, stop-loss-limit, take-profit-limit, trailing-stop, trailing-stop-limit Conditional close order price
"50000.0"
Conditional close order price2
RFC3339 timestamp (e.g. 2021-04-01T00:18:45Z) after which the matching engine should reject the new order request, in presence of latency or order queueing: min now() + 2 seconds, max now() + 60 seconds.
If set to true the order will be validated only, it will not trade in the matching engine.
curl --request POST \
--url https://api.kraken.com/0/private/AddOrder \
--header 'API-Key: <api-key>' \
--header 'API-Sign: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"nonce": 163245617,
"ordertype": "limit",
"type": "buy",
"volume": "1.25",
"pair": "XBTUSD",
"price": "27500",
"cl_ord_id": "6d1b345e-2821-40e2-ad83-4ecb18a06876"
}
'{
"error": [],
"result": {
"descr": {
"order": "buy 2.12340000 XBTUSD @ limit 25000.1 with 2:1 leverage",
"close": "close position @ stop loss 22000.0 -> limit 21000.0"
},
"txid": [
"OUF4EM-FRGI2-MQMWZD"
]
}
}