API ReferenceHTTP APIExchange Operations
Exchange: Cancel
Cancel limit orders or market timeouts.
Alpha Version
The Ostium Builder Service is in Alpha. API endpoints, specifications, and builder URLs may change without notice. Use with caution in production environments.
POST /v1/exchange/cancel
Builds unsigned transactions to cancel pending limit orders or cancel stuck market orders (timeouts).
Headers
| Header | Required | Description |
|---|---|---|
X-Trader-Address | Yes | Trader wallet address. |
X-API-Key | No | Delegated mode (delegate wallet must be verified). |
Content-Type | Yes | application/json or text/plain (JSON string). |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
cancels | CancelItem[] | Yes | One or more cancel actions. |
CancelItem
| Field | Type | Required | Description |
|---|---|---|---|
t | string | Yes | Cancel type: limit, open, close. |
a | number | Cond. | Pair index (required for limit). |
i | number | Cond. | Order index (required for limit). |
o | number | Cond. | Order ID (required for open or close timeouts). |
Constraints
cancelsmust contain at least one item.limitcancels requireaandi.openorclosecancels requireo(order ID).- Delegated mode supports one cancel per request.
Response Body (unsigned)
| Field | Type | Required | Description |
|---|---|---|---|
transactions | UnsignedTransaction[] | Yes | One or more unsigned transactions. |
Response Body (delegated)
| Field | Type | Required | Description |
|---|---|---|---|
txHash | string | Yes | Transaction hash of the delegated action. |
smartAccountAddress | string | Yes | Smart account used for delegation. |
Example Request
curl -X POST https://builder.ostiscan.xyz/v1/exchange/cancel \
-H "Content-Type: application/json" \
-H "X-Trader-Address: 0xYourWallet" \
-d '{"cancels":[{"t":"limit","a":0,"i":1}]}'Response (200, unsigned)
{
"transactions": [
{ "to": "0x...", "data": "0x...", "value": "0", "from": "0xYourWallet" }
]
}Response (200, delegated)
{
"txHash": "0x...",
"smartAccountAddress": "0x..."
}Errors
See /docs/errors.