DocuPotion API

Generate beautiful PDFs programmatically with our simple REST API

Getting Started

DocuPotion provides a simple REST API to generate PDFs from your templates. Follow these three steps to get started:

1

Create an account

You can sign up to create a DocuPotion account here.

2

Generate an API Key

Generate an API Key in the 'My Account' tab of your DocuPotion dashboard.

3

Design a template

Use our drag and drop editor to design your PDF. You can find the drag and drop editor here.

Authentication

All API requests must include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Security Best Practice

Never expose your API key in client-side code. Always make API calls from your backend server.

API Endpoints

POSThttps://api.docupotion.com/v1/create

Generate a PDF from a template with dynamic data. Returns the PDF as base64 encoded data.

Headers

HeaderValue
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

Request Format

Request Body

{
  "templateId": "your_template_id",
  "data": {
    // Your dynamic data here
    // Must match template variables
  }
}

Parameters

ParameterTypeRequiredDescription
templateIdstringRequiredYour PDF template ID
dataobjectRequiredDynamic data for the template

Response Format

Success Response (200 OK)

{
  "success": true,
  "base64": "JVBERi0xLjQK...."
}

Error Response

{
  "success": false,
  "error": "Not Found",
  "message": "Template not found: 8qzsaaoxdrmdtvzf"
}

Code Examples

const response = await fetch('https://api.docupotion.com/v1/create', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    templateId: 'your_template_id',
    data: {
      name: 'John Doe',
      invoice_number: 'INV-001',
      items: [
        { description: 'Product A', quantity: 2, price: 50.00 },
        { description: 'Product B', quantity: 1, price: 75.00 }
      ],
      total: 175.00
    }
  })
});

const result = await response.json();
console.log('PDF base64:', result.base64);

Error Handling

HTTP Status Codes

200

Success

PDF generated successfully

400

Bad Request

Invalid request parameters

401

Unauthorized

Invalid or missing API key

404

Not Found

Template ID not found

500

Internal Server Error

Server error - please retry