> ## Documentation Index
> Fetch the complete documentation index at: https://developers.kit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a snippet

> 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).



## OpenAPI

````yaml /api-reference/v4.json post /v4/snippets
openapi: 3.0.3
info:
  title: Kit API
  version: '4.0'
servers:
  - url: https://api.kit.com
security: []
paths:
  /v4/snippets:
    post:
      tags:
        - Snippets
      summary: Create a snippet
      description: >-
        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).
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - title: Inline snippet
                  type: object
                  properties:
                    name:
                      type: string
                      description: Name of the snippet
                    snippet_type:
                      type: string
                      enum:
                        - inline
                      description: Must be 'inline'
                    content:
                      type: string
                      description: Liquid-enabled text content for the snippet
                  required:
                    - name
                    - snippet_type
                    - content
                - title: Block snippet
                  type: object
                  properties:
                    name:
                      type: string
                      description: Name of the snippet
                    snippet_type:
                      type: string
                      enum:
                        - block
                      description: Must be 'block'
                    document_attributes:
                      type: object
                      description: Rich-text document for the snippet
                      properties:
                        value_html:
                          type: string
                          description: HTML content for the block snippet
                      required:
                        - value_html
                  required:
                    - name
                    - snippet_type
                    - document_attributes
            example:
              name: Cat Fact of the Day
              snippet_type: inline
              content: >-
                Did you know, {{ subscriber.first_name }}? Cats can rotate their
                ears 180 degrees.
      responses:
        '201':
          description: Creates a new snippet
          content:
            application/json:
              schema:
                type: object
                properties:
                  snippet:
                    type: object
                    properties:
                      id:
                        type: integer
                      name:
                        type: string
                      snippet_type:
                        type: string
                      archived:
                        type: boolean
                      key:
                        type: string
                      created_at:
                        type: string
                      updated_at:
                        type: string
                      content:
                        type: string
                      document:
                        type: object
                        properties:
                          id:
                            type: integer
                          value:
                            nullable: true
                          value_html:
                            nullable: true
                          value_plain:
                            nullable: true
                          version:
                            type: integer
                        required:
                          - id
                          - value
                          - value_html
                          - value_plain
                          - version
                    required:
                      - id
                      - name
                      - snippet_type
                      - archived
                      - key
                      - created_at
                      - updated_at
                      - content
                      - document
                required:
                  - snippet
              example:
                snippet:
                  id: 31
                  name: Cat Fact of the Day
                  snippet_type: inline
                  archived: false
                  key: cat-fact-of-the-day
                  created_at: '2026-05-08T14:40:47Z'
                  updated_at: '2026-05-08T14:40:47Z'
                  content: >-
                    Did you know, {{ subscriber.first_name }}? Cats can rotate
                    their ears 180 degrees.
                  document:
                    id: 119
                    value: null
                    value_html: null
                    value_plain: null
                    version: 1
        '401':
          description: Returns a 401 if the token and/or account cannot be authenticated
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: string
                required:
                  - errors
              example:
                errors:
                  - The access token is invalid
        '422':
          description: >-
            Returns a 422 with an error message when one or more of the
            parameters were invalid
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: string
                required:
                  - errors
              example:
                errors:
                  - name can't be blank
      security:
        - API Key: []
        - OAuth2: []
components:
  securitySchemes:
    API Key:
      description: Authenticate API requests via an API Key
      type: apiKey
      in: header
      name: X-Kit-Api-Key
    OAuth2:
      description: Authenticate API requests via an OAuth token
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://api.kit.com/v4/oauth/authorize
          tokenUrl: https://api.kit.com/v4/oauth/token
          refreshUrl: https://api.kit.com/v4/oauth/token
          scopes:
            read: Read access to Kit API v4
            write: Write access to Kit API v4

````