# PDF & Document Generation API — Zylalabs Description
**Copy-paste the text below into Zylalabs' "Long Description" field:**
---
## Overview
The PDF & Document Generation API is a production-grade REST API that converts HTML, URLs, and structured data into pixel-perfect PDF documents. Built for developers who need to automate document workflows — invoices, receipts, reports, contracts, dashboards — without managing browser engines, Chromium servers, or rendering infrastructure.
Powered by ProdaDoc, this API handles the entire PDF pipeline: generation, merging, and metadata extraction, all through simple JSON-in, PDF-out endpoints.
## Key Features
**HTML to PDF Conversion**
Send any HTML string — with full CSS support including Flexbox, Grid, custom fonts, and print media queries — and receive a production-quality PDF in milliseconds. Perfect for converting email templates, dashboards, and custom documents into downloadable PDFs.
**URL to PDF Conversion**
Convert any publicly accessible webpage into a PDF document. The API renders the full page including JavaScript-generated content, making it ideal for archiving web pages, generating compliance snapshots, or creating offline copies of web content.
**Template-Based PDF Generation**
Generate professional documents from pre-built templates by sending structured JSON data. Available templates include:
- **Invoice Template** — Line items, tax calculation, company branding, payment terms, and client details
- **Receipt Template** — Transaction records with payment method, transaction ID, and itemized purchases
- **Report Template** — Multi-section business reports with executive summary, data sections, conclusions, and confidential markings
**PDF Merging**
Combine 2 to 20 separate PDF documents into a single merged file with one API call. Essential for assembling contract packages, combining multi-page reports, or bundling related documents for delivery.
**PDF Metadata Extraction**
Extract detailed information from any PDF file including page count, individual page dimensions (width and height), and document properties. Useful for validation, cataloging, and pre-processing PDF files in automated workflows.
## API Endpoints
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /health | Health check and API status (no authentication required) |
| POST | /api/v1/pdf/from-html | Generate a PDF from an HTML string |
| POST | /api/v1/pdf/from-url | Generate a PDF from a webpage URL |
| POST | /api/v1/pdf/from-template | Generate a PDF from a pre-built template with dynamic data |
| POST | /api/v1/pdf/merge | Merge multiple PDF files into one document |
| POST | /api/v1/pdf/metadata | Extract page count and dimensions from a PDF |
## Customization Options
Every PDF generation endpoint supports extensive customization:
- **Page Format:** A3, A4, A5, Letter, Legal
- **Orientation:** Portrait or Landscape
- **Margins:** Custom top, right, bottom, and left margins in millimeters
- **Scale:** Adjust content scaling from 10% to 200%
- **Background Printing:** Include or exclude CSS background colors and images
- **Headers and Footers:** Custom HTML header and footer templates with page numbers
## Common Use Cases
**SaaS Platforms** — Automatically generate monthly invoices, usage reports, and export user data as downloadable PDF files directly from your application backend.
**E-Commerce and Retail** — Print itemized purchase receipts with payment method details (credit card, PayPal, M-Pesa, bank transfer) and transaction identifiers for customer records.
**Legal and Financial Services** — Merge multiple contract pages, NDAs, terms of service, and amendment documents into a single bundled PDF for client signatures.
**Freelancers and Agencies** — Create branded invoices with company logo, payment terms, and line-item billing in seconds without any design software.
**Healthcare and Medical** — Generate patient reports, discharge summaries, and appointment confirmations as secure PDF documents.
**Education** — Produce certificates, transcripts, and assessment reports from student data records.
**Real Estate** — Generate property listing sheets, rental agreements, and inspection reports from structured data.
## Security
This API has undergone a comprehensive 28-point security audit covering:
- Input validation on every endpoint using strict schema validation
- SSRF (Server-Side Request Forgery) protection blocking access to localhost, private IPs, and cloud metadata endpoints
- XSS prevention with HTML entity escaping in all templates
- Timing-safe API key authentication to prevent timing attacks
- Rate limiting per API key to prevent abuse
- Security headers including HSTS, Content Security Policy, and X-Frame-Options
- No storage of generated PDFs — documents are returned immediately and never persisted
## Integration Example
Generate an invoice PDF with a single HTTP request:
```
POST /api/v1/pdf/from-template
Content-Type: application/json
x-api-key: YOUR_API_KEY
{
"template": "invoice",
"data": {
"companyName": "Your Company",
"clientName": "Client Name",
"invoiceNumber": "INV-001",
"items": [
{
"description": "Consulting Services",
"quantity": 10,
"unitPrice": 150,
"amount": 1500
}
],
"total": 1500,
"currency": "USD"
}
}
```
Response: Raw PDF binary file (application/pdf content type)
## Performance
- Average response time: Under 400 milliseconds for HTML-to-PDF
- Concurrent request handling with a managed browser pool
- Circuit breaker pattern for automatic recovery from failures
- Request ID tracing on every API call for end-to-end observability
## Error Handling
All errors return structured JSON responses with:
- A machine-readable error code (VALIDATION_ERROR, UNAUTHORIZED, RATE_LIMITED, etc.)
- A human-readable error message explaining what went wrong
- A retryable flag indicating whether the request can be retried
No stack traces or internal server details are ever exposed to API consumers.
Check API status and uptime. Add ?deep=true to test the PDF rendering engine and get memory usage stats. No authentication required.
Health Check - Endpoint Features
| Object | Description |
|---|
{"status":"healthy","timestamp":"2026-03-13T14:10:46.756Z","uptime":154731,"version":"1.0.0"}
curl --location --request GET 'https://zylalabs.com/api/12011/html+to+pdf+generation+api/22873/health+check' --header 'Authorization: Bearer YOUR_API_KEY'
Parse a PDF document and extract detailed metadata including title, author, subject, creator, producer, creation date, modification date, total page count, and individual page dimensions (width and height in points). Send the PDF as a base64-encoded string. Maximum size: 50MB. Response is JSON.
Extract PDF Metadata - Endpoint Features
| Object | Description |
|---|---|
Request Body |
[Required] Json |
{"metadata":{"title":null,"author":null,"subject":null,"creator":"pdf-lib (https://github.com/Hopding/pdf-lib)","producer":"pdf-lib (https://github.com/Hopding/pdf-lib)","creationDate":"2026-03-13T14:13:21.000Z","modificationDate":"2026-03-13T14:13:21.000Z","pageCount":1,"pages":[{"index":0,"width":72,"height":72}]},"requestId":"ded7bd08-06c3-451d-8767-87516d81b086"}
curl --location --request POST 'https://zylalabs.com/api/12011/html+to+pdf+generation+api/22878/extract+pdf+metadata' --header 'Authorization: Bearer YOUR_API_KEY'
--data-raw '{
"pdf": "JVBERi0xLjcKCjEgMCBvYmogICUKPDwvVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCgoyIDAgb2JqCjw8L1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPj4KZW5kb2JqCgozIDAgb2JqCjw8L1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA3MiA3Ml0KPj4KZW5kb2JqCgp4cmVmCjAgNAowMDAwMDAwMDAwIDY1NTM1IGYgCjAwMDAwMDAwMTAgMDAwMDAgbiAKMDAwMDAwMDA2MCAwMDAwMCBuIAowMDAwMDAwMTE2IDAwMDAwIG4gCnRyYWlsZXIKPDwvU2l6ZSA0Ci9Sb290IDEgMCBSCj4+CnN0YXJ0eHJlZgoxNzMKJSVFT0YK"
}'
| Header | Description |
|---|---|
Authorization
|
[Required] Should be Bearer access_key. See "Your API Access Key" above when you are subscribed. |
No long-term commitment. Upgrade, downgrade, or cancel anytime. Free Trial includes up to 50 requests.
Each endpoint returns specific data types: the HTML to PDF, URL to PDF, and template PDF generation endpoints return binary PDF files. The PDF merging endpoint also returns a binary PDF file. The metadata extraction endpoint returns a JSON object containing detailed metadata about the PDF, including title, author, and page count.
The key fields in the metadata extraction response include "title," "author," "subject," "creator," "producer," "creationDate," "modificationDate," and "pageCount." Each page's dimensions are also included in the "pages" array.
The HTML to PDF endpoint accepts parameters such as "html" (the HTML content), "filename" (the desired PDF filename), and "options" for customization, including "format" (A3, A4, etc.), "landscape" (true/false), "printBackground" (true/false), and "margin" settings.
The response data for the PDF merging endpoint is organized as a binary PDF file. The merged document contains all pages from the input PDFs in the order they were provided, ensuring a seamless combination of documents.
The PDF metadata extraction endpoint provides information such as the document's title, author, subject, creator, producer, creation and modification dates, total page count, and individual page dimensions, allowing for comprehensive document analysis.
Users can customize their requests by sending structured JSON data that includes specific fields relevant to the chosen template (invoice, receipt, or report). Each template allows for dynamic data input, such as line items for invoices or transaction details for receipts.
Typical use cases include generating downloadable invoices from HTML templates, archiving web pages as PDFs for compliance, and creating reports or dashboards that need to be shared in a portable format.
Users can save the binary PDF response directly to a file with a .pdf extension. This allows for easy sharing, printing, or archiving of documents generated through the API, ensuring they maintain the intended formatting and quality.
O endpoint de conversão de HTML para PDF aceita um tamanho máximo de HTML de 5MB. Para a mesclagem de PDFs, cada arquivo PDF deve ter um tamanho máximo de 50MB. O endpoint de extração de metadados também aceita PDFs de até 50MB.
Os usuários podem personalizar a aparência dos PDFs ajustando parâmetros como "formato" (A3, A4, etc.), "orientação" (retrato ou paisagem), "margens" (superior, inferior, etc.), e "impressão de fundo" (incluir ou excluir cores e imagens de fundo).
Se a solicitação falhar, a API retornará uma resposta JSON estruturada com um código de erro, uma mensagem explicativa e uma bandeira de repetição que indica se a solicitação pode ser repetida.
Para garantir a renderização correta, os usuários devem enviar HTML válido e bem estruturado, incluindo CSS compatível. A API suporta Flexbox, Grid e fontes personalizadas, permitindo uma formatação precisa.
Os modelos disponíveis incluem fatura (com itens de linha e detalhes de pagamento), recibo (com registros de transação) e relatório (com seções múltiplas e resumo executivo), permitindo a criação de documentos profissionais.
Os usuários podem mesclar de 2 a 20 PDFs enviando cada arquivo como uma string codificada em base64. A API retornará um único PDF que contém todas as páginas dos documentos de entrada na ordem fornecida.
Para processar uma URL, a página deve ser publicamente acessível. A API renderiza completamente a página, incluindo conteúdo gerado por JavaScript, mas bloqueia URLs que acessam localhost ou IPs privados por motivos de segurança.
Zyla API Hub is like a big store for APIs, where you can find thousands of them all in one place. We also offer dedicated support and real-time monitoring of all APIs. Once you sign up, you can pick and choose which APIs you want to use. Just remember, each API needs its own subscription. But if you subscribe to multiple ones, you'll use the same key for all of them, making things easier for you.
Prices are listed in USD (United States Dollar), EUR (Euro), CAD (Canadian Dollar), AUD (Australian Dollar), and GBP (British Pound). We accept all major debit and credit cards. Our payment system uses the latest security technology and is powered by Stripe, one of the world's most reliable payment companies. If you have any trouble paying by card, just contact us at [email protected]
Additionally, if you already have an active subscription in any of these currencies (USD, EUR, CAD, AUD, GBP), that currency will remain for subsequent subscriptions. You can change the currency at any time as long as you don't have any active subscriptions.
The local currency shown on the pricing page is based on the country of your IP address and is provided for reference only. The actual prices are in USD (United States Dollar). When you make a payment, the charge will appear on your card statement in USD, even if you see the equivalent amount in your local currency on our website. This means you cannot pay directly with your local currency.
Occasionally, a bank may decline the charge due to its fraud protection settings. We suggest reaching out to your bank initially to check if they are blocking our charges. Also, you can access the Billing Portal and change the card associated to make the payment. If these does not work and you need further assistance, please contact our team at [email protected]
Prices are determined by a recurring monthly or yearly subscription, depending on the chosen plan.
API calls are deducted from your plan based on successful requests. Each plan comes with a specific number of calls that you can make per month. Only successful calls, indicated by a Status 200 response, will be counted against your total. This ensures that failed or incomplete requests do not impact your monthly quota.
Zyla API Hub works on a recurring monthly subscription system. Your billing cycle will start the day you purchase one of the paid plans, and it will renew the same day of the next month. So be aware to cancel your subscription beforehand if you want to avoid future charges.
To upgrade your current subscription plan, simply go to the pricing page of the API and select the plan you want to upgrade to. The upgrade will be instant, allowing you to immediately enjoy the features of the new plan. Please note that any remaining calls from your previous plan will not be carried over to the new plan, so be aware of this when upgrading. You will be charged the full amount of the new plan.
To check how many API calls you have left for the current month, refer to the 'X-Zyla-API-Calls-Monthly-Remaining' field in the response header. For example, if your plan allows 1,000 requests per month and you've used 100, this field in the response header will indicate 900 remaining calls.
To see the maximum number of API requests your plan allows, check the 'X-Zyla-RateLimit-Limit' response header. For instance, if your plan includes 1,000 requests per month, this header will display 1,000.
The 'X-Zyla-RateLimit-Reset' header shows the number of seconds until your rate limit resets. This tells you when your request count will start fresh. For example, if it displays 3,600, it means 3,600 seconds are left until the limit resets.
Yes, you can cancel your plan anytime by going to your account and selecting the cancellation option on the Billing page. Please note that upgrades, downgrades, and cancellations take effect immediately. Additionally, upon cancellation, you will no longer have access to the service, even if you have remaining calls left in your quota.
You can contact us through our chat channel to receive immediate assistance. We are always online from 8 am to 5 pm (EST). If you reach us after that time, we will get back to you as soon as possible. Additionally, you can contact us via email at [email protected]
To give you the opportunity to experience our APIs without any commitment, we offer a 7-day free trial that allows you to make up to 50 API calls at no cost. This trial can be used only once, so we recommend applying it to the API that interests you the most. While most of our APIs offer a free trial, some may not. The trial concludes after 7 days or once you've made 50 requests, whichever occurs first. If you reach the 50 request limit during the trial, you will need to "Start Your Paid Plan" to continue making requests. You can find the "Start Your Paid Plan" button in your profile under Subscription -> Choose the API you are subscribed to -> Pricing tab. Alternatively, if you don't cancel your subscription before the 7th day, your free trial will end, and your plan will automatically be billed, granting you access to all the API calls specified in your plan. Please keep this in mind to avoid unwanted charges.
After 7 days, you will be charged the full amount for the plan you were subscribed to during the trial. Therefore, it's important to cancel before the trial period ends. Refund requests for forgetting to cancel on time are not accepted.
When you subscribe to an API free trial, you can make up to 50 API calls. If you wish to make additional API calls beyond this limit, the API will prompt you to perform an "Start Your Paid Plan." You can find the "Start Your Paid Plan" button in your profile under Subscription -> Choose the API you are subscribed to -> Pricing tab.
Payout Orders are processed between the 20th and the 30th of each month. If you submit your request before the 20th, your payment will be processed within this timeframe.
Service Level:
89%
Response Time:
4,622ms
Service Level:
100%
Response Time:
0ms
Service Level:
100%
Response Time:
68ms
Service Level:
100%
Response Time:
4,368ms
Service Level:
91%
Response Time:
2,513ms
Service Level:
100%
Response Time:
652ms
Service Level:
100%
Response Time:
0ms
Service Level:
100%
Response Time:
7,660ms
Service Level:
100%
Response Time:
2,788ms
Service Level:
100%
Response Time:
1,366ms
Service Level:
100%
Response Time:
0ms
Service Level:
100%
Response Time:
0ms
Service Level:
100%
Response Time:
695ms
Service Level:
100%
Response Time:
0ms
Service Level:
100%
Response Time:
650ms
Service Level:
100%
Response Time:
431ms
Service Level:
100%
Response Time:
0ms
Service Level:
100%
Response Time:
0ms
Service Level:
40%
Response Time:
370ms
Service Level:
100%
Response Time:
1,725ms