API Documentation
Welcome to the PDFx API documentation. Our API is designed to be simple, fast, and eco-friendly.
Endpoint
POST https://pdfx.com/v1
Payload
The main structure of your JSON request.
{
"header": [ elements ],
"content": [ elements ],
"footer": [ elements ],
"font": ["helveltica"], // titillium, noto, noto_tc or noto_jp
"options": {},
"xml_attachement": "<xml>...</xml>",
"xmp_attachement": "<xml>...</xml>"
}
Templates
Templates allow you to save and reuse PDF configurations in your account. This is particularly useful for generating invoices, reports, and other documents that follow a consistent structure. Templates are especially powerful when combined with Factur-X/ZUGFeRD compliance for electronic invoicing.
What are Templates?
Templates are reusable PDF configurations stored in your account. Each template contains:
- JSON Payload: The document structure with all elements (text, tables, images, etc.)
- XMP Metadata: Optional PDF/A-3 metadata for archival compliance
- XML Attachment: Optional structured data (e.g., Factur-X invoice data)
Managing Templates
Access your templates from your account page. You can:
- • Create new templates with a visual editor
- • Edit existing templates and preview changes in real-time
- • Test your templates before using them in production
- • Use templates via API by referencing their UUID
Using Templates via API
Once you've created a template, you can use it in your API calls by referencing its UUID. This allows you to separate your document structure from your application code.
curl -X POST https://pdfx.com/v1 \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template_uuid": "your-template-uuid-here",
"variables": {
"customer_name": "Acme Corp",
"invoice_number": "INV-2024-001"
}
}'
Factur-X Templates
Factur-X (also known as ZUGFeRD in Germany) is a European standard for electronic invoicing that combines a human-readable PDF with machine-readable XML data. PDFx makes it easy to create Factur-X compliant invoices using templates.
Why Factur-X?
- Compliance: Meet French, German, and EU e-invoicing regulations
- Automation: Enable automatic invoice processing in ERP systems
- Archival: PDF/A-3 format ensures long-term document preservation
Creating a Factur-X Template
To create a Factur-X compliant invoice template, you need to configure three components:
1 JSON Payload (Visual Invoice)
Design your invoice layout using standard PDFx elements. This creates the human-readable PDF that customers will see.
{
"fonts": ["helvetica"],
"content": [
{
"type": "paragraph",
"value": "INVOICE",
"options": { "fontSize": 24, "fontWeight": "bold" }
},
// Add more elements: tables, customer info, line items, etc.
]
}
2 XMP Metadata (PDF/A-3 Compliance)
Add XMP metadata to make your PDF compliant with PDF/A-3 archival standards. This is required for Factur-X.
<?xml version="1.0" encoding="UTF-8"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:fx="urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#">
<fx:DocumentType>INVOICE</fx:DocumentType>
<fx:DocumentFileName>factur-x.xml</fx:DocumentFileName>
<fx:Version>1.0</fx:Version>
<fx:ConformanceLevel>BASIC</fx:ConformanceLevel>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
3 XML Attachment (Structured Invoice Data)
Include the Factur-X XML data that contains structured invoice information for automated processing.
<?xml version="1.0" encoding="UTF-8"?>
<rsm:CrossIndustryInvoice
xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100">
<rsm:ExchangedDocumentContext>
<ram:GuidelineSpecifiedDocumentContextParameter>
<ram:ID>urn:factur-x.eu:1p0:basic</ram:ID>
</ram:GuidelineSpecifiedDocumentContextParameter>
</rsm:ExchangedDocumentContext>
<!-- Add invoice details, line items, totals, etc. -->
</rsm:CrossIndustryInvoice>
Important Notes
- • The XML filename in XMP metadata must match the actual attachment name (typically "factur-x.xml")
- • Use the BASIC conformance level for simple invoices, or COMFORT/EXTENDED for more complex scenarios
- • Ensure your XML follows the Cross Industry Invoice (CII) standard schema
Testing Your Factur-X Template
After creating your template, use the built-in editor to test it:
- 1 Click "Generate PDF" to preview your invoice layout
- 2 Download the PDF and verify it with a Factur-X validator tool
- 3 Test the XML extraction with your ERP system or accounting software
Ready to Get Started?
Visit your account page to create your first Factur-X template. The visual editor makes it easy to design your invoice layout and configure the required metadata.
Elements
Set Font
{
"type": "font",
"value": "helveltica",
"weight": "normal" // or bold
}
Paragraph
{
"type": "paragraph",
"value": "Lorem, ipsum dolor sit ...",
"options": {
"fontSize": 19
}
}
Image
{
"type": "image",
"value": "https://your-link-to/image.jpg",
"width": 500
}
⚠️ PNG Limitation: PNG images must not exceed 100x100 pixels. For larger images, please use JPEG format which offers better performance.
Table
{
"type": "table",
"header_columns": [
{
"title": "Column 1",
"options": { "fontSize": 19 }
}
],
"rows": [
[
{
"value": [
{
"content": [
{ "type": "text", "value": "Hello world", "fontSize": 22, "fontWeight": "bold" },
{ "type": "text", "value": "Hello world 3", "fontSize": 12 }
],
"width": 305, "fontSize": 10, "alignment": "left",
"borderSides": { "right": false }
}
]
}
]
]
}
SVG Path
{
"type": "svg_path",
"value": "M344.2 794.3l-0.3-1.5...",
"width": 500,
"height": 500,
"options": {
"strokeColor": "000000",
"borderWidth": 1,
"align": "center",
"fillColor": "cccccc"
}
}
QRCode
{
"type": "qrcode",
"value": "some data"
}
EAN13
{
"type": "ean13",
"code": "5901234123457",
"width": 200,
"height": 50
}
Drawing
Position
{
"type": "move",
"x": 10,
"y": 0
}
Draw Line
{
"type": "line",
"from_x": 10, "to_x": 500,
"from_y": 10, "to_y": 10,
"width": 1,
"options": {
"color": "00aa00",
"style": "dotted",
"cap": "round"
}
}
If from_x and from_y is not set, the current position will be used.
Draw Rectangle
{
"type": "rectangle",
"width": 100,
"height": 100,
"options": {
"borderWidth": 1,
"borderStyle": "solid",
"borderColor": "000000",
"fillColor": "ffffff",
"borderSides": {
"left": true,
"right": true,
"top": true,
"bottom": true
}
}
}