verified Developer Reference v1.0

EveryPapers API Documentation

search /

Integrate EveryPapers into your web app, ERP, or SaaS platform to generate pixel-perfect PDF and DOCX documents in milliseconds. Use standard Microsoft Word templates with dynamic data, repeating tables, custom file naming, and automated webhook delivery.

architecture

How EveryPapers Works

EveryPapers separates visual template design from business data. You design documents once in Microsoft Word or Google Docs using natural double-curly placeholders like {{customer_name}}, and your system triggers asynchronous generation via a single REST call.

1

Design in Word

Create a .docx file. Format text, brand colors, fonts, and repeating table rows using double-curly tags.

2

Upload Template

Upload your file via /v1/upload_template or the dashboard to obtain a permanent template_id.

3

Post JSON Data

Send dynamic records to /v1/generate_document. Queue 1 to 200 documents in a single request.

4

Receive Document

Get signed download URLs instantly via webhook callback, status polling, or automatic direct email delivery.

bolt

60-Second Quickstart

Generate your first document right now. Pass your x-api-key, template ID, target format ("pdf" or "docx"), and data records.

Generate Invoice Example
curl --location 'https://api.everypapers.com/v1/generate_document' \
  --header 'x-api-key: ep_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "template_id": "TMP_94B3F182",
    "document_format": "pdf",
    "records": [
      {
        "fileName": "Invoice_INV-1001",
        "fields": {
          "customer_name": "Acme Corp",
          "invoice_number": "INV-1001",
          "date": "2026-09-19",
          "total_amount": "$1,450.00"
        },
        "tables": {
          "items": [
            { "description": "Cloud Hosting Standard", "qty": "1", "rate": "$950.00", "amount": "$950.00" },
            { "description": "Dedicated IP & SSL", "qty": "2", "rate": "$250.00", "amount": "$500.00" }
          ]
        }
      }
    ],
    "webhook_url": "https://your-domain.com/webhooks/everypapers"
  }'
key

Authentication & Rate Limits

All EveryPapers endpoints require an API Key passed in the x-api-key HTTP header. You can generate and rotate keys anytime from your EveryPapers Dashboard.

token Key Format

ep_ prefixed tokens

Every active key starts with ep_ (e.g. ep_a4b91f0c...). Never commit keys to client-side code.

speed Daily Quota

1,000 Documents / Day

Free accounts include 1,000 document generations every calendar day. Limits reset automatically at 00:00 UTC.

layers Batch Capacity

Up to 200 Records / Call

Submit between 1 and 200 records in a single payload. Multi-record jobs are bundled into a high-speed ZIP file.

security
Security Notice: Always call EveryPapers from your backend service (Node.js, Python, Go, PHP, Java, etc.). Never expose your x-api-key in front-end JavaScript or mobile apps.
edit_document

Template Syntax & Tag Rules

EveryPapers processes standard .docx files created with Word, Google Docs, or LibreOffice. Tags use standard double-curly braces. The engine preserves all your font families, colors, text sizes, bold/italic stylings, and cell borders.

{{field_name}}

Simple Merge Fields

Maps directly to keys in your record's fields: {} object. Works across paragraphs, headers, footers, and table cells.

{{items.column}}

Dynamic Table Rows

Place inside a single table row. The prefix before the dot (items) binds to tables.items: [...], auto-duplicating the row.

"fileName"

Custom File Naming

Set "fileName": "Invoice_Acme" in each record. The resulting PDF/DOCX (and internal ZIP entries) will be named Invoice_Acme.pdf.

table_chart How Dynamic Repeating Tables Work

To render line items (such as invoices, bills of materials, or attendance records), create a table in your Word document with a header row and exactly one template row. Use the dot notation matching your JSON array key:

In Your Word DOCX Template invoice_template.docx
Description Qty Price Total
{{items.description}} {{items.qty}} {{items.rate}} {{items.amount}}
Total: {{total_amount}}

💡 Notice: The row containing {{items.*}} will be repeated automatically for every object in tables.items. The Header and Total rows stay untouched!

Rendered Output (PDF / DOCX) Automatic Row Expansion
Description Qty Price Total
Enterprise Cloud Subscription 1 $1,200.00 $1,200.00
Priority 24/7 Support Tier 1 $250.00 $250.00
Total: $1,450.00

✅ All font weights, alignments, borders, and margins configured in Word are pixel-accurately preserved!

