API Reference
Integrate ComposeIt document generation into your workflows.
Generate PDF, HTML, and image files programmatically by sending JSON data payloads to your activated templates using the ComposeIt REST API.
Authentication
All API requests must include your API key in the custom header:
| Header Name | Description |
|---|---|
x-api-key | Your private organization API key. Manage these in Dashboard > API Keys. |
[!CAUTION] Treat your API keys as passwords. Do not expose them in client-side code (e.g. browsers, mobile applications) or public source control repositories.
Render Document
Generate compiled documents by compiling a template definition with dynamic data.
- Endpoint:
POST /api/export - Content-Type:
application/json
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
templateId | String | Yes | The UUID of the template you wish to render. |
templateVersion | Number | No | A specific version number to render. Defaults to the active template version. |
formats | Array | Yes | Output formats to compile. Allowed values: ["pdf", "html", "image", "mjml"]. |
data | Object | No | Key-value pairs containing variables referenced inside your template. |
expiresAt | String | No | ISO 8601 timestamp or Date indicating when generated download links expire. (Default: 24 hours). |
imageType | String | No | Output format of compiled images: "png" or "jpg". (Default: "png"). |
isTest | Boolean | No | If true, compiles document with a watermark without counting against usage limits. |
sendForSignature | Boolean | No | Set to true to initiate a DocuSeal e-signature request using the compiled PDF. |
docusealConnection | String | No | Specific DocuSeal Connection ID to use for the signature request. |
docusealSettings | Object | No | Configuration object for DocuSeal submitters, expiration, and messages (see below). |
docusealSettings Schema
| Field | Type | Description |
|---|---|---|
submitters | Array | Array of recipient/signer objects to receive the document for signing. |
expiresAt | String / Date | Expiration timestamp for the e-signature request. |
message | Object | Custom email details sent to submitters/signers. |
docusealSettings.submitters Object Schema
| Field | Type | Required | Description |
|---|---|---|---|
role | String | Yes | The role name assigned to the signer in the template (e.g., "Client", "First Party"). |
email | String | Yes | Email address of the recipient. |
name | String | No | Full name of the recipient. |
values | Object | No | Pre-filled field values for this specific submitter (key-value map). |
order | Number | No | Signing order sequence number for sequential signatures (e.g., 1, 2). |
docusealSettings.message Object Schema
| Field | Type | Description |
|---|---|---|
subject | String | Custom email subject line. |
body | String | Custom body message/instructions for signers. |
Request Example
curl -X POST https://app.composeit.app/api/export \
-H "Content-Type: application/json" \
-H "x-api-key: your_live_api_key_here" \
-d '{
"templateId": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"formats": ["pdf", "html"],
"isTest": false,
"data": {
"number": "INV-10024",
"date": "2026-06-26",
"due_data": "2026-07-26",
"bill_to": {
"name": "Acme Corporation",
"address": "123 Industrial Parkway, Suite A"
},
"products": [
{
"name": "Premium Plan Subscription",
"quantity": 1,
"unit_price": 99.00,
"total": 99.00
},
{
"name": "Setup & Configuration Service",
"quantity": 2,
"unit_price": 50.00,
"total": 100.00
}
],
"sub_total": 199.00,
"tax": 19.90,
"grand_total": 218.90,
"notes": "Thank you for partnering with ComposeIt!"
}
}'Request Example (Send for Signature)
curl -X POST [https://app.composeit.app/api/export](https://app.composeit.app/api/export) \
-H "Content-Type: application/json" \
-H "x-api-key: your_live_api_key_here" \
-d '{
"templateId": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"formats": ["pdf"],
"sendForSignature": true,
"docusealConnection": "conn_123456789",
"docusealSettings": {
"submitters": [
{
"role": "Client",
"email": "john.doe@example.com",
"name": "John Doe",
"order": 1,
"values": {
"company_name": "Acme Corp"
}
},
{
"role": "Approver",
"email": "jane.smith@example.com",
"name": "Jane Smith",
"order": 2
}
],
"expiresAt": "2026-09-01T00:00:00.000Z",
"message": {
"subject": "Action Required: Sign Rental Agreement",
"body": "Please review and sign the attached rental agreement document."
}
},
"data": {
"agreement_date": "2026-08-20",
"monthly_rent": 1200
}
}'Response Format
Returns a JSON object mapping each requested format to its compilation result:
{
"pdf": {
"url": "https://storage.composeit.website/outputs/9b1deb4d-pdf-output.pdf",
"sizeBytes": 204550,
"mimeType": "application/pdf",
"checksum": "d3b07384d113edec49eaa6238ad5ff00"
},
"html": {
"htmlDocument": "<!DOCTYPE html><html><head><style>...</style></head><body>...</body></html>",
"checksum": "3b07384d113edec49eaa6238ad5ff001",
"mimeType": "text/html",
"url": "",
"sizeBytes": 14205
}
}Error Handling
API responses return appropriate HTTP status codes along with an error message:
400 Bad Request: Missing headers, invalid JSON payload, or unsupported format configuration.401 Unauthorized: Invalid or missingx-api-key.404 Not Found: The requested template ID does not exist.500 Internal Server Error: An unexpected server-side rendering error occurred.
Example Error Payload
{
"error": "Not found"
}