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

# Set the cost category on selected expenses

> Requires the advancedCostCenters entitlement. Sets the same main category and
optional subcategory on every expense header and line item in a single transaction.
Companies with an active rules-based approval workflow are limited to 20 expenses per batch.




## OpenAPI

````yaml /openapi/openapi.json post /expenses/costCenters
openapi: 3.1.0
info:
  title: OpenAPI
  version: '1.0'
  summary: OpenApi
  contact:
    name: Altera Support
    url: https://altera.co
    email: wsparcie@altera.co
  description: ''
  license:
    url: https://altera.co/regulamin
    name: Terms of services for Altera.app
servers:
  - url: https://api.altera.co
    description: Production endpoint (proxied)
security:
  - Authorization: []
tags:
  - name: Configuration
  - name: Data export
  - name: Expenses
  - name: Sales
paths:
  /expenses/costCenters:
    post:
      tags:
        - Expenses
      summary: Set the cost category on selected expenses
      description: >
        Requires the advancedCostCenters entitlement. Sets the same main
        category and

        optional subcategory on every expense header and line item in a single
        transaction.

        Companies with an active rules-based approval workflow are limited to 20
        expenses per batch.
      operationId: updateExpenseCostCenters
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - invoiceIds
                - tag
              properties:
                invoiceIds:
                  type: array
                  minItems: 1
                  maxItems: 100
                  items:
                    type: integer
                    minimum: 1
                    maximum: 9007199254740991
                tag:
                  type:
                    - integer
                    - 'null'
                  minimum: 1
                  maximum: 9007199254740991
                  description: >-
                    Active main category ID. Set to null to clear both category
                    levels.
                tag2:
                  type:
                    - integer
                    - 'null'
                  minimum: 1
                  maximum: 9007199254740991
                  default: null
                  description: >-
                    Active child of tag. Omit it or pass null to clear the
                    subcategory.
                workflowEditConfirmations:
                  type: object
                  description: >-
                    Map from invoice ID to confirmation returned in
                    details.invoices when the category change needs approval to
                    restart. Keys match `^[1-9][0-9]*$`, for example `"101"`.
                  propertyNames:
                    pattern: ^[1-9][0-9]*$
                  additionalProperties:
                    type: string
                    pattern: ^[a-f0-9]{64}$
              not:
                type: object
                required:
                  - tag2
                properties:
                  tag:
                    type: 'null'
                  tag2:
                    type: integer
            examples:
              setCategory:
                value:
                  invoiceIds:
                    - 101
                    - 102
                  tag: 6
                  tag2: 7
              confirmWorkflowEdit:
                value:
                  invoiceIds:
                    - 101
                  tag: 6
                  tag2: 7
                  workflowEditConfirmations:
                    '101': >-
                      0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
      responses:
        '200':
          $ref: '#/components/responses/InvoiceBatchUpdated'
        '400':
          $ref: '#/components/responses/InvalidExpenseClassification'
        '401':
          $ref: '#/components/responses/OpenApiAuthorizationRequired'
        '402':
          description: The company's subscription does not include advancedCostCenters.
        '403':
          $ref: '#/components/responses/OpenApiAccessDenied'
        '404':
          description: At least one ID does not identify an expense in the company.
        '409':
          description: >
            Workflow conflict. WORKFLOW_EDIT_CONFIRMATION_REQUIRED returns
            confirmation tokens

            in details.invoices. To confirm, retry the same batch with
            workflowEditConfirmations.

            WORKFLOW_BATCH_TOO_LARGE returns the allowed batch size in
            details.maximum.

            WORKFLOW_CONFIG_PENDING means a workflow configuration operation is
            processing an expense in the batch.

            Retry after the operation finishes. Confirmation tokens apply only
            to WORKFLOW_EDIT_CONFIRMATION_REQUIRED.

            On WORKFLOW_CONFLICT, read the current expense state before
            retrying.

            The transaction is rolled back on a conflict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExpenseClassificationError'
components:
  responses:
    InvoiceBatchUpdated:
      description: Every selected document was updated.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InvoiceBatchResult'
    InvalidExpenseClassification:
      description: >-
        Invalid input, unavailable classification, or a locked expense. The
        entire batch is rejected.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ExpenseClassificationError'
    OpenApiAuthorizationRequired:
      description: >-
        The Authorization header is missing, or a verified key has expired
        (KEY_EXPIRED).
    OpenApiAccessDenied:
      description: The API key is invalid or the company does not have OpenAPI access.
  schemas:
    ExpenseClassificationError:
      type: object
      properties:
        result:
          type: string
          enum:
            - Error
        errorCode:
          type: string
        errorMessage:
          type: string
        errorMessagePL:
          type: string
        details:
          type: object
          additionalProperties: true
          properties:
            invoices:
              type: array
              description: >-
                Present when the category change needs explicit workflow
                confirmation.
              items:
                type: object
                required:
                  - invoiceId
                  - confirmation
                properties:
                  invoiceId:
                    type: integer
                    minimum: 1
                  confirmation:
                    type: string
                    pattern: ^[a-f0-9]{64}$
    InvoiceBatchResult:
      type: object
      required:
        - result
        - data
      properties:
        result:
          type: string
          enum:
            - OK
        data:
          type: object
          required:
            - processed
            - rejected
          properties:
            processed:
              type: array
              description: >-
                Each processed invoice ID appears once, in the order of its
                first occurrence in the request.
              uniqueItems: true
              items:
                type: integer
                minimum: 1
            rejected:
              type: array
              maxItems: 0
              items:
                type: object
  securitySchemes:
    Authorization:
      name: Authorization
      type: apiKey
      in: header
      description: OpenApi Key created within Altera.app for a certain company

````

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