Accept OTC Offer
Accepts 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 an accept transaction (OTC transaction type 1) on the token's network, publishes it and returns its ID. The offer turns 1 (accepted) only when that transaction settles. Poll Get OTC Transaction until it reaches status 3 (Done) or 4 (Error).
Only one accept of an offer can be in flight. While another accept's transaction is still running, a second accept is refused with 409 (11003). An accept whose transaction ended in Error no longer holds the offer, so you can retry it; so can an accept whose request failed before its transaction was recorded, after 10 minutes.
Required permission: otc:accept
Request
POST /v2/admin/otcs/tokens/{token_id}/deals/{deal_id}/accept
Parameters
| Name | Type | In | Description |
|---|---|---|---|
token_id | string | path | Required. Token the offer is on (24-character hex) |
deal_id | integer | path | Required. On-chain deal ID of the offer, greater than 0 |
Headers
| Name | Description |
|---|---|
Authorization | Required. Bearer <access_token> |
Example
curl --request POST \
--url '{{baseUrl}}/v2/admin/otcs/tokens/68ae06cfcccf4e8fc19362d1/deals/2/accept' \
--header 'Authorization: Bearer <access_token>'
Response
{
"transaction_id": "6a8b5e13f9129816a6cc7a12"
}
Response Fields
| Field | Type | Description |
|---|---|---|
transaction_id | string | The OTC transaction this call started. A 200 means the accept was queued, not that the offer is accepted |
Errors
| Status | Code | Description |
|---|---|---|
| 400 | 10015 | Validation failed — see details. Includes a deal_id that is not a positive integer |
| 400 | 10016 | token_id is not a 24-character hex ID |
| 400 | 11001 (domain 11) | No offer with this deal ID on this token |
| 400 | 11002 (domain 11) | The offer is not open (already accepted, cancelled or rejected, or not yet confirmed) |
| 409 | 11003 (domain 11) | Another accept of this offer is already in progress |
| 400 | 10001 (domain 5) | The offer's token was not found |
| 400 | 10001 (domain 2) | The token's node was not found |
| 403 | 10005 (domain 2) | The token's node is outside your API key's node subtree |
| 500 | 10000 | Unexpected server error |
See Errors for the error format and common codes.