Skip to main content

API Overview

The Pdflet API is a RESTful JSON API for generating PDFs from HTML content.

Base URL

All API requests should be made to:
https://api.pdflet.dev/api/v1

Request Format

  • All requests must include a Content-Type: application/json header
  • Request bodies must be valid JSON
  • Authentication is required for all endpoints

Response Format

All responses return JSON with consistent structure:

Success Response

{
  "id": "conv_abc123",
  "status": "completed",
  "file_url": "https://api.pdflet.dev/media/pdfs/conv_abc123.pdf",
  "created_at": "2024-01-15T10:30:00Z"
}

Error Response

{
  "error": "validation_error",
  "message": "Invalid page size",
  "details": {
    "page_size": ["Must be one of: A4, Letter, Legal, A3, A5"]
  }
}

HTTP Status Codes

CodeDescription
200Success
201Created
202Accepted (async processing started)
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing authentication
402Payment Required - No credits remaining
404Not Found - Resource doesn’t exist
429Too Many Requests - Rate limit exceeded
500Internal Server Error

Rate Limits

Rate limits vary by plan:
PlanRequests per Minute
Free10
Starter30
Pro100
Rate limit headers are included in every response:
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 29
X-RateLimit-Reset: 1705320000

Pagination

List endpoints support pagination via query parameters:
ParameterDefaultDescription
page1Page number
page_size20Items per page (max 100)
GET /api/v1/api-keys/?page=2&page_size=10

Idempotency

For safe retries, include an Idempotency-Key header:
curl -X POST https://api.pdflet.dev/api/v1/pdf/ \
  -H "X-API-Key: pk_live_your_api_key" \
  -H "Idempotency-Key: unique-request-id-123" \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Hello</h1>"}'
Requests with the same idempotency key within 24 hours return the cached response.