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
| Header | Value |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer {token} |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| user_id | string | Yes | The unique identifier of the user selling the tokens |
| token_id | string | Yes | The unique identifier of the token to sell |
Request Body
{
"quantity": 10,
"price": {
"amount": 12,
"decimal": 6,
"symbol": "USDT"
},
"expires_at": "2024-02-15T10:30:00Z"
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| quantity | number | Yes | Number of tokens to sell |
| price | object | Yes | Price information for the tokens |
| price.amount | number | Yes | Price amount per token |
| price.decimal | number | Yes | Number of decimal places for the price |
| price.symbol | string | Yes | Currency symbol (e.g., "USDT", "ETH") |
| expires_at | string | No | ISO 8601 datetime when the sell order expires |
Response
Returns confirmation of the sell order creation.
Success Response (200 OK)
{
"success": true,
"message": "Sell order created successfully",
"data": {
"deal_id": "number",
"user_id": "string",
"token_id": "string",
"quantity": "number",
"price": {
"amount": "number",
"decimal": "number",
"symbol": "string"
},
"status": "string",
"expires_at": "string",
"created_at": "string",
"estimated_total": {
"amount": "number",
"decimal": "number",
"symbol": "string"
}
}
}
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": {
"amount": 12,
"decimal": 6,
"symbol": "USDT"
},
"expires_at": "2024-02-15T10:30:00Z"
}'
Response
{
"success": true,
"message": "Sell order created successfully",
"data": {
"deal_id": 15,
"user_id": "680c02896d91ca0145cfeb81",
"token_id": "68ae06cfcccf4e8fc19362d1",
"quantity": 10,
"price": {
"amount": 12,
"decimal": 6,
"symbol": "USDT"
},
"status": "active",
"expires_at": "2024-02-15T10:30:00Z",
"created_at": "2024-01-15T14:30:00Z",
"estimated_total": {
"amount": 120,
"decimal": 6,
"symbol": "USDT"
}
}
}
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
- Token Ownership: User must own the tokens they want to sell
- Balance Check: The system verifies sufficient token balance before creating the sell order
- Market Fees: Secondary market fees may apply to the transaction
- Order Expiration: Orders can have expiration dates; expired orders are automatically cancelled
- Price Validation: Price must be within acceptable market ranges
- Status Tracking: Orders can be tracked through their deal_id