ComposeIt LogoComposeIt

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 NameDescription
x-api-keyYour 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

FieldTypeRequiredDescription
templateIdStringYesThe UUID of the template you wish to render.
templateVersionNumberNoA specific version number to render. Defaults to the active template version.
formatsArrayYesOutput formats to compile. Allowed values: ["pdf", "html", "image", "mjml"].
dataObjectNoKey-value pairs containing variables referenced inside your template.
expiresAtStringNoISO 8601 timestamp or Date indicating when generated download links expire. (Default: 24 hours).
imageTypeStringNoOutput format of compiled images: "png" or "jpg". (Default: "png").
isTestBooleanNoIf true, compiles document with a watermark without counting against usage limits.
sendForSignatureBooleanNoSet to true to initiate a DocuSeal e-signature request using the compiled PDF.
docusealConnectionStringNoSpecific DocuSeal Connection ID to use for the signature request.
docusealSettingsObjectNoConfiguration object for DocuSeal submitters, expiration, and messages (see below).

docusealSettings Schema

FieldTypeDescription
submittersArrayArray of recipient/signer objects to receive the document for signing.
expiresAtString / DateExpiration timestamp for the e-signature request.
messageObjectCustom email details sent to submitters/signers.

docusealSettings.submitters Object Schema

FieldTypeRequiredDescription
roleStringYesThe role name assigned to the signer in the template (e.g., "Client", "First Party").
emailStringYesEmail address of the recipient.
nameStringNoFull name of the recipient.
valuesObjectNoPre-filled field values for this specific submitter (key-value map).
orderNumberNoSigning order sequence number for sequential signatures (e.g., 1, 2).

docusealSettings.message Object Schema

FieldTypeDescription
subjectStringCustom email subject line.
bodyStringCustom 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 missing x-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"
}
We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our privacy policy.