Off-Chain Settlement
Cancel Off-Chain Order
Withdraw a resting off-chain order and unlock the balance behind it
DELETE
/
orderbooks
/
stocks
/
api
/
offchain
/
orders
/
{orderId}
curl -X DELETE "https://api.trusset.org/orderbooks/stocks/api/offchain/orders/b7c1e0d4-6f2a-4f1e-9d33-5c8a1f0b2e77" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "customerRef": "cust_1042" }'
const res = await fetch(
`https://api.trusset.org/orderbooks/stocks/api/offchain/orders/${orderId}`,
{
method: 'DELETE',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({ customerRef: 'cust_1042' })
}
);
const { data } = await res.json();
{
"success": true,
"data": {
"orderId": "b7c1e0d4-6f2a-4f1e-9d33-5c8a1f0b2e77",
"orderBookId": "clx_ob_stock_001",
"userAddress": "offchain:cust_1042",
"side": "BUY",
"orderType": "LIMIT",
"price": "182350000",
"quantity": "5000000",
"filledQuantity": "1000000",
"remainingQuantity": "4000000",
"status": "CANCELLED",
"cancelReason": "USER_CANCELLED",
"updatedAt": "2025-06-15T12:06:00.000Z"
}
}
Cancels an order placed through the off-chain surface. The
customerRef in the body must match the one the order was placed under: an order belongs to a customer reference, not to a wallet.
Only OPEN and PARTIALLY_FILLED orders can be cancelled. Anything else reads as ORDER_NOT_FOUND.
The order is removed from the in-memory book, so the depth disappears at once, and the unfilled remainder of the ledger lock is released. A release failure is logged rather than surfaced, and the cancel still succeeds.
Path Parameters
Body Parameters
Response Fields
Returns the cancelled order, withstatus: "CANCELLED" and cancelReason: "USER_CANCELLED".
curl -X DELETE "https://api.trusset.org/orderbooks/stocks/api/offchain/orders/b7c1e0d4-6f2a-4f1e-9d33-5c8a1f0b2e77" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "customerRef": "cust_1042" }'
const res = await fetch(
`https://api.trusset.org/orderbooks/stocks/api/offchain/orders/${orderId}`,
{
method: 'DELETE',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({ customerRef: 'cust_1042' })
}
);
const { data } = await res.json();
{
"success": true,
"data": {
"orderId": "b7c1e0d4-6f2a-4f1e-9d33-5c8a1f0b2e77",
"orderBookId": "clx_ob_stock_001",
"userAddress": "offchain:cust_1042",
"side": "BUY",
"orderType": "LIMIT",
"price": "182350000",
"quantity": "5000000",
"filledQuantity": "1000000",
"remainingQuantity": "4000000",
"status": "CANCELLED",
"cancelReason": "USER_CANCELLED",
"updatedAt": "2025-06-15T12:06:00.000Z"
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
VALIDATION_ERROR | 400 | customerRef is missing or out of range |
INVALID_PARAM | 400 | orderId is missing or longer than 100 characters |
ORDER_NOT_FOUND | 404 | No open order with that ID under this customer reference on your instance |
TOKEN_NOT_REGISTERED | 400 | The token to unlock is not registered in your custody ledger |
SERVICE_NOT_ENABLED | 403 | The Trading service is not enabled on this instance |
⌘I
curl -X DELETE "https://api.trusset.org/orderbooks/stocks/api/offchain/orders/b7c1e0d4-6f2a-4f1e-9d33-5c8a1f0b2e77" \
-H "X-API-Key: trusset_your_key_here" \
-H "Content-Type: application/json" \
-d '{ "customerRef": "cust_1042" }'
const res = await fetch(
`https://api.trusset.org/orderbooks/stocks/api/offchain/orders/${orderId}`,
{
method: 'DELETE',
headers: {
'X-API-Key': 'trusset_your_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({ customerRef: 'cust_1042' })
}
);
const { data } = await res.json();
{
"success": true,
"data": {
"orderId": "b7c1e0d4-6f2a-4f1e-9d33-5c8a1f0b2e77",
"orderBookId": "clx_ob_stock_001",
"userAddress": "offchain:cust_1042",
"side": "BUY",
"orderType": "LIMIT",
"price": "182350000",
"quantity": "5000000",
"filledQuantity": "1000000",
"remainingQuantity": "4000000",
"status": "CANCELLED",
"cancelReason": "USER_CANCELLED",
"updatedAt": "2025-06-15T12:06:00.000Z"
}
}
