Quick start guide
Welcome to docpenny. This guide will take you from authentication to your first generated PDF in under five minutes. Our focus is on utility and precision, ensuring your documents look exactly as intended with minimal friction.
What blueprints are available?
To help you get started even faster, we provide pre-built blueprints for popular automation tools.
n8n PDF Generation
A complete n8n workflow to trigger PDF generation and handle the response.
1. Authentication
To interact with the docpenny API, you must authenticate using an API key.
- Navigate to the API Keys section in your dashboard settings.
- Click Create New Key and provide a descriptive name (e.g., “Production Web App”).
- Copy your key immediately. For security, we do not store the plaintext key and you will not be able to retrieve it again.
Include this key in every request using the x-api-key header:
x-api-key: <your_api_key> 2. Create a Template
docpenny uses standard HTML/CSS combined with the LiquidJS templating engine. This allows for high-precision layouts that are easy to maintain.
Templates are created via the Templates Dashboard or the API. A simple invoice template might look like this:
<!DOCTYPE html>
<html>
<head>
<style>
body { font-family: 'Noto Serif', serif; color: #212121; }
.header { color: #008272; font-size: 24px; font-weight: bold; border-bottom: 2px solid #008272; padding-bottom: 8px; }
.details { margin-top: 20px; }
</style>
</head>
<body>
<div class="header">INVOICE #{{ invoice_number }}</div>
<div class="details">
<p><strong>Client:</strong> {{ client_name }}</p>
<p><strong>Total:</strong> ${{ amount }}</p>
</div>
</body>
</html> 3. Generate a PDF
With your API key and template ready, you can trigger a PDF generation job. We use an asynchronous job-based system to ensure reliability even for complex documents.
The data field accepts JSONL (JSON Lines) format, where each line is one JSON object representing a single PDF task. A job supports up to 1,000 lines, enabling batch generation of multiple PDFs in a single request.
The POST Request
curl -X POST https://api.docpenny.com/api/jobs
-H "x-api-key: YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{
"templateId": "your-template-id",
"data": "{"invoice_number": "2024-001", "client_name": "Satoshi Nakamoto", "amount": 500.00}"
}' The Response
You will receive a 201 Created response with a job ID:
{
"jobId": "job_456def",
"status": "pending",
"totalTasks": 1
} Retrieving the Document
You can poll the status of your job or set up a Webhook to be notified when the PDF is ready. Once completed, the response will include a temporary download URL for your document.