Get Purchase Quantity
Returns how much of a token the user holds and the per-user holding cap of that token. Use it before a primary-market buy: Buy On Primary Market refuses a buy that would take the user's holding above max_allowed_quantity.
Required permission: purchase:view
Request
GET /v2/users/{user_id}/purchases/tokens/{token_id}/quantity
Parameters
| Name | Type | In | Description |
|---|---|---|---|
user_id | string | path | Required. User ID |
token_id | string | path | Required. Token ID |
Headers
| Name | Description |
|---|---|
Authorization | Required. Bearer <access_token> |
Example
curl --request GET \
--url '{{baseUrl}}/v2/users/680c02896d91ca0145cfeb81/purchases/tokens/68ae06cfcccf4e8fc19362d1/quantity' \
--header 'Authorization: Bearer <access_token>'
Response
{
"purchased_quantity": 25,
"max_allowed_quantity": 100
}
Response Fields
| Field | Type | Description |
|---|---|---|
purchased_quantity | integer | Quantity of the token the user still holds (bought minus sold). 0 when the user holds none |
max_allowed_quantity | integer | The token's per-user holding cap (metric.max_purchase_quantity). 0 means no cap |
Errors
| Status | Code | Description |
|---|---|---|
| 400 | 10001 | Token not found (domain 5). Also returned when token_id is not a valid id |
| 400 | 10016 | user_id is not a valid 24-character hex id |
| 500 | 10000 | Unexpected server-side failure |
See Errors for the error format and common codes.