Skip to main content

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​

NameTypeInDescription
user_idstringpathRequired. Seller's user ID
token_idstringpathRequired. Token ID

Headers​

NameDescription
AuthorizationRequired. Bearer <access_token>
Content-TypeRequired. application/json

Body​

FieldTypeRequiredDescription
wallet_idstringYesSeller'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
quantityintegerYesWhole tokens to list, at least 1
currency_token_idstringYesCurrency the listing is priced in (currency_tokens._id)
unit_pricestringYesPrice 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​

FieldTypeDescription
transaction_idstringUser transaction that creates the listing. Poll it with Get User Transaction

Errors​

StatusCodeDescription
40010015Validation failed (wallet_id, quantity, currency_token_id), or unit_price is missing, zero, malformed or finer than the currency's decimals — see details
40010016user_id, token_id or wallet_id is not a valid 24-character hex id
40010001Token not found (domain 5)
40410001Currency token not found (domain 15)
40010015Domain 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
40011003The wallet does not hold enough free tokens for this listing (domain 11)
50010000Unexpected server-side failure

See Errors for the error format and common codes.