Skip to main content

Sell On Secondary Market

Create a sell order on the secondary market for tokens owned by a user.

Endpoint

POST /v2/users/secondary-markets/users/{user_id}/tokens/{token_id}/sell

Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer {token}

Path Parameters

ParameterTypeRequiredDescription
user_idstringYesThe unique identifier of the user selling the tokens
token_idstringYesThe unique identifier of the token to sell

Request Body

{
"quantity": 10,
"price_id": "6913307ec95e268b239b2d8b",
"price_amount": 12
}

Parameters

ParameterTypeRequiredDescription
quantityintegerYesNumber of tokens to sell
price_idstringYesCurrency token ID
price_amountnumberYesPrice amount per token

Response

Returns a transaction ID for async processing. The sell order is processed asynchronously; use the transaction ID to poll for status.

Success Response (200 OK)

{
"transaction_id": "6913872755654191dede37da"
}

Response Fields

FieldTypeDescription
transaction_idstringTransaction ID for polling - use to check order status

Example

Request

curl -X POST "\{\{baseUrl\}\}/v2/users/secondary-markets/users/680c02896d91ca0145cfeb81/tokens/68ae06cfcccf4e8fc19362d1/sell" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer \{\{token\}\}" \
-d '{
"quantity": 10,
"price_id": "6913307ec95e268b239b2d8b",
"price_amount": 12
}'

Response

{
"transaction_id": "6913872755654191dede37da"
}

Note: Poll the transaction status endpoint to track order completion.

Error Responses

400 Bad Request

{
"error": "Invalid parameters",
"details": "Quantity must be greater than 0"
}

401 Unauthorized

{
"error": "Authentication required"
}

403 Forbidden

{
"error": "Access denied",
"details": "Insufficient permissions to sell tokens"
}

404 Not Found

{
"error": "Resource not found",
"details": "User or token not found"
}

422 Unprocessable Entity

{
"error": "Insufficient token balance",
"details": "User does not have enough tokens to sell"
}

500 Internal Server Error

{
"error": "Internal server error"
}

Important Notes

  • Async Processing: Sell order is created asynchronously; use transaction_id to poll status
  • Token Ownership: User must own the tokens they want to sell
  • Price: price_id is the currency token ID, price_amount is the price per token