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

# Update category

> Update category by ID



## OpenAPI

````yaml put /categories/{id}
openapi: 3.1.0
info:
  title: CookieChimp API
  description: |
    API for CookieChimp.com.

    ## Request bodies

    Resource endpoints expect the resource wrapped under its own key, e.g.
    `{"category": {"name": "Analytics"}}` rather than a bare object.
    `PUT /password` wraps in `user`. `POST /auth` is the exception: it takes
    `email` and `password` at the top level.

    ## Response envelopes

    Listing endpoints — including `GET /groups` and `GET /accounts` — return
    `{"pagination": {...}, "data": [...]}`. Most single-resource endpoints
    return `{"data": {...}}`; a single group or account is returned unwrapped.
    Resource-deletion endpoints return `{"message": "..."}`; `DELETE /auth`
    returns an empty object.
  version: 1.2.0
servers:
  - url: https://cookiechimp.com/api/v1
security:
  - authorization: []
paths:
  /categories/{id}:
    put:
      tags:
        - Categories
      summary: Update category
      description: Update category by ID
      operationId: updateCategory
      parameters:
        - $ref: '#/components/parameters/id'
      requestBody:
        description: Category to update
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CategoryWriteRequest'
      responses:
        '200':
          description: Updated category
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CategoryResponse'
        '401':
          $ref: '#/components/responses/AccountTokenRequired'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  parameters:
    id:
      name: id
      in: path
      description: ID of the resource
      required: true
      schema:
        type: string
  schemas:
    CategoryWriteRequest:
      type: object
      properties:
        category:
          $ref: '#/components/schemas/CategoryWrite'
      required:
        - category
      example:
        category:
          name: Analytics
          slug: analytics
          description: Cookies that help us understand how the site is used
          required: false
    CategoryResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Category'
    CategoryWrite:
      type: object
      properties:
        name:
          type: string
          description: Name of the category that is displayed to users
        slug:
          type: string
          description: |
            URL-friendly identifier for the category, used by the consent banner
            and the JavaScript SDK. Some slugs are reserved by CookieChimp.
        description:
          type: string
          description: Description of the category that is displayed to users
        required:
          type: boolean
          description: Whether the category is required for the website to function
      required:
        - name
    Category:
      type: object
      properties:
        id:
          type: string
          readOnly: true
          description: Unique identifier for the category
        name:
          type: string
          description: Name of the category that is displayed to users
        description:
          type: string
          description: Description of the category that is displayed to users
        slug:
          type: string
          description: URL-friendly identifier for the category
        required:
          type: boolean
          description: Whether the category is required for the website to function
        default_language:
          type: string
          description: Language code the name and description are written in
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
      example:
        id: essential
        name: Essential
        description: Cookies essential for website functionality
        slug: essential
        required: true
        default_language: en
        created_at: '2023-01-01T00:00:00Z'
        updated_at: '2023-01-02T00:00:00Z'
    Error:
      type: object
      description: |
        The standard error envelope, used for authentication, authorization,
        pagination and not-found errors.
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              code:
                type: integer
              message:
                type: string
      example:
        errors:
          - code: 401
            message: Invalid API Key
    ValidationError:
      type: object
      description: |
        Returned when a create or update fails validation. Each entry carries a
        single human-readable `error` string.
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              error:
                type: string
      example:
        errors:
          - error: Name can't be blank
  responses:
    AccountTokenRequired:
      description: |
        Missing or invalid API token, or a token that does not resolve to an
        account. Account-scoped endpoints accept an account token, or a user
        token whose user belongs to an account; partner tokens are rejected.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            errors:
              - code: 401
                message: API key must belong to an account
    NotFound:
      description: The record does not exist, or does not belong to the caller
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            errors:
              - code: 404
                message: Record not found
    ValidationError:
      description: The record could not be saved
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    RateLimited:
      description: |
        Too many requests. The general limit is 300 requests per 5 minutes per
        API token; the auth endpoints are throttled more tightly per IP.
      headers:
        Retry-After:
          description: Seconds until the current rate-limit window resets
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            errors:
              - code: 429
                message: Too many requests. Please retry later.
  securitySchemes:
    authorization:
      type: http
      scheme: bearer
      description: API token obtained from the login endpoint or the dashboard

````