Sell On Secondary Market
Lists quantity tokens from one of the user's wallets on the secondary market at unit_price per token. The call is asynchronous: it records a user transaction (type = 3, sell on secondary market) and answers with its transaction_id. Poll Get User Transaction until status is 3 (done) or 4 (error); the listing shows up in List User Token Listings and List Token Listings only once it is confirmed on chain. A listing is later bought whole.
wallet_id is required and names the wallet whose holding backs the listing 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 secondary-market listings and open OTC offers already commit.
Required permission: secondary-market:trade
Request
POST /v2/users/{user_id}/secondary-markets/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 listing and that signs it. Must belong to the user and sit on the token's chain |
quantity | integer | Yes | Whole tokens to list, at least 1 |
currency_token_id | string | Yes | Currency the listing 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/secondary-markets/tokens/68ae06cfcccf4e8fc19362d1/sell' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data '{
"wallet_id": "6a89b68e0c46ca4c941271aa",
"quantity": 10,
"currency_token_id": "6913307ec95e268b239b2d8b",
"unit_price": "12"
}'
Response
{
"transaction_id": "6913872755654191dede37da"
}
Response Fields
| Field | Type | Description |
|---|---|---|
transaction_id | string | User transaction that creates the listing. 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) |
| 404 | 10001 | Currency token not found (domain 15) |
| 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 | 11003 | The wallet does not hold enough free tokens for this listing (domain 11) |
| 500 | 10000 | Unexpected server-side failure |
See Errors for the error format and common codes.