> ## 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 snippet's categories

Updates the categories assigned to a snippet. This endpoint replaces all existing categories with the provided list.


## OpenAPI

````yaml https://api.getfernand.com/openapi.json post /snippets/{id}/categories
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}/categories:
    post:
      tags:
        - Snippets
      summary: Update snippet's categories
      description: >-
        Updates the categories assigned to a snippet. This endpoint replaces all
        existing categories with the provided list.
      operationId: updateSnippetCategories
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: ID of the snippet to update categories for.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                categories:
                  type: array
                  items:
                    type: integer
                  description: >-
                    Array of category IDs to assign to this snippet (replaces
                    existing assignments).
                  example:
                    - 1
                    - 3
                    - 5
              required:
                - categories
      responses:
        '200':
          description: Categories updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Snippet'
        '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

````