Gravv DOCS
Docs Agent Get Started
API Reference Cancel order

Cancel order

Cancels an order that hasn't executed yet. Orders that are already in a final state, or in a state that doesn't allow cancellation, can't be cancelled.

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

POST/v1/fx/orders/{order_id}/cancel

Headers

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

Path Parameters

The order reference returned when the order was created.

Responses

Status Description
200 Order cancelled
400 Invalid request
401 Missing or invalid API key
500 Internal server error

200 response

Internal UUID of the order.

Human-readable order reference. Use this value as the order_id path parameter in the order endpoints.

Possible values: market, limit

Possible values: buy, sell

Base currency code (ISO 4217 or crypto ticker).

Quote currency code (ISO 4217 or crypto ticker).

Amount of the base currency to exchange.

Proceeds in the quote currency.

Rate applied to the order.

Target rate for limit orders. Returns null for market orders.

Fee charged for the order, if any.

Current order status: * waiting_approval: created and waiting for a second user to approve or reject * pending: approved; the funds are charged and the order is executing * rejected: a reviewer rejected the order * cancelled: cancelled before execution * expired: not approved before it expired

ID of the customer the order was created for.

ID of the tenant that owns the order.

Where the funds come from (account or wallet).

ID of the source account or wallet.

Where the proceeds settle (account, wallet, or ssi).

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

ID of the user who created the order.

Role of the user who created the order.

ID of the user who approved the order. null until approved.

When the order was approved. null until approved.

ID of the user who rejected the order. null unless rejected.

When the order was rejected. null unless rejected.

Reason given when the order was rejected. null unless rejected.

When the order executed. null until executed.

When the proceeds settled. null until settled.

When the order expires if it isn't approved. null when the order doesn't expire.

When the order was last updated. null if never updated.

{
"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": "cancelled",
"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": "2026-07-03T15:40:11.120943Z"
},
"error": null
}

400 response

Always null for error responses.

Human-readable error message.

{
"data": null,
"error": "missing idempotency key in request headers"
}
{
"data": null,
"error": "order not found"
}
{
"data": null,
"error": "order cannot be cancelled in status: waiting_approval"
}

401 response

Always null for error responses.

Human-readable error message.

{
"data": null,
"error": "Invalid or missing Api-Key header. Api-Key is required!"
}
{
"data": null,
"error": "Invalid token!"
}

500 response

Always null for error responses.

Human-readable error message.

{
"data": null,
"error": "Internal server error"
}

Authorization

  • ApiKeyAuth
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.

Ask me anything about the documentation.

ESC