---
title: "Create a snippet"
method: POST
path: "/v4/snippets"
tags: ["Snippets"]
---

# Create a snippet

`POST /v4/snippets`

Snippets are reusable pieces of email content you can drop into a broadcast or sequence email using Liquid: `{{ snippet.key }}`. Update the snippet once and every email that references it picks up the new content on next send.

There are two `snippet_type`s. **`inline`** snippets store plain-text content (with Liquid variable support like `{{ subscriber.first_name }}`) in the `content` field. **`block`** snippets store rich-text HTML — text, lists, images, buttons — in `document_attributes.value_html`. A snippet's type is fixed at creation: it cannot be changed via [Update a snippet](/api-reference/snippets/update-a-snippet).

The response includes a `key` field. That's the identifier you use in Liquid — for example, a snippet returned with `"key": "welcome-message"` is referenced inside a broadcast as `{{ snippet.welcome-message }}`. Keys are derived from the snippet name on creation.

**Note:** the API rejects circular references — a snippet cannot reference itself, directly or transitively — with a `422` validation error.

For end-user context on how creators build and edit snippets in the Kit UI, see the help articles on [content snippets](https://help.kit.com/en/articles/3812712-creating-and-using-content-snippets-in-your-kit-emails) and [code snippets for custom templates](https://help.kit.com/en/articles/2810398-code-snippets-for-custom-email-templates).

## Request body

- union
  - object
    - `name` string, required — Name of the snippet
    - `snippet_type` 'inline', required — Must be 'inline'
    - `content` string, required — Liquid-enabled text content for the snippet
  - object
    - `name` string, required — Name of the snippet
    - `snippet_type` 'block', required — Must be 'block'
    - `document_attributes` object, required — Rich-text document for the snippet
      - `value_html` string, required — HTML content for the block snippet

## Response `201`

Creates a new snippet

- object
  - `snippet` object, required
    - `id` integer, required
    - `name` string, required
    - `snippet_type` string, required
    - `archived` boolean, required
    - `key` string, required
    - `created_at` string, required
    - `updated_at` string, required
    - `content` string, required
    - `document` object, required
      - `id` integer, required
      - `value` unknown, required
      - `value_html` unknown, required
      - `value_plain` unknown, required
      - `version` integer, required

## Other responses

- `401` — Returns a 401 if the token and/or account cannot be authenticated
- `422` — Returns a 422 with an error message when one or more of the parameters were invalid

---

[API](https://skmtc.net/kit/apis/kit-api.md) · [All operations](https://skmtc.net/kit/apis/kit-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/kit/kit-api/revisions/0df0c90d12da/schema)
