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

# Update category

> This API renames a category, changes its privacy, moves it or changes its position. The `put` method works too. For CLI sessions, this needs the Manage categories permission.


> [!NOTE]
>
> Replace `{your-subdomain}` with your workspace's subdomain. \
> Learn how to find your subdomain in [Workspace subdomain](https://apidocs.neetokb.com/api/workspace-subdomain.md).


## OpenAPI

````yaml bundled/categories.yaml PATCH /categories/{id}
openapi: 3.0.3
info:
  title: NeetoKB Categories API
  description: APIs to list, create, update, delete and reorder categories in a workspace.
  version: 1.0.0
servers:
  - description: NeetoKB API
    url: https://{your-subdomain}.neetokb.com/api/external/v2
    variables:
      your-subdomain:
        default: spinkart
        description: >-
          Replace **spinkart** with your [workspace's
          subdomain](/api/workspace-subdomain).
security: []
paths:
  /categories/{id}:
    patch:
      tags:
        - Categories
      summary: Update category
      description: >
        This API renames a category, changes its privacy, moves it or changes
        its position. The `put` method works too. For CLI sessions, this needs
        the Manage categories permission.
      parameters:
        - $ref: '#/components/parameters/api_key_header'
        - $ref: '#/components/parameters/category_id_path_param'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/update_category_request'
      responses:
        '200':
          description: OK - Request succeeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  category:
                    $ref: '#/components/schemas/flat_category'
        '401':
          $ref: '#/components/responses/unauthorized_response'
        '403':
          $ref: '#/components/responses/forbidden_response'
        '404':
          description: Not Found - The category or the new parent does not exist
        '422':
          description: >-
            Unprocessable Entity - The name is blank, too long or already used
            by a sibling category, the position is invalid, a public category
            would sit under a private parent, the nesting is too deep, or the
            category would move below itself
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_body'
components:
  parameters:
    api_key_header:
      in: header
      name: X-Api-Key
      description: >-
        Use the X-Api-Key header to provide your workspace API key. Refer to
        [Authentication](/api/authentication) for more information.
      required: true
      schema:
        type: string
        default: your-api-key
    category_id_path_param:
      in: path
      name: id
      description: Category UUID or slug.
      required: true
      schema:
        type: string
  schemas:
    update_category_request:
      type: object
      properties:
        name:
          type: string
          maxLength: 120
          description: Unique among sibling categories, ignoring case.
        description:
          type: string
        is_private:
          type: boolean
          description: Also applies to the subcategories.
        parent_id:
          type: string
          description: >-
            New parent category UUID or slug. An empty string moves the category
            to the top level. Leave it out to keep the parent.
        position:
          type: integer
          minimum: 1
          description: 1-based position among its siblings.
    flat_category:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        description:
          type: string
          nullable: true
        slug:
          type: string
        sequence:
          type: integer
          nullable: true
        parent_id:
          type: string
          format: uuid
          nullable: true
        depth:
          type: integer
        is_private:
          type: boolean
        articles_count:
          type: integer
        categories_count:
          type: integer
        total_articles_count:
          type: integer
        url:
          type: string
    error_body:
      type: object
      properties:
        error:
          type: string
  responses:
    unauthorized_response:
      description: Unauthorized - API key is missing or invalid
    forbidden_response:
      description: >-
        Forbidden - The CLI session does not have the permission this change
        needs

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.