Ana içeriğe geç

Get Purchase Search

Search for specific purchases made by a user with detailed filtering options.

Endpoint

POST /v2/users/purchases/users/{user_id}/search

Headers

HeaderValue
Content-Typeapplication/json
AuthorizationBearer {token}

Path Parameters

ParameterTypeRequiredDescription
user_idstringYesThe unique identifier of the user

Request Body

{
"page": 1,
"per_page": 10,
"token_id": "68ae06cfcccf4e8fc19362d1"
}

Parameters

ParameterTypeRequiredDescription
pageintegerYesPage number for pagination
per_pageintegerYesNumber of items per page
token_idstringNoFilter by specific token ID

Response

Returns a paginated list of purchases matching the search criteria.

Success Response (200 OK)

{
"data": [
{
"id": "string",
"token_id": "string",
"token_name": "string",
"token_symbol": "string",
"quantity": "number",
"purchase_price": {
"amount": "number",
"decimal": "number",
"symbol": "string"
},
"total_cost": {
"amount": "number",
"decimal": "number",
"symbol": "string"
},
"fees": {
"platform_fee": {
"amount": "number",
"decimal": "number",
"symbol": "string"
},
"node_fee": {
"amount": "number",
"decimal": "number",
"symbol": "string"
}
},
"purchase_type": "string",
"market_type": "string",
"deal_id": "number",
"seller_id": "string",
"purchase_date": "string",
"status": "string",
"transaction_hash": "string"
}
],
"pagination": {
"current_page": 1,
"per_page": 10,
"total": "number",
"total_pages": "number"
}
}

Example

Request

curl -X POST "\{\{baseUrl\}\}/v2/users/purchases/users/680c02896d91ca0145cfeb81/search" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer \{\{token\}\}" \
-d '{
"page": 1,
"per_page": 10,
"token_id": "68ae06cfcccf4e8fc19362d1"
}'

Response

{
"data": [
{
"id": "purchase_456",
"token_id": "68ae06cfcccf4e8fc19362d1",
"token_name": "Real Estate Token",
"token_symbol": "RET",
"quantity": 15,
"purchase_price": {
"amount": 12.0,
"decimal": 6,
"symbol": "USDT"
},
"total_cost": {
"amount": 180.0,
"decimal": 6,
"symbol": "USDT"
},
"fees": {
"platform_fee": {
"amount": 5.4,
"decimal": 6,
"symbol": "USDT"
},
"node_fee": {
"amount": 3.6,
"decimal": 6,
"symbol": "USDT"
}
},
"purchase_type": "market",
"market_type": "secondary",
"deal_id": 13,
"seller_id": "680c02896d91ca0145cfeb82",
"purchase_date": "2024-01-15T14:30:00Z",
"status": "completed",
"transaction_hash": "0x1234567890abcdef1234567890abcdef12345678"
}
],
"pagination": {
"current_page": 1,
"per_page": 10,
"total": 1,
"total_pages": 1
}
}

Error Responses

400 Bad Request

{
"error": "Invalid request parameters"
}

401 Unauthorized

{
"error": "Authentication required"
}

403 Forbidden

{
"error": "Access denied"
}

404 Not Found

{
"error": "User not found"
}

500 Internal Server Error

{
"error": "Internal server error"
}