preview End-to-End Visual Workflow

1. Template File .docx
INVOICE
Bill To: {{customer_name}}
Invoice: {{invoice_number}}
TABLE ROW:
{{items.description}} | {{items.amount}}
Total: {{total_amount}}
2. POST Payload JSON
{
  "records": [{
    "fileName": "Inv_1001",
    "fields": {
      "customer_name": "Acme Corp",
      "invoice_number": "INV-1001",
      "total_amount": "$1,450.00"
    },
    "tables": {
      "items": [
        {"description": "Hosting", "amount": "$950"},
        {"description": "SSL Cert", "amount": "$500"}
      ]
    }
  }]
}
3. Finished Output .pdf
INVOICE
Bill To: Acme Corp
Invoice: INV-1001
Hosting$950
SSL Cert$500
Total: $1,450.00
api

REST API Reference

Base URL: https://api.everypapers.com

POST /v1/upload_template

Upload a DOCX template encoded in Base64 (max 20MB). EveryPapers validates the DOCX format, inspects and extracts all mergeFields and tables, uploads it securely to cloud storage, and returns a unique template_id for document generation.

Request Headers

x-api-key: ep_YOUR_API_KEY (required)
Content-Type: application/json

JSON Body Parameters

template_name string (required, max 100)

Human-readable name for identifying the template (e.g. "Tax Invoice 2026").

template_description string (optional, max 500)

Optional notes or version metadata describing this template.

content string (required, Base64)

Base64-encoded binary string of your valid .docx template file (up to 20MB).

curl --location 'https://api.everypapers.com/v1/upload_template' \
  --header 'x-api-key: ep_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "template_name": "Standard Invoice",
    "template_description": "Company tax invoice template",
    "content": "UEsDBBQABgAIAAAAIQDfp0..."
  }'
POST /v1/analyze_template

Analyze any template to inspect what variables and repeating tables it contains before generating documents. You can provide an existing template_id (form-data) OR upload a file directly via multipart/form-data.

Request Headers

x-api-key: ep_YOUR_API_KEY (required)
Content-Type: multipart/form-data

Form Parameters (Provide at least one)

template_id string (optional)

The ID of an already uploaded template (e.g. TMP_A1B2C3D4).

file file (optional)

A local DOCX template binary uploaded directly via multipart form data.

# Option A: Analyze by template_id
curl --location 'https://api.everypapers.com/v1/analyze_template' \
  --header 'x-api-key: ep_YOUR_API_KEY' \
  --form 'template_id="TMP_A1B2C3D4"'

# Option B: Analyze by uploading a local DOCX file
curl --location 'https://api.everypapers.com/v1/analyze_template' \
  --header 'x-api-key: ep_YOUR_API_KEY' \
  --form 'file=@"/path/to/invoice_template.docx"'
POST /v1/generate_document Core Engine Endpoint

Queue asynchronous document generation for 1 to 200 records. Produces pixel-accurate PDF or editable DOCX files. When generating a single record, you get a direct download URL. When generating 2+ records, EveryPapers automatically builds and optimizes a compressed ZIP archive containing all individual documents.

Request Headers

x-api-key: ep_YOUR_API_KEY (required)
Content-Type: application/json

JSON Body Parameters

template_id string (required)

The template ID created via upload or visible in your dashboard.

document_format string (optional, default: "docx")

Choose "pdf" for print-ready vector PDF or "docx" for editable Word files.

records array of objects (required, 1-200 items)

Array of data objects. Each record can contain:
• fileName: Custom output name (e.g. "Invoice_1001").
• fields: Key-value map for standard tags.
• tables: Map of array items for repeating table rows.

webhook_url string (optional)

Public HTTPS URL that receives a POST event when rendering completes.

email string (optional)

Sends an automated email notification with the secure download link upon completion.

curl --location 'https://api.everypapers.com/v1/generate_document' \
  --header 'x-api-key: ep_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "template_id": "TMP_A1B2C3D4",
    "document_format": "pdf",
    "webhook_url": "https://api.myapp.com/webhooks/everypapers",
    "email": "finance@client.com",
    "records": [
      {
        "fileName": "Invoice_Acme_March",
        "fields": {
          "customer_name": "Acme Global",
          "invoice_number": "INV-2026-001",
          "date": "2026-09-19",
          "total_amount": "$1,450.00"
        },
        "tables": {
          "items": [
            { "description": "Cloud Hosting", "qty": "1", "rate": "$950.00", "amount": "$950.00" },
            { "description": "SSL Certificate", "qty": "2", "rate": "$250.00", "amount": "$500.00" }
          ]
        }
      }
    ]
  }'
