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

# Update a snippet

Updates an existing snippet. All fields are optional, allowing partial updates. If categories are included in the request, they will replace the existing category assignments. Actions are validated to ensure they are supported with a maximum of 10 actions per snippet.


## OpenAPI

````yaml https://api.getfernand.com/openapi.json patch /snippets/{id}
openapi: 3.0.3
info:
  title: Fernand API Documentation
  version: '3.0'
  description: This is the documentation for the [Fernand](https://getfernand.com) API.
  termsOfService: https://getfernand.com/terms
  contact:
    name: Fernand Support
    url: https://getfernand.com
    email: support@getfernand.com
  x-logo:
    url: https://app.getfernand.com/images/favicon/icon_128.png
servers:
  - url: https://api.getfernand.com
    description: ''
    x-last-modified: 1764750693905
security:
  - apiKeyHeader: []
externalDocs:
  description: You can access our documentation online by visiting https://api.fernand.help
  url: https://api.fernand.help
paths:
  /snippets/{id}:
    patch:
      tags:
        - Snippets
      summary: Update a snippet
      description: >-
        Updates an existing snippet. All fields are optional, allowing partial
        updates. If categories are included in the request, they will replace
        the existing category assignments. Actions are validated to ensure they
        are supported with a maximum of 10 actions per snippet.
      operationId: updateSnippet
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: ID of the snippet to update.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                  maxLength: 50
                  nullable: true
                  description: New title for the snippet (optional).
                  example: Updated Welcome Message
                shortcut:
                  type: string
                  maxLength: 40
                  pattern: ^[a-z0-9-]*$
                  nullable: true
                  description: >-
                    New keyboard shortcut (optional, lowercase, numbers, and
                    dashes only).
                  example: welcome2
                categories:
                  type: array
                  items:
                    type: integer
                  nullable: true
                  description: >-
                    New array of category IDs (optional, replaces existing
                    categories).
                  example:
                    - 2
                    - 4
                actions:
                  type: array
                  minItems: 1
                  maxItems: 10
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        enum:
                          - status
                          - assign
                          - snooze
                          - reply
                          - note
                          - tag
                        description: Name of the action to apply.
                        example: assign
                      data:
                        type: object
                        description: Action-specific data payload.
                        example:
                          agent_id: 5
                  nullable: true
                  description: New array of actions (optional, 1-10 actions if provided).
                  example:
                    - name: assign
                      data:
                        agent_id: 5
      responses:
        '200':
          description: Snippet updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Snippet'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '404':
          description: Snippet not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
components:
  schemas:
    Snippet:
      type: object
      properties:
        id:
          type: integer
          format: int32
          description: Unique identifier for the snippet
          example: 42
        title:
          type: string
          maxLength: 250
          description: Title of the snippet
          example: Welcome Message
        shortcut:
          type: string
          maxLength: 40
          nullable: true
          pattern: ^[a-z0-9-]*$
          description: >-
            Optional keyboard shortcut to quickly insert the snippet (lowercase,
            numbers, and dashes only)
          example: welcome
        created:
          type: string
          format: date-time
          description: Timestamp when the snippet was created (UTC)
          example: '2024-01-15T10:30:00Z'
        last_applied_at:
          type: string
          format: date-time
          nullable: true
          description: Timestamp when the snippet was last applied to a conversation (UTC)
        applied_count:
          type: integer
          format: int32
          description: Number of times this snippet has been applied
          example: 15
        categories:
          type: array
          items:
            type: integer
          description: >-
            Array of category IDs this snippet belongs to (0 represents root
            category)
          example:
            - 1
            - 3
        actions:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
                format: int32
                description: Unique identifier for the action
                example: 1
              name:
                type: string
                description: Name of the action (status, assign, snooze, reply, note, tag)
                example: status
              data:
                type: object
                description: Action-specific data payload
                example:
                  status: closed
              sort:
                type: integer
                format: int32
                description: Sort order for this action
                example: 0
          description: Array of actions to be applied when the snippet is used
          example:
            - id: 1
              name: status
              data:
                status: closed
              sort: 0
      required:
        - id
        - title
        - created
        - applied_count
        - categories
        - actions
      x-computed-hash: c38d3a2f7c50e50bbd7b0d94127b2a5ecc651e8a4d8aab93b02f1cd0546f5ec3
      x-last-modified: 1769075324
  securitySchemes:
    apiKeyHeader:
      type: apiKey
      description: >-
        Authenticate your account by including your secret key in API requests.

        You can manage your API keys in the
        [Dashboard](https://app.getfernand.com/).


        Authentication to the API is performed by using the HTTP Header
        X-API-Key.
      name: X-API-Key
      in: header
      x-last-modified: 1764750344730

````