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

# Compare project budget analysis: specification versus baseline



## OpenAPI

````yaml /openapi.yaml get /projects/{id}/budget_analysis
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/{id}/budget_analysis:
    get:
      tags:
        - Project
      summary: 'Compare project budget analysis: specification versus baseline'
      operationId: projects#budget_analysis
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
        - name: analysis_type
          in: query
          required: true
          schema:
            type: string
            enum:
              - category
              - supplier
        - name: package_ids[]
          in: query
          required: false
          schema:
            type: array
            items:
              type: integer
          description: 'Packages to include. Default: every package of the project.'
        - name: package_section_ids[]
          in: query
          required: false
          schema:
            type: array
            items:
              type: integer
          description: >-
            Narrows each selected package to these sections and their subtrees.
            Without `package_ids[]`, selects the sections' packages. A section
            outside `package_ids[]` returns 404.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/budget_analysis'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '404':
          description: Not Found
          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:
    budget_analysis:
      type: object
      description: >-
        Specification (live project items) versus baseline for one analysis
        type, summed over the selected packages/sections. Packages without a
        completed baseline contribute to the specification side only.
      properties:
        totals:
          $ref: '#/components/schemas/budget_analysis_totals'
        groups:
          type: array
          items:
            $ref: '#/components/schemas/budget_analysis_group'
      required:
        - totals
        - groups
    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
    budget_analysis_totals:
      type: object
      properties:
        specification:
          $ref: '#/components/schemas/budget_analysis_amount'
        baseline:
          $ref: '#/components/schemas/budget_analysis_amount'
        additional_committed:
          $ref: '#/components/schemas/budget_analysis_additional_committed'
        variance:
          $ref: '#/components/schemas/budget_analysis_amount'
          description: baseline - specification, per amount.
        procurement:
          $ref: '#/components/schemas/budget_analysis_procurement'
        itemized_budget:
          type: string
          nullable: true
          description: >-
            Bottom-up planned cost of all live items in the selected scope: Σ
            (mapped budget price × Base QTY), each item rounded to 2 places.
            Base QTY is before Extra QTY and ignores a Purchase QTY override.
            Zero when the project's standard fields mapping has no budget price
            column. Null when that column is hidden from the current role.
        itemized_budget_available:
          type: boolean
          nullable: true
          description: >-
            Whether a budget price column is configured and every contributing
            cached group has an itemized budget. False when the specification
            cache is unavailable. An explicitly cached zero is available. Null
            when the mapped budget-price column is hidden from the current role.
        itemized_specification_variance:
          type: string
          nullable: true
          description: >-
            itemized_budget minus specification cost_price. Null when the
            itemized budget is unavailable.
        itemized_baseline_variance:
          type: string
          nullable: true
          description: >-
            itemized_budget minus baseline cost_price. Null when the itemized
            budget is unavailable.
        itemized_forecast_variance:
          type: string
          nullable: true
          description: >-
            itemized_budget minus procurement forecast. Null when itemized
            budget or procurement is unavailable.
        uncommitted_specification_cost:
          type: string
          nullable: true
          description: >-
            Specification cost from draft or baselining packages in the selected
            scope, excluded from procurement forecast and
            committed_scope_variance. Null when the specification cache is
            unavailable.
        committed_scope_variance:
          type: object
          nullable: true
          description: >-
            Baseline minus live specification for matching in_progress/finished
            packages and selected sections only. Draft/baselining packages never
            contribute. Null when no committed scope contributes or the
            specification cache is unavailable. Negative cost means cost growth;
            positive diff means margin loss.
          properties:
            cost_price:
              type: string
              nullable: true
            client_price:
              type: string
              nullable: true
            diff:
              type: string
              nullable: true
          required:
            - cost_price
            - client_price
            - diff
        budget:
          $ref: '#/components/schemas/budget_analysis_budget_totals'
      required:
        - specification
        - baseline
        - variance
        - itemized_budget
        - budget
        - itemized_budget_available
        - itemized_specification_variance
        - itemized_baseline_variance
        - itemized_forecast_variance
        - uncommitted_specification_cost
        - committed_scope_variance
        - additional_committed
    budget_analysis_group:
      type: object
      description: >-
        One category or supplier company, matched by id across specification,
        baseline and procurement: a category renamed after committing stays one
        group.
      properties:
        group_id:
          type: integer
          nullable: true
          description: >-
            Category or contacts company id. Null only for the no-supplier
            group.
        group_name:
          type: string
          nullable: true
          description: >-
            The label. The first name committed for the id in the selected scope
            (oldest baseline row; packages started after a rename hold a newer
            one); for a category with only manual purchase order items in scope,
            the earliest item's text; otherwise the live category path / company
            name. Null for the no-supplier group, or for a deleted record with
            nothing committed.
        other_names:
          type: array
          items:
            type: string
          description: >-
            The other names committed for the id in the selected scope, oldest
            first (the label excluded). Empty when every committed row holds the
            label. Purchase order texts are not included.
        current_name:
          type: string
          nullable: true
          description: >-
            The live category path / company name (what the Spec side shows).
            Differs from `group_name` after a rename. Null for the no-supplier
            group and for a deleted record.
        specification:
          $ref: '#/components/schemas/budget_analysis_amount'
        baseline:
          $ref: '#/components/schemas/budget_analysis_amount'
        additional_committed:
          $ref: '#/components/schemas/budget_analysis_additional_committed'
        variance:
          $ref: '#/components/schemas/budget_analysis_amount'
          description: baseline - specification, per amount.
        itemized_budget:
          type: string
          nullable: true
          description: >-
            Bottom-up planned cost of the live items in the selected scope: Σ
            (mapped budget price × Base QTY), each item rounded to 2 places.
            Base QTY is before Extra QTY and ignores a Purchase QTY override.
            Zero when the project's standard fields mapping has no budget price
            column. Null when that column is hidden from the current role.
        procurement:
          $ref: '#/components/schemas/budget_analysis_procurement'
        itemized_budget_available:
          type: boolean
          nullable: true
          description: >-
            Whether a budget price column is configured and every contributing
            cached group has an itemized budget. False when the specification
            cache is unavailable. An explicitly cached zero is available. Null
            when the mapped budget-price column is hidden from the current role.
        itemized_specification_variance:
          type: string
          nullable: true
          description: >-
            itemized_budget minus specification cost_price. Null when the
            itemized budget is unavailable.
        itemized_baseline_variance:
          type: string
          nullable: true
          description: >-
            itemized_budget minus baseline cost_price. Null when the itemized
            budget is unavailable.
        itemized_forecast_variance:
          type: string
          nullable: true
          description: >-
            itemized_budget minus procurement forecast. Null when itemized
            budget or procurement is unavailable.
        uncommitted_specification_cost:
          type: string
          nullable: true
          description: >-
            Specification cost from draft or baselining packages in the selected
            scope, excluded from procurement forecast and
            committed_scope_variance. Null when the specification cache is
            unavailable.
        committed_scope_variance:
          type: object
          nullable: true
          description: >-
            Baseline minus live specification for matching in_progress/finished
            packages and selected sections only. Draft/baselining packages never
            contribute. Null when no committed scope contributes or the
            specification cache is unavailable. Negative cost means cost growth;
            positive diff means margin loss.
          properties:
            cost_price:
              type: string
              nullable: true
            client_price:
              type: string
              nullable: true
            diff:
              type: string
              nullable: true
          required:
            - cost_price
            - client_price
            - diff
        budget:
          $ref: '#/components/schemas/budget_analysis_budget'
      required:
        - group_id
        - group_name
        - other_names
        - current_name
        - specification
        - baseline
        - variance
        - itemized_budget
        - budget
        - itemized_budget_available
        - itemized_specification_variance
        - itemized_baseline_variance
        - itemized_forecast_variance
        - uncommitted_specification_cost
        - committed_scope_variance
        - additional_committed
    budget_analysis_amount:
      type: object
      description: >-
        An amount is null when it is built from a column hidden from the current
        role (the mapped cost / client price column for the specification side,
        the baseline cost_price / client_price field for the baseline side,
        either for a variance).
      properties:
        cost_price:
          type: string
          nullable: true
        client_price:
          type: string
          nullable: true
        diff:
          type: string
          nullable: true
          description: client_price - cost_price
      required:
        - cost_price
        - client_price
        - diff
    budget_analysis_additional_committed:
      type: object
      description: >-
        Custom baseline items already included in committed amounts and all
        existing comparisons, in the selected in_progress/finished packages and
        section subtrees. These items intentionally have no source specification
        counterpart. Aggregated directly from baseline rows, independently of
        specification cache availability. No additions produces zero count and
        amounts; unpriced custom rows still count and contribute zero amounts.
      properties:
        items_count:
          type: integer
          minimum: 0
          description: >-
            Number of custom baseline items, including zero-value and unpriced
            rows.
        cost_price:
          type: string
          nullable: true
          description: >-
            Total custom baseline cost. Null when the baseline cost_price field
            is hidden.
        client_price:
          type: string
          nullable: true
          description: >-
            Total custom baseline client amount. Null when the baseline
            client_price field is hidden.
        diff:
          type: string
          nullable: true
          description: >-
            client_price minus cost_price. Null when either baseline price field
            is hidden.
      required:
        - items_count
        - cost_price
        - client_price
        - diff
    budget_analysis_procurement:
      type: object
      description: >-
        Procurement against the baseline budget (baseline cost price), over
        purchase orders that still count (draft, open, closed — not cancelled or
        voided). Only present when procurement is enabled for the workspace and
        the user has `procurement_view`. Order items linked to a baseline row
        count where their row does (same packages / sections, grouped by the
        row's category / supplier); manual items only for the whole project,
        grouped by their own category / their order's supplier.
      properties:
        committed:
          type: string
          description: >-
            Σ quantity × unit price of the order items, each line rounded to
            cents.
        invoiced:
          type: string
          description: >-
            What non-cancelled invoices bill those items, extra charges spread
            over each order's items.
        paid:
          type: string
          description: >-
            The payment allocations to the orders, spread over their items like
            the invoiced amount.
        remaining:
          type: string
          nullable: true
          description: baseline cost_price − committed.
        forecast:
          type: string
          nullable: true
          description: >-
            committed + what the baseline rows still leave to order (remaining
            quantity × unit cost, or the whole cost price of a row without
            quantity or unit cost that nothing procures).
        forecast_variance:
          type: string
          nullable: true
          description: baseline cost_price − forecast.
        specification_forecast_variance:
          type: string
          nullable: true
          description: >-
            Specification cost_price minus forecast. Null when the specification
            cache is unavailable.
        remaining_to_order:
          type: string
          nullable: true
          description: >-
            Forecast minus committed; the remaining baseline purchasing
            requirements, not an overrun. Null when an operand of the
            procurement forecast is hidden from the current role.
      required:
        - committed
        - invoiced
        - paid
        - remaining
        - forecast
        - forecast_variance
        - specification_forecast_variance
        - remaining_to_order
    budget_analysis_budget_totals:
      type: object
      nullable: true
      description: >-
        The whole project budget against the whole cost. Null unless the whole
        project is selected and the project has a saved budget.
      properties:
        total_amount:
          type: string
        allocated_amount:
          type: string
          description: Σ allocated_amount over this analysis type's allocations.
        unallocated_amount:
          type: string
          description: total_amount − allocated_amount. Negative when over-allocated.
        specification_variance:
          type: string
          nullable: true
          description: total_amount − specification cost_price.
        baseline_variance:
          type: string
          nullable: true
          description: total_amount − baseline cost_price.
        itemized_variance:
          type: string
          nullable: true
          description: total_amount − the totals' itemized_budget.
        forecast_variance:
          type: string
          nullable: true
          description: >-
            total_amount minus procurement forecast. Null when procurement is
            unavailable.
      required:
        - total_amount
        - allocated_amount
        - unallocated_amount
        - specification_variance
        - baseline_variance
        - itemized_variance
        - forecast_variance
    budget_analysis_budget:
      type: object
      nullable: true
      description: >-
        The group's planned budget against its cost. Null unless the whole
        project is selected (no package / section ids) and the project has a
        saved budget. A group without an allocation has a zero budget. Variances
        are budget − cost: positive means under budget.
      properties:
        allocation_percent:
          type: string
          nullable: true
        override_amount:
          type: string
          nullable: true
        allocated_amount:
          type: string
          description: >-
            override_amount when set, otherwise allocation_percent of the
            project total.
        specification_variance:
          type: string
          nullable: true
          description: allocated_amount − specification cost_price.
        baseline_variance:
          type: string
          nullable: true
          description: allocated_amount − baseline cost_price.
        itemized_variance:
          type: string
          nullable: true
          description: >-
            allocated_amount − the group's itemized_budget (top-down plan vs
            bottom-up plan).
        forecast_variance:
          type: string
          nullable: true
          description: >-
            allocated_amount minus procurement forecast. Null when procurement
            is unavailable.
      required:
        - allocation_percent
        - override_amount
        - allocated_amount
        - specification_variance
        - baseline_variance
        - itemized_variance
        - forecast_variance
  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.