Skip to content

API Reference

xPdf API generates high-performance PDF/A documents from JSON requests.


📍 Endpoint

The only canonical route:

EndpointAuthenticationDescription
POST /api/v1/labelAuthorization: Bearer <token>The only public request entry point. prod/test are distinguished solely by environment and token.

📋 Core Documentation

DocumentDescription
📋 JSON Schema (Complete)Full field reference
Schema ReferenceQuick reference
PDF ProfilesCompliance level configuration
Metadata & ValidationDocument properties and validation rules

🔧 Request Format

Headers

http
Content-Type: application/json
Authorization: Bearer <token>

Body

A single DocumentRequest JSON object:

json
{
  "settings": {
    "defaults": {
      "text": { "font_family": "NotoSans-Regular", "font_size": 12 },
      "stroke": { "color": "#000000", "width": 0.4 },
      "shape": { "corner_radius": 0 }
    }
  },
  "pages": [
    {
      "size": "a4",
      "elements": [
        { "type": "text", "x": 10, "y": 20, "content": "Hello xPdf" }
      ]
    }
  ]
}

✨ Core Capabilities

  • General-purpose elements: text / barcode / line / rect / circle / ellipse / polygon / image / table / stack
  • Horizontal anchor positioning: x_anchor for automatic element alignment
  • Page size presets: a4 / a6 / letter / legal / label_100_100 / label_100_150 / label_4_6_in
  • Image formats: jpg / jpeg / png / webp / svg

⚠️ Error Codes

CodeTrigger
API-001Invalid JSON payload
API-002Validation failure
API-101Missing or malformed Authorization header
API-102Authentication failed
API-500Internal system failure
API-501PDF rendering failure

Common ValidationError triggers:

  • Invalid link (unsupported URL scheme, page index out of bounds, invalid padding/border)
  • Invalid table (unknown column key, table.width cannot allocate positive width for undeclared columns, invalid span)
  • Invalid profile
  • x and x_anchor provided simultaneously