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

# Add supplier invoice item

> Adds a PO-linked item or an extra charge and recomputes the invoice net amount. A PO item line belongs to its PO item's project; an extra charge to `project_id`, by default the only project it can belong to.



## OpenAPI

````yaml /openapi.yaml post /supplier_invoices/{supplier_invoice_id}/items
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:
  /supplier_invoices/{supplier_invoice_id}/items:
    post:
      tags:
        - SupplierInvoiceItem
      summary: Add supplier invoice item
      description: >-
        Adds a PO-linked item or an extra charge and recomputes the invoice net
        amount. A PO item line belongs to its PO item's project; an extra charge
        to `project_id`, by default the only project it can belong to.
      operationId: supplier_invoice_items#create
      parameters:
        - name: supplier_invoice_id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/requestBodySupplierInvoiceItem'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/supplier_invoice_item'
        '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:
    requestBodySupplierInvoiceItem:
      type: object
      description: >-
        With `purchase_order_item_id` the item bills that PO item (same supplier
        and currency, PO open or closed); without it it is an extra charge and
        `description` is required.
      properties:
        purchase_order_item_id:
          type: integer
          nullable: true
        charge_purchase_order_id:
          type: integer
          nullable: true
          description: >-
            Extra charges only — the PO the charge belongs to (same checks as a
            PO item line); its whole amount goes to that PO. Unlinked charges
            are spread across the invoice's POs; an invoice with nothing linked
            is a non-PO cost. Setting `purchase_order_item_id` without this key
            clears it.
        project_id:
          type: integer
          nullable: true
          description: >-
            Extra charges only (PO item lines take their PO item's project) —
            any project of the workspace. Defaults to the only candidate — a
            linked charge's PO's projects; an unlinked charge's projects billed
            on POs by the invoice's other items, else those items' projects —
            and is required when there are several or none. A linked charge's
            project must be one of its PO's; when the invoice bills POs, an
            unlinked charge's project must be one of the billed projects.
            Defaults to the project of `package_section_id` /
            `package_baseline_item_id` when sent.
        package_section_id:
          type: integer
          nullable: true
          description: >-
            Extra charges only (PO item lines copy their PO item's dimensions,
            values sent are ignored) — required; a section of a baselined
            package of the charge's project, counted there by the budget
            analysis. Defaults to the only candidate — a linked charge's PO's
            item sections in its project, else the sections of the invoice's
            other items in its project.
        package_id:
          type: integer
          nullable: true
          description: >-
            Extra charges only — optional; must be the package of
            `package_section_id`.
        category_id:
          type: integer
          nullable: true
          description: Extra charges only — optional workspace category; blank clears it.
        package_baseline_item_id:
          type: integer
          nullable: true
          description: >-
            Extra charges only — optional baseline row of the charge's project
            (baselined package); the package, section and category are copied
            from it (an `package_section_id` sent along must match).
        description:
          type: string
          nullable: true
        quantity:
          type: string
          example: '400'
        unit_price:
          type: string
          example: '10.00'
    supplier_invoice_item:
      type: object
      properties:
        id:
          type: integer
        supplier_invoice_id:
          type: integer
        project_id:
          type: integer
          description: A PO item line's PO item project; an extra charge's own project.
        purchase_order_item:
          type: object
          nullable: true
          description: >-
            The billed PO item; null for an extra charge (freight, packaging,
            ...), which is never matched. Carries the PO item's current budget
            dimensions; the line's own are a snapshot taken when it was saved,
            so they differ once the PO item is moved (section, category,
            baseline row) after billing.
          properties:
            id:
              type: integer
            purchase_order_id:
              type: integer
            label:
              type: string
            description:
              type: string
              nullable: true
            package_section_id:
              type: integer
            category_id:
              type: integer
              nullable: true
            package_baseline_item_id:
              type: integer
              nullable: true
        charge_purchase_order:
          type: object
          nullable: true
          description: >-
            Extra charges only — the PO the charge belongs to; null for PO item
            lines and unlinked charges.
          properties:
            id:
              type: integer
            label:
              type: string
        package_id:
          type: integer
          description: >-
            Budget dimensions — a PO item line's copied from its PO item, an
            extra charge's own.
        package_section_id:
          type: integer
        category_id:
          type: integer
          nullable: true
        category:
          type: string
          nullable: true
          description: The category text (named like a manual PO item's).
        package_baseline_item_id:
          type: integer
          nullable: true
        description:
          type: string
          nullable: true
        quantity:
          type: string
          example: '400.00'
        unit_price:
          type: string
          example: '10.00'
        amount:
          type: string
          description: quantity × unit price, 2 decimals.
        position:
          type: integer
        matches:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              goods_receipt_item_id:
                type: integer
                nullable: true
              inspection_id:
                type: integer
                nullable: true
              matched_quantity:
                type: string
              result:
                type: string
                enum:
                  - matched
                  - exception
              exception_reason:
                type: string
                nullable: true
                enum:
                  - price_variance
                  - quantity_exceeds_order
                  - quantity_not_received
                  - quantity_rejected
                  - quantity_not_inspected
                  - null
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - project_id
        - quantity
        - unit_price
        - amount
        - package_id
        - package_section_id
        - matches
    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
  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.