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

# Create client spend category

> Add a custom spend category for the client. Admin/Owner only. The key is normalised (trimmed, lower-cased, spaces → underscores) and may not shadow a Dolfin system default. Cascades to every organisation under the client.



## OpenAPI

````yaml post /clients/{clientId}/spend-categories
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:
    post:
      tags:
        - SpendCategories
      summary: Create client spend category
      description: >-
        Add a custom spend category for the client. Admin/Owner only. The key is
        normalised (trimmed, lower-cased, spaces → underscores) and may not
        shadow a Dolfin system default. Cascades to every organisation under the
        client.
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSpendCategoryRequest'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SpendCategoryResponse'
        '400':
          description: >-
            SpendCategory.MissingKey — key is missing or blank after
            normalisation


            SpendCategory.MissingDisplayName — display name is missing
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Member.Forbidden — caller is not an Admin or Owner of this Client
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '409':
          description: >-
            SpendCategory.ReservedKey — key collides with a Dolfin system
            default


            SpendCategory.DuplicateKey — a category with this key already exists
            for the client
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  schemas:
    CreateSpendCategoryRequest:
      required:
        - key
        - displayName
        - defaultSpendClass
        - glAccountCode
      type: object
      properties:
        key:
          type: string
        displayName:
          type: string
        defaultSpendClass:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/SpendClass'
        glAccountCode:
          type:
            - 'null'
            - string
    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

````