---
title: Hosted templates API | SendHQ Docs
description: Draft, render, test, version, publish, and send reusable content.
canonical: https://sendhq.cc/docs/api-reference/templates
last-updated: 2026-09-07
---
# Hosted templates

Draft, render, test, version, publish, and send reusable content.

GET `/templates`

API key

## List hosted templates

List hosted templates

**Query parameters** `lifecycle` `query`

```shell
curl https://sendhq.cc/api/v1/templates \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
```

```json
{
  "data": [],
  "count": 0
}
```

POST `/templates`

API key

## Create a hosted template

Create a hosted template

```shell
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"}'
```

```json
{
  "template": {
    "id": "tmpl_…",
    "key": "account-welcome"
  }
}
```

GET `/templates/:id`

API key

## Retrieve drafts, releases, and usage

Retrieve drafts, releases, and usage

```shell
curl https://sendhq.cc/api/v1/templates/id_value \
  -X GET \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
```

```json
{
  "template": {
    "id": "tmpl_…"
  },
  "versions": [],
  "draft": null,
  "activeVersion": null,
  "usage": []
}
```

PUT `/templates/:id/draft`

API key

## Autosave a template draft

Autosave a template draft

```shell
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"}}'
```

```json
{
  "draft": {
    "id": "tmplv_…",
    "revision": 2
  }
}
```

POST `/templates/:id/draft`

API key

## Create a new draft from the published release

Create a new draft from the published release

```shell
curl https://sendhq.cc/api/v1/templates/id_value/draft \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
```

```json
{
  "draft": {
    "id": "tmplv_…",
    "revision": 1
  }
}
```

POST `/templates/:id/render`

API key

## Render exact server output

Render exact server output

```shell
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"}}'
```

```json
{
  "subject": "Welcome, Asha",
  "html": "<h1>Welcome, Asha</h1>",
  "text": "Welcome, Asha",
  "findings": []
}
```

POST `/templates/:id/test`

API key

## Send a test snapshot

Send a test snapshot

```shell
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"}}'
```

```json
{
  "id": "em_…",
  "isTest": true
}
```

POST `/templates/:id/publish`

API key

## Publish an immutable template release

Publish an immutable template release

```shell
curl https://sendhq.cc/api/v1/templates/id_value/publish \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
```

```json
{
  "version": {
    "id": "tmplv_…",
    "state": "published"
  }
}
```

POST `/templates/:id/archive`

API key

## Archive a template

Archive a template

```shell
curl https://sendhq.cc/api/v1/templates/id_value/archive \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
```

```json
{
  "template": {
    "id": "tmpl_…",
    "lifecycle": "archived"
  }
}
```

POST `/templates/:id/restore`

API key

## Restore an archived template

Restore an archived template

```shell
curl https://sendhq.cc/api/v1/templates/id_value/restore \
  -X POST \
  -H "Authorization: Bearer $SENDHQ_API_KEY"
```

```json
{
  "template": {
    "id": "tmpl_…",
    "lifecycle": "active"
  }
}
```
