Skip to content

Create order

POSThttps://api.gravv.xyz/v1/fx/orders

Creates an OTC order. The order is created in waiting_approval and doesn't execute until a second user approves it.

A market order executes at the current rate once approved. A limit order waits until the rate reaches target_rate, then executes once approved.

Set destination_type to control where the converted funds settle: an internal account, a crypto wallet, or a saved settlement instruction (ssi).

The Idempotency-Key header is required; requests without it are rejected.

Body Params

  • customer_idstringrequired

    ID of the customer the order is created for.

  • order_typestringrequired

    A market order executes at the current rate once approved. A limit order waits until the rate reaches target_rate, then executes once approved.

    Allowed:marketlimit
  • pairobjectrequired
  • amountstringrequired

    Amount of the base currency to exchange. Must be greater than zero.

  • target_ratestring

    Required for limit orders. The rate at which the order should execute.

  • sidestring

    Side of the order. Defaults to sell.

    Allowed:buysellDefaults to sell
  • source_typestring

    Where the funds come from. Fiat base currencies are funded from an account; crypto base currencies from a wallet.

    Allowed:accountwallet
  • source_idstring

    ID of the source account or wallet.

  • destination_typestring

    Where the proceeds settle. Use ssi to settle to a saved settlement instruction.

    Allowed:accountwalletssi
  • destination_idstring

    ID of the destination account, wallet, or settlement instruction.

Headers

  • Idempotency-Keystringrequired

    A unique key to prevent duplicate requests. Required on all FX write operations; requests without it are rejected with a 400.

Responses

Language
curl --request POST \
--url 'https://api.gravv.xyz/v1/fx/orders' \
--header 'Api-Key: <Api Key>' \
--header 'Idempotency-Key: order_789_attempt_1' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"customer_id": "85034797-3ea1-4ad8-a952-becd67d74acc",
"order_type": "market",
"pair": {
"base": "USD",
"quote": "ZAR"
},
"amount": "1000",
"source_type": "account",
"source_id": "74653c7b-ae84-45ab-8085-2d2493f86d81",
"destination_type": "ssi",
"destination_id": "b23ffd0e-d0fc-432e-acc9-c396194121b3"
}'
{
"data": {
"id": "4994339f-4a19-47ef-a86b-1005eff0a4d0",
"order_id": "OTC-0VA89I",
"order_type": "market",
"side": "sell",
"pair": {
"base": "USD",
"quote": "ZAR"
},
"amount": "1000.00000000",
"amount_currency": "USD",
"converted_amount": "16242.50000000",
"converted_currency": "ZAR",
"rate": "16.24250000",
"target_rate": null,
"fee": null,
"status": "waiting_approval",
"customer_id": "85034797-3ea1-4ad8-a952-becd67d74acc",
"tenant_id": "dfa96ede-fc13-43cf-8328-8b910d1cd1d2",
"source_type": "account",
"source_id": "74653c7b-ae84-45ab-8085-2d2493f86d81",
"destination_type": "ssi",
"destination_id": "b23ffd0e-d0fc-432e-acc9-c396194121b3",
"created_by_user_id": "804201c6-2760-4da1-9c5e-0ff09ebc3b5e",
"created_by_role": "developer",
"approved_by_user_id": null,
"approved_at": null,
"rejected_by_user_id": null,
"rejected_at": null,
"rejection_reason": null,
"executed_at": null,
"settled_at": null,
"expires_at": null,
"created_at": "2026-07-03T15:32:37.878676Z",
"updated_at": null
},
"error": null
}