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

# Update a snippet

> Rename a snippet, replace its body, or archive/restore it. Updates apply on the next send of any email that references the snippet via `{{ snippet.key }}` — there's no per-email versioning, so a content change ripples to every broadcast or sequence email using that key.

The request body must match the existing `snippet_type`. For an **`inline`** snippet, send `content` (and optionally `name`, `archived`). For a **`block`** snippet, send `document_attributes.value_html` (and optionally `name`, `archived`). Pass `archived: true` to archive, `false` to restore.

**Warning:** `snippet_type` is immutable. Sending a different value, or sending the body shape for the wrong type, returns a `422` with `snippet_type cannot be changed`.

See [Create a snippet](/api-reference/snippets/create-a-snippet) for the full snippet model and how `key` ties into Liquid.



## OpenAPI

````yaml /api-reference/v4.json put /v4/snippets/{id}
openapi: 3.0.3
info:
  title: Kit API
  version: '4.0'
servers:
  - url: https://api.kit.com
security: []
paths:
  /v4/snippets/{id}:
    put:
      tags:
        - Snippets
      summary: Update a snippet
      description: >-
        Rename a snippet, replace its body, or archive/restore it. Updates apply
        on the next send of any email that references the snippet via `{{
        snippet.key }}` — there's no per-email versioning, so a content change
        ripples to every broadcast or sequence email using that key.


        The request body must match the existing `snippet_type`. For an
        **`inline`** snippet, send `content` (and optionally `name`,
        `archived`). For a **`block`** snippet, send
        `document_attributes.value_html` (and optionally `name`, `archived`).
        Pass `archived: true` to archive, `false` to restore.


        **Warning:** `snippet_type` is immutable. Sending a different value, or
        sending the body shape for the wrong type, returns a `422` with
        `snippet_type cannot be changed`.


        See [Create a snippet](/api-reference/snippets/create-a-snippet) for the
        full snippet model and how `key` ties into Liquid.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          example: 58
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - title: Inline snippet
                  type: object
                  properties:
                    name:
                      type: string
                      description: New name for the snippet
                    snippet_type:
                      type: string
                      description: >-
                        Cannot be changed — must match the existing type if
                        provided
                    archived:
                      type: boolean
                      description: Pass `true` to archive or `false` to restore the snippet
                    content:
                      type: string
                      description: New Liquid-enabled text content
                - title: Block snippet
                  type: object
                  properties:
                    name:
                      type: string
                      description: New name for the snippet
                    snippet_type:
                      type: string
                      description: >-
                        Cannot be changed — must match the existing type if
                        provided
                    archived:
                      type: boolean
                      description: Pass `true` to archive or `false` to restore the snippet
                    document_attributes:
                      type: object
                      description: Updated rich-text document
                      properties:
                        value_html:
                          type: string
                          description: New HTML content for the block snippet
                      required:
                        - value_html
            example:
              name: Dog Fact of the Day
      responses:
        '200':
          description: Updates the snippet and returns its details
          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:
                            type: string
                          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: 57
                  name: Dog Fact of the Day
                  snippet_type: inline
                  archived: false
                  key: welcome-message
                  created_at: '2023-02-17T11:43:55Z'
                  updated_at: '2026-05-08T14:40:52Z'
                  content: Hello {{ subscriber.first_name }}
                  document:
                    id: 145
                    value: null
                    value_html: content
                    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
        '404':
          description: Returns a 404 when the provided id does not exist
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: string
                required:
                  - errors
              example:
                errors:
                  - Not Found
        '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:
                  - snippet_type cannot be changed
      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

````