Skip to main content

Get Transactions

Retrieve a paginated list of transactions for the authenticated user.
curl -X GET "https://api.cryptoshop.com/api/transactions?type=purchase&status=confirmed&limit=10&page=1" \
  -H "Authorization: Bearer YOUR_TOKEN"

Query Parameters

type
string
Filter by transaction type. Options: purchase, refund, deposit, withdrawal
status
string
Filter by transaction status. Options: pending, confirmed, failed
limit
number
default:"10"
Number of transactions to return per page
page
number
default:"1"
Page number for pagination

Response

success
boolean
required
Indicates if the request was successful
transactions
array
required
Array of transaction objects
pagination
object
required
Pagination information
{
  "success": true,
  "transactions": [
    {
      "_id": "648a1234567890abcdef1234",
      "userId": "648a1234567890abcdef5678",
      "orderId": "648a1234567890abcdef9012",
      "type": "purchase",
      "amount": 25.5,
      "currency": "TRX",
      "network": "TRC-20",
      "transactionHash": "a1b2c3d4e5f6...",
      "fromAddress": "TGzz8gjYiYRqpfmDwnLxfgPuLVNmpCswVp",
      "toAddress": "TXyza9876543210zyxwvutsrqponmlkjih",
      "status": "confirmed",
      "confirmations": 19,
      "createdAt": "2024-03-15T10:30:00.000Z",
      "updatedAt": "2024-03-15T10:35:00.000Z"
    }
  ],
  "pagination": {
    "total": 45,
    "page": 1,
    "pages": 5
  }
}

Get Transaction by ID

Retrieve a specific transaction by its ID.
curl -X GET https://api.cryptoshop.com/api/transactions/648a1234567890abcdef1234 \
  -H "Authorization: Bearer YOUR_TOKEN"

Path Parameters

id
string
required
The transaction ID

Response

success
boolean
required
Indicates if the request was successful
transaction
object
required
The transaction object (see structure above)
{
  "success": true,
  "transaction": {
    "_id": "648a1234567890abcdef1234",
    "userId": "648a1234567890abcdef5678",
    "type": "withdrawal",
    "amount": 100,
    "currency": "TRX",
    "network": "TRC-20",
    "transactionHash": "xyz789...",
    "fromAddress": "TGzz8gjYiYRqpfmDwnLxfgPuLVNmpCswVp",
    "toAddress": "TXyza9876543210zyxwvutsrqponmlkjih",
    "status": "confirmed",
    "confirmations": 25,
    "createdAt": "2024-03-15T10:30:00.000Z",
    "updatedAt": "2024-03-15T10:35:00.000Z"
  }
}

Error Responses

{
  "error": "Transaction not found"
}
Users can only access their own transactions. Attempting to access another user’s transaction will return a 403 error.

Build docs developers (and LLMs) love