GET /v1/job_status

Check the real-time processing status of your document generation job. Once completed, this endpoint provides the secure signed download_url (valid for 1 hour).

Query Parameters

job_id string (required)

The 32-character job identifier returned by /v1/generate_document.

Possible Job Status Values

pending
Enqueued in Cloud Tasks
processing
Merging tags & converting
zipping
Bundling batch into ZIP
completed
Ready for download!
curl --location 'https://api.everypapers.com/v1/job_status?job_id=8f3d1b4a92c04e87901b2f4c3a5e8d91'
webhook

Webhooks Integration

Instead of polling /v1/job_status, pass a webhook_url in your generation request. When document rendering finishes, EveryPapers sends an instantaneous HTTPS POST callback.

Event: document.ready

The payload contains the complete job status, total record count, timestamp, and a signed download URL valid for 60 minutes.

check_circle
Single Document: Direct link to the generated .pdf or .docx with custom filename.
check_circle
Batch Generation: Direct link to the consolidated everypapers_{job_id}.zip bundle.
sync
Reliable Delivery: Backed by Google Cloud Tasks. If your endpoint returns a non-2xx code or times out, EveryPapers automatically retries delivery with exponential backoff.
Webhook POST Body application/json
{
  "event": "document.ready",
  "job_id": "8f3d1b4a92c04e87901b2f4c3a5e8d91",
  "status": "completed",
  "download_url": "https://storage.googleapis.com/docgen-api-94fbd.firebasestorage.app/generated/everypapers_8f3d1b4a92c04e87901b2f4c3a5e8d91.zip?X-Goog-Algorithm=...",
  "total_records": 10,
  "completed_records": 10,
  "document_format": "pdf",
  "completed_at": "2026-09-19T09:30:05.123456+00:00"
}

Example Webhook Handlers

Node.js (Express)
app.post('/webhooks/everypapers', (req, res) => {
  const { event, job_id, status, download_url } = req.body;

  if (event === 'document.ready' && status === 'completed') {
    console.log(`Job ${job_id} ready at: ${download_url}`);
    // Save to database or forward to client
  }

  // Return 200 to acknowledge receipt
  res.status(200).send('OK');
});
Python (Flask)
@app.route('/webhooks/everypapers', methods=['POST'])
def handle_webhook():
    payload = request.get_json()
    
    if payload.get('event') == 'document.ready':
        download_url = payload.get('download_url')
        print(f"Document ready: {download_url}")
        # Process file or update database
        
    return 'OK', 200
report_problem

Error Handling & Status Codes

EveryPapers uses standard HTTP response codes and returns descriptive error envelopes in the format: {"error": "message"}.

Status Code Error Response Example Root Cause & Resolution
200 / 201 {"status": "accepted", ...} Request was successful and generation is queued or completed.
400 Bad Request "template_id is required."
"Max 200 records allowed for pdf"
Request body validation failed or batch limit was exceeded. Verify your JSON structure.
401 Unauthorized "API key missing"
"Invalid API key"
"API key disabled"
Verify the x-api-key header. Check if the key was disabled in your dashboard.
401 Quota Exceeded "Daily quota exceeded"
"Total quota exceeded"
You reached your 1,000 document daily quota. Upgrade your plan or wait for the UTC midnight reset.
404 Not Found "Template not found."
"Job not found"
The provided template_id does not exist for your account or the job_id is incorrect.
500 Server Error {"error": "..."} Internal generation error. Contact EveryPapers support or retry the request.

tips_and_updates Common Integration Mistakes & Solutions

cancel Table Key Mismatch

Putting {{item.name}} in Word, but naming the JSON object tables: {"items": [...]}.

Fix: Ensure the word before the dot exactly matches your JSON key: {{items.name}}.

cancel Malformed Base64 DOCX

Passing data URLs like data:application/...;base64, in /v1/upload_template.

Fix: Strip any data URI prefix and send only the pure Base64 string.

cancel Expired Download URLs

Storing the signed Google Storage download URL in your database for weeks.

Fix: Signed URLs expire after 1 hour. Download the file into your own S3/GCS bucket or local storage right after receiving it.