Skip to main content

Cancel OTC Offer

Cancels an open OTC offer on a token. The offer is addressed by its deal ID within the token; the node is read off the offer. The token's node must be inside your API key's node subtree, and the offer must be open (status 0). The call takes no body.

The call is asynchronous: it records a cancel transaction (OTC transaction type 2) on the token's network, publishes it and returns its ID. The offer turns 2 (cancelled) only when that transaction settles. Poll Get OTC Transaction until it reaches status 3 (Done) or 4 (Error).

Required permission: otc:cancel

Request​

POST /v2/admin/otcs/tokens/{token_id}/deals/{deal_id}/cancel

Parameters​

NameTypeInDescription
token_idstringpathRequired. Token the offer is on (24-character hex)
deal_idintegerpathRequired. On-chain deal ID of the offer, greater than 0

Headers​

NameDescription
AuthorizationRequired. Bearer <access_token>

Example​

curl --request POST \
--url '{{baseUrl}}/v2/admin/otcs/tokens/68ae06cfcccf4e8fc19362d1/deals/2/cancel' \
--header 'Authorization: Bearer <access_token>'

Response​

{
"transaction_id": "6a8b5e13f9129816a6cc7a13"
}

Response Fields​

FieldTypeDescription
transaction_idstringThe OTC transaction this call started. A 200 means the cancel was queued, not that the offer is cancelled

Errors​

StatusCodeDescription
40010015Validation failed — see details. Includes a deal_id that is not a positive integer
40010016token_id is not a 24-character hex ID
40011001 (domain 11)No offer with this deal ID on this token
40011002 (domain 11)The offer is not open (already accepted, cancelled or rejected, or not yet confirmed)
40010001 (domain 5)The offer's token was not found
40010001 (domain 2)The token's node was not found
40310005 (domain 2)The token's node is outside your API key's node subtree
50010000Unexpected server error

See Errors for the error format and common codes.