API-Referenz

Gehostete Templates

Wiederverwendbare Inhalte entwerfen, rendern, testen, versionieren, veröffentlichen und senden.

GET/templates
API-Schlüssel

Gehostete Templates auflisten

Gehostete Templates auflisten

Query-Parameterlifecyclequery
Anfrage
curl https://sendhq.cc/api/v1/templates \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
Antwort 200
{
  "data": [],
  "count": 0
}
POST/templates
API-Schlüssel

Gehostetes Template anlegen

Gehostetes Template anlegen

Anfrage
curl https://sendhq.cc/api/v1/templates \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Account welcome","key":"account-welcome","starter":"welcome"}'
Antwort 201
{
  "template": {
    "id": "tmpl_…",
    "key": "account-welcome"
  }
}
GET/templates/:id
API-Schlüssel

Entwürfe, Releases und Nutzung abrufen

Entwürfe, Releases und Nutzung abrufen

Anfrage
curl https://sendhq.cc/api/v1/templates/id_value \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
Antwort 200
{
  "template": {
    "id": "tmpl_…"
  },
  "versions": [],
  "draft": null,
  "activeVersion": null,
  "usage": []
}
PUT/templates/:id/draft
API-Schlüssel

Template-Entwurf automatisch speichern

Template-Entwurf automatisch speichern

Anfrage
curl https://sendhq.cc/api/v1/templates/id_value/draft \
  -X PUT \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"revision":1,"name":"Account welcome","subjectTemplate":"Welcome, {{first_name}}","htmlTemplate":"<h1>Welcome, {{first_name}}</h1>","textTemplate":"Welcome, {{first_name}}","variables":[{"key":"first_name","type":"string","required":true}],"sampleData":{"first_name":"Asha"}}'
Antwort 200
{
  "draft": {
    "id": "tmplv_…",
    "revision": 2
  }
}
POST/templates/:id/draft
API-Schlüssel

Neuen Entwurf aus dem veröffentlichten Release erstellen

Neuen Entwurf aus dem veröffentlichten Release erstellen

Anfrage
curl https://sendhq.cc/api/v1/templates/id_value/draft \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
Antwort 201
{
  "draft": {
    "id": "tmplv_…",
    "revision": 1
  }
}
POST/templates/:id/render
API-Schlüssel

Exakte Server-Ausgabe rendern

Exakte Server-Ausgabe rendern

Anfrage
curl https://sendhq.cc/api/v1/templates/id_value/render \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data":{"first_name":"Asha"}}'
Antwort 200
{
  "subject": "Welcome, Asha",
  "html": "<h1>Welcome, Asha</h1>",
  "text": "Welcome, Asha",
  "findings": []
}
POST/templates/:id/test
API-Schlüssel

Test-Snapshot senden

Test-Snapshot senden

Anfrage
curl https://sendhq.cc/api/v1/templates/id_value/test \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":["owner@example.com"],"from":"hello@example.com","data":{"first_name":"Asha"}}'
Antwort 201
{
  "id": "em_…",
  "isTest": true
}
POST/templates/:id/publish
API-Schlüssel

Unveränderliches Template-Release veröffentlichen

Unveränderliches Template-Release veröffentlichen

Anfrage
curl https://sendhq.cc/api/v1/templates/id_value/publish \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
Antwort 201
{
  "version": {
    "id": "tmplv_…",
    "state": "published"
  }
}
POST/templates/:id/archive
API-Schlüssel

Template archivieren

Template archivieren

Anfrage
curl https://sendhq.cc/api/v1/templates/id_value/archive \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
Antwort 200
{
  "template": {
    "id": "tmpl_…",
    "lifecycle": "archived"
  }
}
POST/templates/:id/restore
API-Schlüssel

Archiviertes Template wiederherstellen

Archiviertes Template wiederherstellen

Anfrage
curl https://sendhq.cc/api/v1/templates/id_value/restore \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
Antwort 200
{
  "template": {
    "id": "tmpl_…",
    "lifecycle": "active"
  }
}