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

# List purchase orders

> Paginated purchase orders of the workspace, ordered by `position` descending (newest first). Voided orders are left out unless `status[]` includes `voided`. No project membership is needed.



## OpenAPI

````yaml /openapi.yaml get /purchase_orders
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:
    get:
      tags:
        - PurchaseOrder
      summary: List purchase orders
      description: >-
        Paginated purchase orders of the workspace, ordered by `position`
        descending (newest first). Voided orders are left out unless `status[]`
        includes `voided`. No project membership is needed.
      operationId: purchase_orders#index
      parameters:
        - name: status[]
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
              enum:
                - draft
                - open
                - closed
                - cancelled
                - voided
        - name: supplier_company_name[]
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          description: Exact supplier company names
        - name: project_ids[]
          in: query
          required: false
          schema:
            type: array
            items:
              type: integer
          description: Keeps orders with at least one item of any of these projects
        - name: supplier_ids[]
          in: query
          required: false
          schema:
            type: array
            items:
              type: integer
          description: Keeps orders of any of these suppliers (contacts company ids)
        - name: purchase_order_items[package_ids][]
          in: query
          required: false
          schema:
            type: array
            items:
              type: integer
          description: >-
            Keeps orders with an item matching every given purchase_order_items
            list
        - name: purchase_order_items[package_section_ids][]
          in: query
          required: false
          schema:
            type: array
            items:
              type: integer
          description: >-
            Keeps orders with an item matching every given purchase_order_items
            list
        - name: purchase_order_items[category_ids][]
          in: query
          required: false
          schema:
            type: array
            items:
              type: integer
          description: >-
            Keeps orders with an item matching every given purchase_order_items
            list
        - name: supplier
          in: query
          required: false
          description: Substring match across the five supplier fields
          schema:
            type: string
        - name: search
          in: query
          required: false
          description: Substring match on label and name
          schema:
            type: string
        - name: page
          in: query
          required: false
          schema:
            type: integer
        - name: per_page
          in: query
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/purchase_order'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error'
      security:
        - apiKey: []
          workspaceId: []
