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

# Update category

> Update an existing category by ID or slug. Requires a private API key.



## OpenAPI

````yaml https://api.marblecms.com/openapi.json patch /v1/categories/{identifier}
openapi: 3.1.0
info:
  title: Marble API
  version: 1.0.0
  description: A headless CMS API for managing and delivering content programmatically.
servers:
  - url: https://api.marblecms.com
    description: Production
security:
  - apiKey: []
paths:
  /v1/categories/{identifier}:
    patch:
      tags:
        - Categories
      summary: Update category
      description: Update an existing category by ID or slug. Requires a private API key.
      parameters:
        - schema:
            type: string
            example: technology
            description: Category ID or slug
          required: true
          description: Category ID or slug
          name: identifier
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCategoryBody'
      responses:
        '200':
          description: Category updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateCategoryResponse'
        '400':
          description: Invalid request body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Public API key used for write operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Forbidden'
        '404':
          description: Category not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFound'
        '409':
          description: Category with this slug already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Conflict'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerError'
components:
  schemas:
    UpdateCategoryBody:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          example: Engineering
        slug:
          type: string
          minLength: 1
          example: engineering
        description:
          type: string
          nullable: true
          example: Engineering articles and tutorials
    CreateCategoryResponse:
      type: object
      properties:
        category:
          type: object
          properties:
            id:
              type: string
              example: cryitfjp2345kl05weoybfk9
            name:
              type: string
              example: Technology
            slug:
              type: string
              example: technology
            description:
              type: string
              nullable: true
              example: Tech news and tutorials
          required:
            - id
            - name
            - slug
            - description
      required:
        - category
    Error:
      type: object
      properties:
        error:
          type: string
          example: Invalid query parameters
        details:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
                example: limit
              message:
                type: string
                example: Expected number, received string
            required:
              - field
              - message
        message:
          type: string
          example: Validation failed
      required:
        - error
    Forbidden:
      type: object
      properties:
        error:
          type: string
          example: Forbidden
        message:
          type: string
          example: >-
            Write operations require a private API key (msk_...). Public keys
            are read-only.
      required:
        - error
        - message
    NotFound:
      type: object
      properties:
        error:
          type: string
          example: Post not found
        message:
          type: string
          example: The requested resource does not exist
      required:
        - error
        - message
    Conflict:
      type: object
      properties:
        error:
          type: string
          example: Slug already in use
        message:
          type: string
          example: A resource with this slug already exists in this workspace
      required:
        - error
    ServerError:
      type: object
      properties:
        error:
          type: string
          example: Internal server error
        message:
          type: string
          example: Failed to fetch resource
      required:
        - error
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: Authorization
      description: Your Marble API key

````