Skip to main content
Retrieves full content details including the file URL for purchased content. This endpoint requires authentication and verifies that the user has purchased the content.
This endpoint requires user authentication. Include a valid JWT token in the Authorization header: Bearer <token>

Path Parameters

contentId
string
required
The unique identifier of the content to access

Request Headers

Authorization
string
required
Bearer token for user authentication

Response

content
object
Content object with file URL included

Error Responses

403 Forbidden

{
  "error": "You need to purchase this content to access it"
}

404 Not Found

{
  "error": "Content not found"
}

401 Unauthorized

Returned when authentication token is missing or invalid.

500 Internal Server Error

{
  "error": "Error message"
}
This endpoint verifies that a completed purchase exists for the authenticated user and the requested content before returning the file URL. Only purchases with status: 'completed' are considered valid.
{
  "content": {
    "_id": "507f1f77bcf86cd799439011",
    "title": "Advanced JavaScript Patterns",
    "description": "Learn advanced design patterns in JavaScript including Module, Observer, and Factory patterns with real-world examples.",
    "type": "pdf",
    "category": "507f1f77bcf86cd799439012",
    "price": 29.99,
    "fileUrl": "https://res.cloudinary.com/example/raw/upload/v1234567890/content.pdf",
    "filePublicId": "vaniyk/content/abc123",
    "thumbnailUrl": "https://res.cloudinary.com/example/image/upload/v1234567890/thumbnail.jpg",
    "thumbnailPublicId": "vaniyk/thumbnails/xyz789",
    "fileSize": 5242880,
    "status": "published",
    "tags": ["javascript", "patterns", "advanced", "design-patterns"],
    "createdBy": {
      "_id": "507f1f77bcf86cd799439013",
      "name": "John Doe"
    },
    "createdAt": "2024-03-01T12:00:00.000Z",
    "updatedAt": "2024-03-01T12:00:00.000Z"
  }
}

Build docs developers (and LLMs) love