Sell On OTC
Creates an OTC offer to sell quantity tokens from one of the user's wallets at unit_price per token. The call is asynchronous: it records a user transaction (type = 6, create OTC offer) and answers with its transaction_id. Poll Get User Transaction until status is 3 (done) or 4 (error); the offer shows up in List User OTC Offers only once it is confirmed on chain.
wallet_id is required and names the wallet whose holding backs the offer and that signs it. It must be this user's wallet and sit on the token's chain. The wallet must have enough free tokens: its remaining quantity minus what its open OTC offers and open secondary-market listings already commit.
Required permission: otc:trade
Request
POST /v2/users/{user_id}/otcs/tokens/{token_id}/sell
Parameters
| Name | Type | In | Description |
|---|---|---|---|
user_id | string | path | Required. Seller's user ID |
token_id | string | path | Required. Token ID |
Headers
| Name | Description |
|---|---|
Authorization | Required. Bearer <access_token> |
Content-Type | Required. application/json |
Body
| Field | Type | Required | Description |
|---|---|---|---|
wallet_id | string | Yes | Seller's wallet (wallets._id) whose holding backs the offer and that signs it. Must belong to the user and sit on the token's chain |
quantity | integer | Yes | Whole tokens to offer, at least 1 |
currency_token_id | string | Yes | Currency the offer is priced in (currency_tokens._id) |
unit_price | string | Yes | Price of one token in that currency, not the total. Greater than zero, with no more decimals than the currency has. See Amounts and Percentages |
Example
curl --request POST \
--url '{{baseUrl}}/v2/users/680c02896d91ca0145cfeb81/otcs/tokens/68ae06cfcccf4e8fc19362d1/sell' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data '{
"wallet_id": "6a89b68e0c46ca4c941271aa",
"quantity": 3,
"currency_token_id": "6913307ec95e268b239b2d8b",
"unit_price": "1.1"
}'
Response
{
"transaction_id": "6913872755654191dede37da"
}
Response Fields
| Field | Type | Description |
|---|---|---|
transaction_id | string | User transaction that creates the offer. Poll it with Get User Transaction |
Errors
| Status | Code | Description |
|---|---|---|
| 400 | 10015 | Validation failed (wallet_id, quantity, currency_token_id), or unit_price is missing, zero, malformed or finer than the currency's decimals — see details |
| 400 | 10016 | user_id, token_id or wallet_id is not a valid 24-character hex id |
| 400 | 10001 | Token not found (domain 5) |
| 400 | 10015 | Domain 1: wallet does not belong to this user on this network — the wallet does not exist, is not this user's, or is on another chain |
| 400 | 11002 | The wallet does not hold enough free tokens for this offer (domain 11) |
| 404 | 10001 | Currency token not found (domain 15) |
| 500 | 10000 | Unexpected server-side failure |
See Errors for the error format and common codes.