# Publish Template

`POST https://api.inboxjot.com/v1/templates/{template_id}/publish`

Makes the draft the version that API and automation sends use. Returns 409 when the draft matches the published version. Needs a Full key. A key limited to one domain answers 403. Send an optional `Idempotency-Key` header to retry safely. See Idempotency.

## Path Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `template_id` | string | Yes | The template id. |

## Response

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | No | The template id. |
| `name` | string | No | The template name. |
| `from` | string | No | The default from address. |
| `reply_to` | string \| null | No | The default reply-to address. |
| `subject` | string | No | The subject. |
| `preheader` | string | No | The preview text. |
| `html` | string | No | The rendered HTML. |
| `text` | string | No | The plain text version. |
| `published_version_id` | string \| null | No | The version that sends use. `null` until the first publish, and sends fail until then. |
| `has_unpublished_changes` | boolean | No | Whether the draft differs from the version that sends use. |
| `created_at` | string | No | When it was created. |
| `updated_at` | string | No | When it last changed. |

## Request

cURL:

```bash
curl -X POST https://api.inboxjot.com/v1/templates/tpl_06d2mfk8r5cx3nd8vt1qa/publish \
  -H "Authorization: Bearer $INBOXJOT_API_KEY"
```

## Responses

| Status | Description |
| --- | --- |
| 200 | Published the draft. New sends use it. |
| 400 | A parameter is missing or invalid, or the Idempotency-Key header is not valid. |
| 401 | The API key is missing, revoked or expired. |
| 403 | The key is a Sending key or is limited to one domain, or the request comes from outside its IP allowlist. |
| 404 | The template does not exist in this workspace. |
| 409 | The draft matches the published version. |
| 422 | The Idempotency-Key was already used with a different request. |
| 429 | Too many requests for this key. Wait for the seconds in the Retry-After header. |
| 500 | Something failed on our side. Retry later. |

200:

```json
{
  "id": "tpl_06d2mfk8r5cx3nd8vt1qa",
  "name": "Welcome",
  "from": "Acme <hello@acme.dev>",
  "reply_to": null,
  "subject": "Welcome to Acme, {{first_name}}",
  "preheader": "Here is how to get started",
  "html": "<!DOCTYPE html><html>…</html>",
  "text": "Hi Suhasinee, welcome to Acme…",
  "published_version_id": "ver_06d2mfk8r5cx3nd8vt1qb",
  "has_unpublished_changes": false,
  "created_at": "2026-10-21T09:00:00.000Z",
  "updated_at": "2026-10-21T09:00:00.000Z"
}
```

400:

```json
{
  "name": "invalid_idempotency_key",
  "status": 400,
  "message": "Idempotency-Key must be 1 to 256 printable ASCII characters",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

401:

```json
{
  "name": "unauthorized",
  "status": 401,
  "message": "Unauthorized",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

403:

```json
{
  "name": "forbidden",
  "status": 403,
  "message": "This key cannot be used from 203.0.113.7",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

404:

```json
{
  "name": "not_found",
  "status": 404,
  "message": "Template not found",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

409:

```json
{
  "name": "conflict",
  "status": 409,
  "message": "There are no changes to publish",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

422:

```json
{
  "name": "invalid_idempotent_request",
  "status": 422,
  "message": "This idempotency key was already used with a different request",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

429:

```json
{
  "name": "rate_limit_exceeded",
  "status": 429,
  "message": "Too many attempts. Try again later.",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

500:

```json
{
  "name": "unknown_error",
  "status": 500,
  "message": "Something went wrong. Please try again later.",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```
