Templated

Quickstart

Make your first API call to Templated in under 5 minutes.

Quickstart

Get up and running with the Templated API. By the end of this guide, you'll have created an API key, fetched your templates, and generated one with AI.

Prerequisites

Step 1: Create an API key

In the app, go to Integrations → API Keys → Create API key. Copy the key when it's shown — this is the only time you'll see it.

Export it for the rest of this guide:

export TEMPLATED_KEY="tmpl_sk_your_key_here"

Your key belongs to one account. Find the account's slug in the app URL, or under Settings → Account.

Step 2: List templates

curl https://app.templated.email/api/accounts/my-company/templates \
  -H "Authorization: Bearer $TEMPLATED_KEY"

Response:

{
  "templates": [
    {
      "id": "0d9f1b2a-3c4d-4e5f-8a6b-7c8d9e0f1a2b",
      "name": "Welcome Email",
      "status": "draft",
      "createdAt": "2026-07-01T12:00:00.000Z",
      "updatedAt": "2026-07-14T12:00:00.000Z"
    }
  ]
}

Step 3: Create a template

curl -X POST https://app.templated.email/api/accounts/my-company/templates \
  -H "Authorization: Bearer $TEMPLATED_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My First Template",
    "editorMode": "html",
    "htmlContent": "<h1>Hello World</h1><p>This is my template.</p>"
  }'

Step 4: Generate with AI

curl -X POST https://app.templated.email/api/accounts/my-company/ai/generate \
  -H "Authorization: Bearer $TEMPLATED_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Create a welcome email for a SaaS product launch"
  }'

The AI generates a complete, styled email based on your prompt and brand kit. The response's result.craftState is a block document (reference) you can save via the create endpoint with source: "ai".

Browser sessions

Calling the API from the Templated web app itself? Session cookies work for every endpoint — see Authentication.

Next steps

On this page