API Reference
xPdf API generates high-performance PDF/A documents from JSON requests.
📍 Endpoint
The only canonical route:
| Endpoint | Authentication | Description |
|---|---|---|
POST /api/v1/label | Authorization: Bearer <token> | The only public request entry point. prod/test are distinguished solely by environment and token. |
📋 Core Documentation
| Document | Description |
|---|---|
| 📋 JSON Schema (Complete) | Full field reference |
| Schema Reference | Quick reference |
| PDF Profiles | Compliance level configuration |
| Metadata & Validation | Document 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_anchorfor 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
| Code | Trigger |
|---|---|
| API-001 | Invalid JSON payload |
| API-002 | Validation failure |
| API-101 | Missing or malformed Authorization header |
| API-102 | Authentication failed |
| API-500 | Internal system failure |
| API-501 | PDF rendering failure |
Common ValidationError triggers:
- Invalid
link(unsupported URL scheme, page index out of bounds, invalidpadding/border) - Invalid
table(unknown column key,table.widthcannot allocate positive width for undeclared columns, invalid span) - Invalid
profile xandx_anchorprovided simultaneously