Gravv
/Docs
Search docs or ask a question⌘K
DocsAgent
ChangelogTry sandbox
FX Create an order

Create an order

Trades a quote. With an API key there is no approval step. The order starts as `pending` and Gravv debits the source at once. Then get the order until it is `completed` or `cancelled`. FX orders send no webhooks.

POSThttps://api.gravv.xyz/v1/fx/ordersTry it
Api-Key

Trades a quote. With an API key there is no approval step. The order starts as pending and Gravv debits the source at once. Then get the order until it is completed or cancelled. FX orders send no webhooks.

If the error is order source could not be charged, an order may still exist; list your orders before you retry with a new quote.

Headers

NameDescription
Idempotency-Key:stringRequired
1 to 255 printable ASCII characters. A retry with the same key within 24 hours returns the first response, including a 400. After you correct a request, send a new key.

Body parameters

NameDescription
quote_id:stringRequired
A quote from POST /v1/fx/quote that has not expired or been used
source:object
Your account or crypto wallet that pays the sold amount. It must hold at least from_amount in the FROM currency. It cannot be external_account.
Show 2 child attributesobject
destination:object
Where the bought amount goes. It is your account or crypto wallet, or an active settlement instruction (external_account) in the TO currency.
Show 2 child attributesobject
transaction_id:string
Optional ID to give the order. It becomes order_id.
client_reference:string
Your reference. It does not have to be unique.
metadata:object
Your data, returned on the order

Response

Returns 200 OK. The order is created

NameDescription
data:object
Show 3 child attributesobject
error:null

Errors

StatusMeaning
200The order is created
400The quote is expired or used, a leg is invalid, the source balance is too low, or the debit failed
403The key lacks fx:order_create, or your business does not have access to the OTC trade desk
Was this page helpful? Yes No
Request
cURLJavaScriptPythonGoRubyPHPJavaC#cURL
curl --request POST \
--url 'https://api.gravv.xyz/v1/fx/orders' \
--header 'Api-Key: <api-key>' \
--header 'Idempotency-Key: usd-xaf-order-1042' \
--header 'Content-Type: application/json' \
--data '{
"quote_id": "GRVOTC_3F9A1C",
"source": {
"type": "internal_account",
"id": "4b3a2c1d-0e9f-4a8b-9c7d-6e5f4a3b2c1d"
},
"destination": {
"type": "external_account",
"id": "b7e1c2d3-4f5a-4b6c-9d8e-7f6a5b4c3d2e"
},
"client_reference": "inv-2026-1042",
"metadata": {
"desk": "treasury"
}
}'
Responseapplication/json
200400403OK
{
"data": {
"order_id": "2d4f6a8c-1b3d-4e5f-8a7b-9c0d1e2f3a4b",
"quote_id": "GRVOTC_3F9A1C",
"status": "pending"
},
"error": null
}