Skip to main content

Sell On OTC

Create an OTC (Over-The-Counter) sell offer for tokens owned by a user.

Endpoint

POST /v2/users/{user_id}/otcs/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": 3,
"wallet_id": "6a89b68e0c46ca4c941271aa",
"currency_token_id": "6913307ec95e268b239b2d8b",
"unit_price": 12
}

Parameters

ParameterTypeRequiredDescription
quantityintegerYesNumber of tokens to sell
wallet_idstringYesThe seller's wallet whose holding backs the listing; the sale is validated against and settled from it
currency_token_idstringYesThe currency the listing is priced in (currency_tokens._id). Was price_id, which named no entity
unit_pricenumberYesPrice of one token in that currency — not the total. Was price_amount

Example

Request

curl --location 'https://test-integration-api.tokenizationtr.com/v2/users/6913872755654191dede37da/otcs/tokens/691331aec95e268b239b2d91/sell' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnRJRCI6Ijk3MWNlZGVmLWVlZDctNDcwZi04YWIzLTBhZTM3ZDc0NTY4NCIsImV4cGlyYXRpb24iOjE3NjMwODM3NjcsInN1cGVydmlzb3JFbWFpbCI6ImRldkBydWRpcS5jb20iLCJzdXBlcnZpc29ySUQiOiI2OGQyODBiYmM1ODA3M2NkZjU2NDJkMjAiLCJzdXBlcnZpc29yTm9kZUlEIjoiNjY1YWU1MzZhNjM5MmI3NWNmZDQwMzUyIiwic3VwZXJ2aXNvck5vZGVJbnRJRCI6MSwic3VwZXJ2aXNvck5vZGVQYXRoIjoiMSIsInN1cGVydmlzb3JSb2xlSUQiOiI2NjVhZTc5NjEwY2UyMTZkYmMzNWM5M2IiLCJzdXBlcnZpc29yUm9sZVByaW9yaXR5IjoxMDB9.0l-NJTDICHXuhwb0PGX6wwXO50zhMysxepUntC1sxJY' \
--data '{
"quantity": 3,
"wallet_id": "6a89b68e0c46ca4c941271aa",
"currency_token_id": "6913307ec95e268b239b2d8b",
"unit_price": 12
}'

Response

Returns a transaction ID for async processing. A user transaction row is created with type = 6 (CreateOtcOffer), environment = 1 (OtcEnvironment), and status = 1 (Started).

{
"transaction_id": "6913872755654191dede37da"
}

Response Fields

FieldTypeDescription
transaction_idstringUser transaction ID. Poll it via Get User Transactions (filter by types=6) until status reaches 3 (Done) or 4 (Error).

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 create OTC offers"
}

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 create this offer"
}

500 Internal Server Error

{
"error": "Internal server error"
}

Important Notes

  • Async Processing: OTC offer is created asynchronously; use transaction_id to poll status
  • OTC Trading: Over-the-counter trading allows for direct negotiation between parties
  • Token Ownership: User must own the tokens they want to sell
  • Price: currency_token_id is the currency token ID and unit_price is the price of one token. These were price_id and price_amount; the transaction data payload still records them under the old names, so a response may show price_id/price_amount where the request takes the new ones
  • Polling: Get User Transactions, filter by types=6 (CreateOtcOffer). The offer becomes orderbook-visible only after the transaction reaches Done (3)
  • Transaction storage: OTC settlements are tracked in the separate otc_transactions collection. The user transaction (type=6) is the orchestration record