EveryPapers API Documentation & Reference
Integrate EveryPapers API to programmatically create professional PDF & Docx documents from templates and JSON data in seconds.
Quick Start
Prepare Template
Design your DOCX template with merge fields and upload it on dashboard.
Post Data
Send a POST request with your JSON data payload to our generation endpoint.
Get PDF or Docx
Receive a signed URL or binary stream of your perfectly formatted PDF/Docx.
curl --location 'https://api.everypapers.com/v1/generate_document' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"template_id": "TEMPLATE_ID",
"document_format": "pdf",
"records": [
{
"fileName": "invoice_001",
"fields": {
"AccountName": "John Doe"
}
}
]
}'
Design Your Template Easily
Use placeholders and structured data to generate dynamic PDF and DOCX documents.
Merge Fields Basics
{{CustomerName}}
Merge fields dynamically map values from the fields section of your JSON
payload into the template.
Each field name must match exactly.
{{InvoiceId}}
You can place merge fields anywhere in the template — headers, body, tables, or footers — and they will be replaced at runtime.
{{Total}}
Values are injected directly from your API request. The engine does not transform data — it simply replaces placeholders with provided values.
Dynamic Tables
Tables automatically repeat rows when bound to array data.
| Item | Qty | Price |
|---|---|---|
| {{item.name}} | {{item.qty}} | ${{item.price}} |
| Item | Qty | Price |
|---|---|---|
| Product 1 | 100 | $99 |
| Product 2 | 199 | $500 |
| Product 2 | 250 | $1000 |
Headers & Footers
Footer: Page {{page_number}} of {{total_pages}}
fields object, while system fields
like
page_number and total_pages are automatically generated during
document creation.
Live Example
INVOICE
Invoice #: {{InvoiceId}}
Date: {{date}}
{{CompanyName}}
{{CompanyAddress}}
Bill To:
{{CustomerName}}
{{CustomerEmail}}
| Item | Qty | Price |
|---|---|---|
| {{itm.name}} | {{itm.qty}} | ${{itm.price}} |
Subtotal: ${{Subtotal}}
Tax: ${{Tax}}
Total: ${{Total}}
INVOICE
Invoice #: INV-1001
Date: 2026-05-09
EveryPapers Inc.
New York, USA
Bill To:
Jane Doe
jane@email.com
| Item | Qty | Price |
|---|---|---|
| API Plan | 100 | $100 |
| Support | 50 | $50 |
Subtotal: $130
Tax: $20
Total: $150
API Reference
/v1/analyze_template
Upload a DOCX template to analyze and extract all dynamic placeholders (e.g., {{name}}, {{email}}). This helps you understand what data is required before generating documents.
Endpoint
URL
https://api.everypapers.com/v1/analyze_template
Parameters
Provide file or
template_id. At least one of these
parameters is required.
template_id
string (optional) —
The ID of a previously uploaded template. Required if
file is not provided.
file
file (optional) —
The DOCX template file to analyze. Required if
template_id is not
provided.
x-api-key
header (required) — Your API key for authentication.
import axios from "axios";
import fs from "fs";
import FormData from "form-data";
async function analyzeTemplate() {
try {
const form = new FormData();
// Use either template_id or file
form.append("template_id", "YOUR_TEMPLATE_ID");
form.append("file", fs.createReadStream("./template.docx"));
const response = await axios.post(
"https://api.everypapers.com/v1/analyze_template",
form,
{
headers: {
...form.getHeaders(),
"x-api-key": "YOUR_API_KEY",
},
}
);
console.log("Response:", response.data);
} catch (error) {
console.error("Error:", error.response?.data || error.message);
}
}
analyzeTemplate();
/v1/upload_template
Upload a DOCX template to EveryPapers for reuse in future document generation
requests.
Templates can also be uploaded and managed directly from the EveryPapers Dashboard,
so using this
API is optional. The API is useful when you want to upload templates
programmatically or integrate
template management into your own application or workflow.
The template file must be Base64 encoded and passed in the
content
property. After a successful upload, the API returns a
template_id
that can be used with the
/v1/generate_document
endpoint.
Endpoint
URL
https://api.everypapers.com/v1/upload_template
Parameters
template_name
string (required) —
A descriptive name for the template.
Example:
Invoice Template.
template_description
string (optional) — A short description explaining the purpose of the template.
content
string (required) — The DOCX template file encoded as a Base64 string. The template can contain standard merge fields and dynamic table placeholders.
Content-Type
header (required) —
Must be set to
application/json.
x-api-key
header (required) — Your EveryPapers API key used to authenticate the request.
import axios from "axios";
import fs from "fs";
async function uploadTemplate() {
try {
const templateContent = fs
.readFileSync("./template.docx")
.toString("base64");
const response = await axios.post(
"https://api.everypapers.com/v1/upload_template",
{
template_name: "Invoice Template",
template_description: "Retail invoice template",
content: templateContent
},
{
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
}
);
console.log("Template Uploaded:", response.data);
} catch (error) {
console.error(
"Error:",
error.response?.data || error.message
);
}
}
uploadTemplate();
/v1/generate_document
Generate one or more documents using a template previously uploaded to your
Dashboard.
Send the template ID, output format, and record data as a JSON request. The API
processes
the request asynchronously and immediately returns a
job_id
that can be used to track the generation status and download the completed files.
Endpoint
URL
https://api.everypapers.com/v1/generate_document
Parameters
template_id
string (required) —
ID of a template previously uploaded to your Dashboard.
Example:
TMP_MRAWMQMP.
document_format
string (required) —
Output format for the generated documents. Supported values:
docx and
pdf.
records
array (required) —
List of records used to generate documents. Each record contains a
fileName
and a
fields
object containing the template merge-field values.
fileName
string (required) —
Name to use for the generated document. The file extension is determined
by document_format.
fields
object (required) — Key-value pairs containing the data to merge into the template. Field names should match the placeholders defined in your uploaded template.
tables
object (optional) — Contains data for dynamic tables defined in the template. Each key represents a table identifier, and its value must be an array of row objects. The properties in each row should match the table column placeholders defined in the template.
email
string (optional) — Email address that will receive the generated ZIP file or a secure download link after processing is completed.
webhook_url
string (optional) — Callback URL that will be triggered when document generation is completed.
Content-Type
header (required) —
Must be set to
application/json.
x-api-key
header (required) — Your EveryPapers API key used to authenticate the request.
import axios from "axios";
async function generateDocument() {
try {
const response = await axios.post(
"https://api.everypapers.com/v1/generate_document",
{
template_id: "YOUR_TEMPLATE_ID",
document_format: "pdf",
records: [
{
fileName: "invoice_001",
fields: {
AccountName: "John Doe"
},
"tables": {
"itm": [
{"name": "API Plan", "qty": 1, "price": 100},
{"name": "Support", "qty": 1, "price": 50}
]
}
}
],
email: "test@example.com",
webhook_url: "https://example.com/webhook"
},
{
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
}
);
console.log("Job Created:", response.data);
} catch (error) {
console.error(
"Error:",
error.response?.data || error.message
);
}
}
generateDocument();
/v1/job_status
Retrieve the current status of a document generation job using the
job_id. This endpoint allows you to
track progress
and access the download link once the job is completed.
Endpoint
URL
https://api.everypapers.com/v1/job_status?job_id=JOB_ID
Query Parameters
job_id
string (required) —
The unique job ID returned from the
/generate_document API.
import axios from "axios";
async function getJobStatus() {
try {
const response = await axios.get(
"https://api.everypapers.com/v1/job_status",
{
params: {
job_id: "YOUR_JOB_ID",
},
}
);
console.log("Status:", response.data);
} catch (error) {
console.error("Error:", error.response?.data || error.message);
}
}
getJobStatus();
Webhooks
Receive real-time notifications when long-running document generation jobs are complete or if they fail.
- check_circle Verify signatures with SHA-256
- check_circle Automatic retry with exponential backoff
- check_circle Support for multiple endpoint subscriptions
{
"event": "document.ready",
"status": "completed"
"download_url": "https://s3.everypapers.io/...",
"job_id": 7b4f56f78213427991d9f444bf96673b,
"total_records": "10",
"completed_records": "10",
"document_format": "pdf"
"completed_at": "17 May 2026 at 12:44:06 UTC+5:30"
}
Error Handling
| Code | Message | Solution |
|---|---|---|
401_UNAUTHORIZED |
Invalid API Key provided | Check your Authorization header for typos. |
404_TEMPLATE_NOT_FOUND
|
Template ID doesn't exist | Ensure the ID matches what is in your dashboard. |
422_VALIDATION_ERROR
|
JSON data schema mismatch | Verify your payload against the template requirements. |
Common Mistakes
Using incorrect field name: {{fullname}} instead of
{{customer.name}}
Missing required fields or wrong structure in payload.
Missing API key or incorrect template_id in request.