Quickstart

This guide walks you through your first render in about five minutes.

1. Create an API key

  1. Log in to the CommsPliant admin app.
  2. Open API keys and create a new key.
  3. Copy the secret — it starts with ck_ and is shown only once.

2. Find your template ID

List templates with your API key on the admin API:

bash
curl -sS 'https://adminapi.commspliant.com/api/v1/templates' \
  -H 'X-Api-Key: ck_YOUR_API_KEY'

Use the id field from a template as templateId. Do not use a version UUID here.

3. Render HTML

bash
curl -sS -X POST 'https://api.commspliant.com/api/v1/render/html' \
  -H 'X-Api-Key: ck_YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "templateId": "550e8400-e29b-41d4-a716-446655440000",
    "variables": {
      "title": "Hello",
      "user": { "name": "Jane Doe" }
    }
  }' \
  --output document.html

The response body is the rendered HTML. Save it to a file as shown above.

4. Render PDF (optional)

bash
curl -sS -X POST 'https://api.commspliant.com/api/v1/render/pdf' \
  -H 'X-Api-Key: ck_YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "templateId": "550e8400-e29b-41d4-a716-446655440000",
    "variables": { "title": "Invoice", "amount": "99.00" }
  }' \
  --output document.pdf

Common mistakes

  • Using a version UUID in templateId → returns 404 template not found.
  • Rendering a template that is not approved → returns 422.
  • Sending a JWT instead of an API key on api.commspliant.com → returns 403.

Next: read Authentication and the API reference.