Skip to main content
Retrieves a paginated list of all content purchased by the authenticated user. This endpoint requires authentication.
This endpoint requires user authentication. Include a valid JWT token in the Authorization header: Bearer <token>

Request Headers

Authorization
string
required
Bearer token for user authentication

Query Parameters

page
number
default:"1"
Page number for pagination
limit
number
default:"10"
Number of items per page

Response

purchases
array
Array of purchase objects
totalPages
number
Total number of pages
currentPage
number
Current page number
totalPurchases
number
Total count of completed purchases

Error Responses

401 Unauthorized

Returned when authentication token is missing or invalid.

500 Internal Server Error

{
  "error": "Error message"
}
This endpoint only returns purchases with status: 'completed'. Pending or failed purchases are not included. The purchases are sorted by purchasedAt in descending order (most recent first).
To access the full content including the file URL, use the Access Content endpoint with the content ID from the purchase.
{
  "purchases": [
    {
      "_id": "507f1f77bcf86cd799439014",
      "user": "507f1f77bcf86cd799439015",
      "content": {
        "_id": "507f1f77bcf86cd799439011",
        "title": "Advanced JavaScript Patterns",
        "description": "Learn advanced design patterns in JavaScript",
        "type": "pdf",
        "category": "507f1f77bcf86cd799439012",
        "price": 29.99,
        "thumbnailUrl": "https://res.cloudinary.com/example/image/upload/v1234567890/thumbnail.jpg"
      },
      "status": "completed",
      "purchasedAt": "2024-03-02T10:30:00.000Z"
    },
    {
      "_id": "507f1f77bcf86cd799439016",
      "user": "507f1f77bcf86cd799439015",
      "content": {
        "_id": "507f1f77bcf86cd799439017",
        "title": "Node.js Microservices",
        "description": "Building scalable microservices with Node.js",
        "type": "video",
        "category": "507f1f77bcf86cd799439018",
        "price": 49.99,
        "thumbnailUrl": "https://res.cloudinary.com/example/image/upload/v1234567890/thumbnail2.jpg"
      },
      "status": "completed",
      "purchasedAt": "2024-03-01T14:20:00.000Z"
    }
  ],
  "totalPages": 2,
  "currentPage": 1,
  "totalPurchases": 15
}

Build docs developers (and LLMs) love