API Reference
Data Publisher API v2.0
Complete document automation platform with 123 endpoints across 23 namespaces. Build custom integrations with our three-layer architecture: Data → Document Engine → Distribution.
Base URLs
https://app.datapublisher.io/api
http://localhost:3001/api
Complete API Documentation
For comprehensive guides, code examples, and detailed endpoint documentation, visit:
View Full DocumentationAuthentication
The Data Publisher API uses JWT (JSON Web Token) authentication with email-gated registration codes.
Registration Flow
New users register through a two-step verification process:
Step 1: Request Registration Code
POST https://app.datapublisher.io/api/auth/request-code
Content-Type: application/json
{
"email": "user@example.com"
}
A 6-digit code is sent to the email address.
Step 2: Register with Code
POST https://app.datapublisher.io/api/auth/register
Content-Type: application/json
{
"email": "user@example.com",
"code": "123456",
"firstName": "John",
"lastName": "Doe"
}
JWT Authentication
After registration or login, include the JWT token in all API requests:
HTTP Header
Authorization: Bearer YOUR_JWT_TOKEN
Tokens expire after 7 days. Refresh via POST /api/auth/login
Complete Authentication Guide
For detailed authentication flows, error codes, and examples, see: Authentication Documentation
Security Note
Keep your JWT token secure and never expose it in client-side code. Store tokens in secure, HTTP-only cookies or encrypted storage.
Rate Limiting
API requests are rate limited per 15-minute window to ensure fair usage and system stability:
| Endpoint Category | Requests per 15 Minutes | Description |
|---|---|---|
| General API | 1,000 | Most endpoints |
| Authentication | 20 | Login, register, code requests |
| File Uploads | 50 | CSV, document, image uploads |
When rate limits are exceeded, the API returns 429 Too Many Requests with retry information.
Three-Layer Architecture
The Data Publisher API is organized into three distinct layers that map to real document automation workflows:
Layer 1: Data Layer
Connect data from any source and normalize it for document generation.
/csv- CSV file uploads/google- Google Sheets OAuth connector/microsoft- Excel Online connector/sql-server- SQL Server connector/data-sources- Unified source management/sync- Scheduled data synchronization/data-sets- Multi-table relationships
Layer 2: Document Engine
Transform templates and data into generated documents (DOCX, PDF, OOXML).
/documents- Document generation & management/word-templates- Template library & OOXML extraction/image-library- Image asset management/sample-library- Pre-built templates/domains- Vertical-specific data structures
Layer 3: Distribution Layer
Send documents via email campaigns with tracking, or export as packaged files.
/email-templates- HTML email templates/email-campaigns- Async campaign management/email/track- Open & click tracking/email/auth- Microsoft Graph OAuth/email-publishing-exports- ZIP exports
AI Layer (Orthogonal)
AI capabilities exposed as API endpoints — invokable at any workflow stage.
/claude-coop- Analyze campaigns & suggest improvements
API Overview
123 endpoints organized across 23 namespaces:
| Category | Namespaces | Documentation |
|---|---|---|
| Authentication | /auth, /users |
Auth Guide | Users |
| Data Layer | /csv, /google, /microsoft, /sql-server, /data-sources, /sync, /data-sets |
CSV | Google | Excel | SQL |
| Document Engine | /documents, /word-templates, /image-library, /sample-library, /domains |
Documents | Templates | Images |
| Distribution | /email-templates, /email-campaigns, /email/track, /email/auth, /email-publishing-exports |
Templates | Campaigns | Tracking |
| AI Layer | /claude-coop |
AI Documentation |
Complete Endpoint Reference
All 123 endpoints with request/response examples, error codes, and implementation guides:
View Complete API Quick ReferenceCode Examples
Quick examples to get started. For comprehensive code samples in JavaScript, Python, and cURL, see the documentation links above.
Example: Create Document from CSV
JavaScript / Node.js
const axios = require('axios');
const BASE_URL = 'https://app.datapublisher.io/api';
const token = 'your_jwt_token';
async function generateDocument() {
const response = await axios.post(`${BASE_URL}/documents/generate`, {
templateId: 'template_123',
csvId: 'csv_456',
format: 'pdf'
}, {
headers: { 'Authorization': `Bearer ${token}` }
});
console.log('Document generated:', response.data);
return response.data;
}
Python
import requests
BASE_URL = 'https://app.datapublisher.io/api'
token = 'your_jwt_token'
def generate_document():
headers = {'Authorization': f'Bearer {token}'}
data = {
'templateId': 'template_123',
'csvId': 'csv_456',
'format': 'pdf'
}
response = requests.post(
f'{BASE_URL}/documents/generate',
headers=headers,
json=data
)
result = response.json()
print(f"Document generated: {result}")
return result
More Examples
Each documentation file includes comprehensive code examples in JavaScript, Python, and cURL:
Developer Resources
Complete Guide
Understand the three-layer architecture and build your first integration.
Read the Guide →Error Handling
The API uses conventional HTTP response codes to indicate success or failure:
HTTP Status Codes
| Code | Meaning | Description |
|---|---|---|
200 |
OK | Request successful |
201 |
Created | Resource created successfully |
400 |
Bad Request | Invalid request parameters |
401 |
Unauthorized | Invalid or missing API key |
403 |
Forbidden | Access denied |
404 |
Not Found | Resource not found |
429 |
Too Many Requests | Rate limit exceeded |
500 |
Internal Server Error | Server error |
Error Response Format
Error responses include details to help you understand and resolve the issue:
{
"error": {
"code": "INVALID_TEMPLATE",
"message": "The specified template was not found",
"details": {
"template_id": "template_999",
"suggestion": "Check that the template ID is correct and that you have access to it"
},
"request_id": "req_12345",
"timestamp": "2025-09-07T10:30:00Z"
}
}
Common Error Codes
INVALID_API_KEY- The API key is invalid or expiredRATE_LIMIT_EXCEEDED- Too many requests, slow downINVALID_TEMPLATE- Template not found or inaccessibleINVALID_DATA_SOURCE- Data source configuration is invalidPROCESSING_FAILED- Document generation failedINSUFFICIENT_CREDITS- Account has insufficient credits
Need Help with the API?
Our developer support team is here to help you integrate successfully: