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

# Update client spend category

> Rename a category, set its default spend class or GL account code, or archive it. Admin/Owner only. The key is immutable; archiving removes it from the offered set while historical bills keep their stored key.



## OpenAPI

````yaml /api-reference/openapi.json patch /clients/{clientId}/spend-categories/{id}
openapi: 3.1.1
info:
  title: Dolfin API
  description: >-
    Dolfin API for AR & AP. Authenticate using the `x-dolfin-api-key` header
    with the API key distributed to your organisation.
  version: v1
servers:
  - url: https://api.dolfinai.co
    description: Production
security:
  - {}
tags:
  - name: Webhooks
  - name: Users
  - name: TaxRates
  - name: Suppliers
  - name: Supplier Credit Notes
  - name: Bills
  - name: SpendCategories
  - name: Payables
  - name: RecurringInvoices
  - name: Receivables
  - name: Purchase Orders
  - name: Products
  - name: Payments
  - name: Invoices
  - name: Organisations
  - name: Members
  - name: MCP
  - name: Matching
  - name: Invoice Reminders
  - name: Industries
  - name: Gmail
  - name: Delivery Notes
  - name: Customers
  - name: Currencies
  - name: Credit Notes
  - name: Clients
  - name: ClientInvites
  - name: BankPayments
  - name: Bank details
  - name: Auth
  - name: ApprovalPolicies
  - name: ApiKeys
  - name: Agent
paths:
  /clients/{clientId}/spend-categories/{id}:
    patch:
      tags:
        - SpendCategories
      summary: Update client spend category
      description: >-
        Rename a category, set its default spend class or GL account code, or
        archive it. Admin/Owner only. The key is immutable; archiving removes it
        from the offered set while historical bills keep their stored key.
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchSpendCategoryRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpendCategoryResponse'
        '403':
          description: Member.Forbidden — caller is not an Admin or Owner of this Client
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: SpendCategory.NotFound — no such category for this client
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  schemas:
    PatchSpendCategoryRequest:
      required:
        - displayName
        - defaultSpendClass
        - glAccountCode
        - isArchived
      type: object
      properties:
        displayName:
          type:
            - 'null'
            - string
        defaultSpendClass:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SpendClass'
        glAccountCode:
          type:
            - 'null'
            - string
        isArchived:
          type:
            - 'null'
            - boolean
    SpendCategoryResponse:
      required:
        - id
        - key
        - displayName
        - defaultSpendClass
        - glAccountCode
        - isArchived
        - createdAt
      type: object
      properties:
        id:
          type: string
          format: uuid
        key:
          type: string
        displayName:
          type: string
        defaultSpendClass:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SpendClass'
        glAccountCode:
          type:
            - 'null'
            - string
        isArchived:
          type: boolean
        createdAt:
          type: string
          format: date-time
    ProblemDetails:
      type: object
      properties:
        type:
          type:
            - 'null'
            - string
        title:
          type:
            - 'null'
            - string
        status:
          pattern: ^-?(?:0|[1-9]\d*)$
          type:
            - 'null'
            - integer
            - string
          format: int32
        detail:
          type:
            - 'null'
            - string
        instance:
          type:
            - 'null'
            - string
    SpendClass:
      enum:
        - Fixed
        - Variable
        - null

````