Get Purchase Quantity
Get the quantity of tokens purchased by a user for a specific token.
Endpoint
GET /v2/users/purchases/users/{user_id}/tokens/{token_id}/quantity
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 |
| token_id | string | Yes | The unique identifier of the token |
Response
Returns the quantity information for the user's token purchases.
Success Response (200 OK)
{
"user_id": "string",
"token_id": "string",
"token_name": "string",
"token_symbol": "string",
"total_quantity": "number",
"available_quantity": "number",
"locked_quantity": "number",
"purchase_summary": {
"total_purchases": "number",
"primary_market_quantity": "number",
"secondary_market_quantity": "number",
"otc_quantity": "number",
"average_purchase_price": {
"amount": "number",
"decimal": "number",
"symbol": "string"
},
"total_invested": {
"amount": "number",
"decimal": "number",
"symbol": "string"
}
},
"last_purchase_date": "string",
"first_purchase_date": "string"
}
Example
Request
curl -X GET "\{\{baseUrl\}\}/v2/users/purchases/users/680c02896d91ca0145cfeb81/tokens/68ae06cfcccf4e8fc19362d1/quantity" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer \{\{token\}\}"
Response
{
"user_id": "680c02896d91ca0145cfeb81",
"token_id": "68ae06cfcccf4e8fc19362d1",
"token_name": "Real Estate Token",
"token_symbol": "RET",
"total_quantity": 50,
"available_quantity": 45,
"locked_quantity": 5,
"purchase_summary": {
"total_purchases": 3,
"primary_market_quantity": 25,
"secondary_market_quantity": 15,
"otc_quantity": 10,
"average_purchase_price": {
"amount": 11.2,
"decimal": 6,
"symbol": "USDT"
},
"total_invested": {
"amount": 560.0,
"decimal": 6,
"symbol": "USDT"
}
},
"last_purchase_date": "2024-01-20T09:15:00Z",
"first_purchase_date": "2024-01-10T14:30:00Z"
}
Error Responses
400 Bad Request
{
"error": "Invalid user ID or token ID format"
}
401 Unauthorized
{
"error": "Authentication required"
}
403 Forbidden
{
"error": "Access denied"
}
404 Not Found
{
"error": "User or token not found"
}
500 Internal Server Error
{
"error": "Internal server error"
}
Important Notes
- Available Quantity: Tokens that can be sold or transferred
- Locked Quantity: Tokens that are locked due to pending transactions or staking
- Purchase Types: Includes primary market, secondary market, and OTC purchases
- Average Price: Calculated based on all purchase transactions
- Real-time Data: Quantity information is updated in real-time