API v1currentBase URLhttps://api.sendlib.com/v1Bearer API key

API

Templates

Store reusable subjects and bodies, then reference them in transmissions.

Templates store subjects and bodies once, so your services send a template id and a few variables instead of whole HTML documents. Reference one when sending by setting content.template_id.

Create template

POST/v1/templates

Creates a stored template that can be referenced by content.template_id in transmissions.

Scope
send:transmissions

At least one of html or text must be provided.

Body

  • namestringRequired

    Unique template name.

  • subjectstringRequired

    Subject template.

  • htmlstringOne of

    HTML content.

  • textstringOne of

    Text content.

Returns

  • idstring

    Template id (UUID).

  • namestring

    Template name.

  • subjectstring

    Subject template.

  • htmlstring

    HTML content.

  • textstring

    Text content.

  • created_atstring

    ISO timestamp.

  • updated_atstring

    ISO timestamp.

curl -X POST "https://api.sendlib.com/v1/templates" \
  -H "Authorization: Bearer $SENDLIB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome Email",
    "subject": "Welcome, {{.first_name}}",
    "html": "<h1>Hi {{.first_name}}</h1>",
    "text": "Hi {{.first_name}}"
  }'
{
  "id": "…",
  "name": "…",
  "subject": "…",
  "html": "…",
  "text": "…",
  "created_at": "…",
  "updated_at": "…"
}

List templates

GET/v1/templates

Returns templates owned by the authenticated tenant.

Scope
send:transmissions
curl "https://api.sendlib.com/v1/templates" \
  -H "Authorization: Bearer $SENDLIB_API_KEY"
{
  "error": {
    "message": "Missing or invalid API key."
  }
}

Get template

GET/v1/templates/{id}

Fetch a single template.

Scope
send:transmissions

Path parameters

  • idstringRequired

    Template id.

curl "https://api.sendlib.com/v1/templates/TEMPLATE_ID" \
  -H "Authorization: Bearer $SENDLIB_API_KEY"
{
  "error": {
    "message": "Missing or invalid API key."
  }
}

Update template

PATCH/v1/templates/{id}

Updates template fields (partial update).

Scope
send:transmissions

Path parameters

  • idstringRequired

    Template id.

curl -X PATCH "https://api.sendlib.com/v1/templates/TEMPLATE_ID" \
  -H "Authorization: Bearer $SENDLIB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"subject": "Updated subject"}'
{
  "error": {
    "message": "The request body is not valid JSON or is missing a required field."
  }
}

Delete template

DELETE/v1/templates/{id}

Deletes a stored template.

Scope
send:transmissions

Path parameters

  • idstringRequired

    Template id.

curl -X DELETE "https://api.sendlib.com/v1/templates/TEMPLATE_ID" \
  -H "Authorization: Bearer $SENDLIB_API_KEY"
{
  "error": {
    "message": "Missing or invalid API key."
  }
}

Use a template in a transmission

JSON
{
  "recipients": [{"email": "user@example.com"}],
  "content": {
    "template_id": "TEMPLATE_ID",
    "substitution_data": {"first_name": "Ada"}
  }
}

Next