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

# Update the project budget and its allocations



## OpenAPI

````yaml /openapi.yaml patch /projects/{project_id}/budget
openapi: 3.0.1
info:
  title: GetSpecs REST API
  description: REST API documentation for GetSpecs.
  version: 1.0.0
servers:
  - url: /v1
  - url: https://demo-api.getspecs.io/v1
security: []
paths:
  /projects/{project_id}/budget:
    parameters:
      - name: X-Workspace-ID
        in: header
        required: true
        schema:
          type: string
      - name: project_id
        in: path
        required: true
        schema:
          type: integer
    patch:
      tags:
        - Project Budget
      summary: Update the project budget and its allocations
      operationId: project_budgets#update
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/requestBodyProjectBudgetUpdate'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/project_budget'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
        - apiKey: []
          workspaceId: []
components:
  schemas:
    requestBodyProjectBudgetUpdate:
      type: object
      description: >-
        Every key is optional. The budget is created on the first save.
        Allocations are upserted by (analysis_type, group_id); an entry patches
        only the fields it sends (null clears one), and an allocation left with
        neither value is deleted. Allocations may add up to more than the total.
      properties:
        total_amount:
          type: string
          description: 0 ≤ amount < 1e16.
        allocations:
          type: array
          maxItems: 1000
          items:
            type: object
            properties:
              analysis_type:
                type: string
                enum:
                  - category
                  - supplier
              group_id:
                type: integer
                description: >-
                  A category (category) or contacts company (supplier) of the
                  workspace.
              allocation_percent:
                type: string
                nullable: true
                description: 0–100.
              override_amount:
                type: string
                nullable: true
                description: 0 ≤ amount < 1e16.
            required:
              - analysis_type
              - group_id
    project_budget:
      type: object
      description: >-
        The project's planned cost budget, compared with the cost side of Budget
        Analysis. One total, split by category and by supplier — the two splits
        are independent, each covering the same total.
      properties:
        project_id:
          type: integer
        configured:
          type: boolean
          description: >-
            False until the budget is first saved (the total then reads 0.00
            with no allocations).
        total_amount:
          type: string
          description: The project budget (cost), 2 decimals.
        updated_at:
          type: string
          format: date-time
          nullable: true
        category:
          $ref: '#/components/schemas/project_budget_breakdown'
        supplier:
          $ref: '#/components/schemas/project_budget_breakdown'
      required:
        - project_id
        - configured
        - total_amount
        - updated_at
        - category
        - supplier
    error:
      type: object
      properties:
        error:
          type: string
        errors:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
                nullable: true
              code:
                type: string
                nullable: true
              message:
                type: string
            required:
              - message
    project_budget_breakdown:
      type: object
      description: One analysis type's split of the project budget.
      properties:
        allocated_amount:
          type: string
          description: Σ allocated_amount of the allocations.
        unallocated_amount:
          type: string
          description: >-
            total_amount − allocated_amount. Negative when the allocations
            exceed the total.
        allocations:
          type: array
          description: Sorted by group_name, deleted groups (null name) last.
          items:
            $ref: '#/components/schemas/project_budget_allocation'
      required:
        - allocated_amount
        - unallocated_amount
        - allocations
    project_budget_allocation:
      type: object
      description: >-
        One category's or supplier company's share of the project budget. At
        least one of allocation_percent / override_amount is set.
      properties:
        group_id:
          type: integer
          description: >-
            Category id or contacts company id, matched by id with the Budget
            Analysis groups.
        group_name:
          type: string
          nullable: true
          description: >-
            The live category path / company name. Null once the category /
            company is deleted.
        allocation_percent:
          type: string
          nullable: true
          description: Share of total_amount, 0–100, 4 decimals.
        override_amount:
          type: string
          nullable: true
          description: >-
            A fixed planned amount that replaces the percentage when set, 2
            decimals.
        allocated_amount:
          type: string
          description: >-
            The planned amount: override_amount when set, otherwise
            allocation_percent × total_amount / 100 (rounded to cents). Follows
            the total when only the percentage is set.
      required:
        - group_id
        - group_name
        - allocation_percent
        - override_amount
        - allocated_amount
  securitySchemes:
    apiKey:
      type: apiKey
      name: authorization
      in: header
    workspaceId:
      type: apiKey
      name: X-Workspace-ID
      in: header

````

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