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

Updates collection properties. When updating the sort order, provide only the 'sort' field with the new zero-based position - this will reorder the collection within its parent and adjust neighboring collections automatically. When updating other fields, the slug uniqueness is validated if changed. Parent\_id can be modified to move collections between parents or to root level.


## OpenAPI

````yaml https://api.getfernand.com/openapi.json patch /knowledge/collections/{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:
  /knowledge/collections/{id}:
    patch:
      tags:
        - Knowledge Collections
      summary: Update a collection
      description: >-
        Updates collection properties. When updating the sort order, provide
        only the 'sort' field with the new zero-based position - this will
        reorder the collection within its parent and adjust neighboring
        collections automatically. When updating other fields, the slug
        uniqueness is validated if changed. Parent_id can be modified to move
        collections between parents or to root level.
      operationId: updateCollection
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: ID of the collection to update.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                  maxLength: 250
                  description: Display title of the collection (optional).
                slug:
                  type: string
                  maxLength: 250
                  pattern: ^[a-z0-9_-]+$
                  description: >-
                    URL-safe slug (optional, lowercase alphanumeric with
                    dashes/underscores).
                icon:
                  type: string
                  maxLength: 25
                  nullable: true
                  description: Emoji icon identifier (optional).
                description:
                  type: string
                  maxLength: 1000
                  nullable: true
                  description: Collection description (optional).
                parent_id:
                  type: integer
                  nullable: true
                  description: ID of the parent collection (optional, null for root-level).
                seo_title:
                  type: string
                  maxLength: 250
                  nullable: true
                  description: SEO-optimized title (optional).
                seo_description:
                  type: string
                  maxLength: 1250
                  nullable: true
                  description: SEO-optimized description (optional).
                sort:
                  type: integer
                  description: >-
                    New sort position (zero-based, optional). When provided,
                    only updates sort order and ignores other fields.
      responses:
        '200':
          description: >-
            Collection updated successfully. Returns empty response when only
            sort was updated, otherwise returns the updated collection.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/Collection'
                  - type: object
                    properties: {}
                    description: Empty response when sort order was updated.
        '400':
          description: Invalid input or slug already in use.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
        '404':
          description: Collection not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
components:
  schemas:
    Collection:
      type: object
      properties:
        id:
          type: integer
          format: int64
          description: Unique identifier for the collection.
        parent_id:
          type: integer
          nullable: true
          description: >-
            ID of the parent collection for nested organization (null for
            root-level collections).
        title:
          type: string
          maxLength: 250
          description: Display title of the collection shown in navigation and headers.
          example: Getting Started
        slug:
          type: string
          maxLength: 250
          pattern: ^[a-z0-9_-]+$
          description: URL-safe slug used in the collection's URL path.
          example: getting-started
        description:
          type: string
          nullable: true
          description: Description of the collection content and purpose.
          example: Essential guides to help you get started with our platform
        seo_title:
          type: string
          maxLength: 250
          description: SEO-optimized title for search engines and meta tags.
          example: Getting Started - Complete Guide
        seo_description:
          type: string
          maxLength: 250
          nullable: true
          description: >-
            SEO-optimized description for search engines and social media
            previews.
        icon:
          type: string
          maxLength: 25
          nullable: true
          description: >-
            Emoji icon identifier displayed alongside the collection title for
            visual distinction.
          example: 🚀
        get_icon_color:
          type: string
          nullable: true
          description: >-
            Computed color code associated with the emoji icon for theming
            purposes.
        created:
          type: string
          format: date-time
          description: Timestamp when the collection was created.
        last_updated:
          type: string
          format: date-time
          description: Timestamp when the collection was last modified.
        get_articles:
          type: array
          items:
            type: integer
          description: >-
            Array of article IDs contained directly in this collection (not
            including nested collections).
          example:
            - 12
            - 45
            - 67
        get_collections:
          type: array
          items:
            type: integer
          description: Array of sub-collection IDs that are children of this collection.
          example:
            - 3
            - 8
            - 15
        sort:
          type: integer
          description: Sort order within the parent collection or at root level.
          example: 2
      x-computed-hash: 680b3b52d5771752ebd9584afb952bc5efa4006ed32d920a58071bf37479d4fb
      x-last-modified: 1769075325
  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

````