> ## 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 purchase order items

> Adds one item per selected baseline row (of any package of the workspace; each item takes its row's package, section, project and category), or a single manual item (`package_section_id` required: a section of an in-progress / finished package of any project of the workspace; the item takes its package and project; optional `category_id`, named after that package's committed rows, else the current path). One order can hold items of several projects. Returns the created items (position descending). On an issued PO this writes a new revision.



## OpenAPI

````yaml /openapi.yaml post /purchase_orders/{purchase_order_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:
  /purchase_orders/{purchase_order_id}/items:
    post:
      tags:
        - PurchaseOrderItem
      summary: Add purchase order items
      description: >-
        Adds one item per selected baseline row (of any package of the
        workspace; each item takes its row's package, section, project and
        category), or a single manual item (`package_section_id` required: a
        section of an in-progress / finished package of any project of the
        workspace; the item takes its package and project; optional
        `category_id`, named after that package's committed rows, else the
        current path). One order can hold items of several projects. Returns the
        created items (position descending). On an issued PO this writes a new
        revision.
      operationId: purchase_order_items#create
      parameters:
        - name: purchase_order_id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/requestBodyPurchaseOrderItemCreate'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/purchase_order_item'
        '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:
    requestBodyPurchaseOrderItemCreate:
      type: object
      description: >-
        Either the baseline `filter` (one item per matching baseline row — of
        one package with `package_id`, or across projects without it;
        description, unit, category and unit price come from the row, quantity
        is the row's remaining quantity — adjust single items afterwards with
        PATCH; each item belongs to its row's package, section and project) or a
        single manual item (`package_section_id`, `description`, `quantity`,
        `unit_price` required, no `filter`). One order can hold items of several
        projects. Match type and tolerances apply to every created item.
      properties:
        package_id:
          type: integer
          description: >-
            A baselined (in progress / finished) package of the workspace whose
            rows are selected; any project's package, not only the projects
            already on the order. Omit to select across projects with `filter`
            alone — the baselined packages of the active projects you're a
            member of, as the cross-project Committed grid lists them.
        package_section_id:
          type: integer
          description: >-
            Manual items only (required) — a section of an in-progress /
            finished package of any project of the workspace. The item takes the
            section's package and project. Sending it (without `filter`) marks
            the request as a manual item; `package_id` may be sent along and
            must then be the section's package.
        filter:
          $ref: '#/components/schemas/cross_project_baseline_item_filter'
          description: >-
            Same filter as baseline `find_items` (`ids`, `origin`, `category`,
            `package_section_ids`, supplier fields, `search`, `remaining`);
            without `package_id` also the cross-project `project_ids` and
            `package_ids` (ignored with `package_id`). Every matching row
            becomes one item (max 5000).
        description:
          type: string
        unit_type:
          type: string
          nullable: true
        category_id:
          type: integer
          nullable: true
          description: >-
            Manual items only — a category of the workspace. The stored
            `category` text is the name the item's package committed for it,
            else the current path. Baseline rows bring their own.
        quantity:
          type: string
          description: >-
            Manual items only (required); ignored for baseline rows — they get
            their remaining quantity.
        unit_price:
          type: string
        match_type:
          type: string
          enum:
            - two_way
            - three_way
            - four_way
        price_variance_percent:
          type: string
          nullable: true
          description: Null / blank = this price limit is not checked.
        quantity_variance_percent:
          type: string
        amount_variance_absolute:
          type: string
          nullable: true
          description: Null / blank = this price limit is not checked.
    purchase_order_item:
      type: object
      properties:
        id:
          type: integer
        project_id:
          type: integer
          description: >-
            The project this line procures for — the baseline row's project for
            linked items, the picked section's project for manual ones.
            Receipts, inspections, matches and invoice lines of the item carry
            it.
        purchase_order:
          type: object
          properties:
            id:
              type: integer
            label:
              type: string
            status:
              type: string
        baseline_item:
          type: object
          nullable: true
          description: >-
            The baseline row this item was created from (or re-linked to); null
            for manual items.
          properties:
            id:
              type: integer
            identifier:
              type: string
            name:
              type: string
              nullable: true
            package_id:
              type: integer
        package_id:
          type: integer
          description: >-
            The package the item counts for in Budget Analysis — the baseline
            row's, or the picked section's for a manual item.
        package_section_id:
          type: integer
          description: >-
            The section the item counts for in Budget Analysis — the baseline
            row's, or the picked one for a manual item.
        match_type:
          type: string
          enum:
            - two_way
            - three_way
            - four_way
        description:
          type: string
          nullable: true
        category_id:
          type: integer
          nullable: true
          description: >-
            The category the item was picked with (the row's for linked items).
            May no longer exist.
        category:
          type: string
          nullable: true
          description: >-
            Frozen category text — the row's for linked items; for a manual item
            the name its package committed for `category_id`, else the path at
            that time.
        unit_type:
          type: string
          nullable: true
        quantity:
          type: string
          example: '1000.00'
        unit_price:
          type: string
          example: '10.00'
        price_variance_percent:
          type: string
          nullable: true
          example: '2.0000'
          description: >-
            Max over-price in % of the PO unit price; null = not checked. With
            both price tolerances null, no over-price is allowed.
        quantity_variance_percent:
          type: string
          example: '0.0000'
        amount_variance_absolute:
          type: string
          nullable: true
          example: '50.00'
          description: Max over-price × quantity per invoice item; null = not checked.
        received_quantity:
          type: string
          description: Σ goods receipt quantity.
        accepted_quantity:
          type: string
          description: Σ accepted quantity of inspections.
        matched_quantity:
          type: string
          description: Σ matched invoice quantity.
        invoiced_quantity:
          type: string
          description: >-
            Σ quantity of the item's lines on non-cancelled invoices, matched or
            not. Above 0, match type and tolerances are frozen.
        position:
          type: integer
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - project_id
        - purchase_order
        - package_id
        - package_section_id
        - category_id
        - match_type
        - quantity
        - unit_price
        - received_quantity
        - accepted_quantity
        - matched_quantity
        - invoiced_quantity
    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
    cross_project_baseline_item_filter:
      allOf:
        - $ref: '#/components/schemas/baseline_item_filter'
        - type: object
          properties:
            project_ids:
              type: array
              items:
                type: integer
              description: >-
                Narrows to these projects (intersected with the active projects
                you're a member of).
            package_ids:
              type: array
              items:
                type: integer
              description: Package ids; exact match.
    baseline_item_filter:
      type: object
      properties:
        ids:
          type: array
          items:
            type: integer
          description: Baseline item ids; exact match.
        project_item_ids:
          type: array
          items:
            type: integer
          description: Source spec item ids; scoped to this package.
        origin:
          type: array
          items:
            type: string
            enum:
              - package
              - custom
        search:
          type: string
          description: >-
            Case-insensitive substring match on identifier, name and
            description.
        category:
          type: array
          items:
            type: string
          description: Category paths; each matches that path and every path under it.
        package_section_ids:
          type: array
          items:
            type: integer
          description: Section ids; exact match (subsections are not included).
        supplier:
          type: string
          description: Case-insensitive substring match across every supplier field.
        supplier_company_name:
          type: array
          items:
            type: string
          description: Exact match.
        supplier_contact_name:
          type: array
          items:
            type: string
          description: Exact match.
        supplier_contact_email:
          type: array
          items:
            type: string
          description: Exact match.
        supplier_contact_phone:
          type: array
          items:
            type: string
          description: Exact match.
        supplier_address:
          type: array
          items:
            type: string
          description: Exact match.
        remaining:
          type: boolean
          description: >-
            true keeps only rows with something left to order (quantity above
            the procured quantity), e.g. to order everything shown without
            hitting `baseline_item_fully_ordered`.
  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.