components:
  schemas:
    purchase_order:
      type: object
      properties:
        id:
          type: integer
        project_ids:
          type: array
          description: >-
            The projects of the order's items, ascending (an order belongs to
            the workspace and can hold items of several projects); empty while
            it has no items.
          items:
            type: integer
        label:
          type: string
          description: >-
            Unique per workspace. Generated from the previous PO's label of the
            workspace when not given (`PO-Alex-01` → `PO-Alex-02`, default
            series `PO-0001`) — one series across all projects.
        name:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - draft
            - open
            - closed
            - cancelled
            - voided
          description: >-
            `draft` until issued (an `open` order can be reverted to it); `open`
            once issued (receipts and invoices allowed); `closed` = no more
            deliveries (invoices still allowed); `cancelled`; `voided` = kept as
            history but counted nowhere (procured quantity, budget), final.
        revision:
          type: integer
          description: >-
            Number of the latest revision. Revisions are written from issue
            onwards, one per change.
        currency:
          type: string
          nullable: true
          example: PLN
        notes:
          type: string
          nullable: true
        position:
          type: integer
        supplier_id:
          type: integer
          description: >-
            The supplier, a Contacts company of the workspace (may no longer
            exist).
        supplier_company_name:
          type: string
          description: >-
            The company's name when it was picked; a later rename in Contacts
            doesn't change it.
        supplier_contact_name:
          type: string
          nullable: true
        supplier_contact_email:
          type: string
          nullable: true
        supplier_contact_phone:
          type: string
          nullable: true
        supplier_address:
          type: string
          nullable: true
        items_count:
          type: integer
        total_amount:
          type: string
          description: Σ item quantity × unit price, 2 decimals.
          example: '296000.00'
        invoiced_amount:
          type: string
          description: >-
            This PO's share of its non-cancelled invoices (an invoice spanning
            several POs is split in proportion to each PO's items on it; extra
            charges are spread the same way).
        paid_amount:
          type: string
          description: >-
            Σ of the payment allocations to this PO (split when each payment was
            recorded). Can exceed invoiced_amount when a payment was allocated
            manually.
        outstanding_amount:
          type: string
          description: invoiced_amount − paid_amount.
        issued_at:
          type: string
          format: date-time
          nullable: true
          description: Cleared when the order is reverted to draft.
        voided_at:
          type: string
          format: date-time
          nullable: true
        voided_by_id:
          type: integer
          nullable: true
        created_by_id:
          type: integer
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        payment_schedule:
          $ref: '#/components/schemas/purchase_order_payment_schedule'
        payment_terms:
          type: array
          description: >-
            The order's own payment lines in schedule order (position
            descending).
          items:
            $ref: '#/components/schemas/purchase_order_payment_term'
        items:
          type: array
          description: >-
            Only on show and create-from-baseline, ordered by position
            descending.
          items:
            $ref: '#/components/schemas/purchase_order_item'
        attachments:
          type: array
          description: Only on show and create-from-baseline (with `items`). Newest first.
          items:
            $ref: '#/components/schemas/attachment'
      required:
        - id
        - project_ids
        - label
        - status
        - revision
        - currency
        - supplier_id
        - supplier_company_name
        - items_count
        - total_amount
        - invoiced_amount
        - paid_amount
        - outstanding_amount
    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
    purchase_order_payment_schedule:
      type: object
      description: How the order's payment lines cover its total, derived on read.
      properties:
        covered_amount:
          type: string
          description: Σ expected amounts of the lines.
        unscheduled_amount:
          type: string
          description: What the lines leave of the total (no due date).
        exceeds_total:
          type: boolean
          description: >-
            The lines cover more than the total — only possible on drafts;
            issuing and changes to open orders are refused
            (`purchase_order_payment_terms_exceed_total`).
        next_due_date:
          type: string
          format: date
          nullable: true
          description: The earliest known due date among lines not fully paid.
        overdue_amount:
          type: string
          description: Σ outstanding of the overdue lines.
      required:
        - covered_amount
        - unscheduled_amount
        - exceeds_total
        - overdue_amount
    purchase_order_payment_term:
      type: object
      description: >-
        One of a purchase order's own payment lines, with what is expected, when
        and what is paid — derived on read from the order total, its receipts,
        invoices and payment allocations.
      properties:
        id:
          type: integer
        payment_term_id:
          type: integer
          nullable: true
          description: >-
            The workspace term it was copied from; null for a line typed on the
            order or a deleted term.
        label:
          type: string
        term_type:
          type: string
          enum:
            - percentage
            - amount
        percent:
          type: string
          nullable: true
        amount:
          type: string
          nullable: true
        trigger:
          type: string
          enum:
            - order
            - delivery
            - invoice
        due_days:
          type: integer
        position:
          type: integer
        expected_amount:
          type: string
          description: >-
            A fixed amount as is; the percentage lines together take ROUND(total
            × Σ percent / 100, 2), split between them by percent.
        paid_amount:
          type: string
          description: The order's paid amount applied to the lines in schedule order.
        outstanding_amount:
          type: string
        due_date:
          type: string
          format: date
          nullable: true
          description: >-
            Trigger date + due_days; null until the trigger has happened.
            `invoice` lines use the date of the invoice that starts billing them
            (invoices in date order).
        payment_status:
          type: string
          enum:
            - unpaid
            - partially_paid
            - paid
        overdue:
          type: boolean
          description: >-
            Not fully paid and due before today; never on cancelled / voided
            orders.
      required:
        - id
        - label
        - term_type
        - trigger
        - due_days
        - expected_amount
        - paid_amount
        - outstanding_amount
        - payment_status
        - overdue
    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
    attachment:
      type: object
      description: >-
        A file attached to a procurement document (purchase order, supplier
        invoice, goods receipt or inspection), a project or a baseline row.
      properties:
        id:
          type: integer
        filename:
          type: string
          description: The name the file was uploaded with.
        content_type:
          type: string
          example: application/pdf
        byte_size:
          type: integer
        url:
          type: string
          description: >-
            Download URL. On private storage a signed URL that serves the file
            inline under its filename.
        created_by_id:
          type: integer
          nullable: true
        created_at:
          type: string
          format: date-time
        deleted_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            When it was removed from its document. Documents list only files
            that are not removed; a purchase order revision lists the files it
            had, removed ones included (their `url` still works).
      required:
        - id
        - filename
        - content_type
        - byte_size
        - url
        - created_at
  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.