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

# List invoice purchase order decisions

> Lists the orders the invoice bills or may bill: accepted and rejected decisions, and suggestions read from the order numbers the invoice cites. An accepted order carries how many of the invoice's lines it is assigned and their amount; the summary gives the lines that bill no order and the cited numbers that match no order. Not paginated.



## OpenAPI

````yaml /openapi.json get /v1/invoices/{id}/purchase-orders
openapi: 3.1.0
info:
  title: Watchdog API
  version: 1.0.0
  description: >-
    The Watchdog API is served from https://api.watchdog.no. Request bodies are
    limited to 2 MiB unless an endpoint says otherwise. Files are uploaded
    directly to storage, not through the API.
servers:
  - url: https://api.watchdog.no
    description: Watchdog API
security: []
paths:
  /v1/invoices/{id}/purchase-orders:
    get:
      tags:
        - Invoices
      summary: List invoice purchase order decisions
      description: >-
        Lists the orders the invoice bills or may bill: accepted and rejected
        decisions, and suggestions read from the order numbers the invoice
        cites. An accepted order carries how many of the invoice's lines it is
        assigned and their amount; the summary gives the lines that bill no
        order and the cited numbers that match no order. Not paginated.
      operationId: listInvoicePurchaseOrders
      parameters:
        - name: X-Organization-Id
          in: header
          required: false
          schema:
            type: string
          description: >-
            The organization to act in. Required for personal API keys; list the
            organizations you can access with GET /v1/organizations.
        - name: fields
          in: query
          required: false
          schema:
            type: array
            items:
              type: string
          style: form
          explode: false
          description: >-
            Return only these fields of each row; use dots for nested fields,
            such as assigned.lines. Fields: status, origin, reason,
            parties_differ, purchase_order, assigned, alert_counts, model_match.
        - schema:
            type: string
            format: uuid
          required: true
          name: id
          in: path
      responses:
        '200':
          description: >-
            Stored decisions plus suggestions read from the invoice references,
            and the accepted relationship. Hidden orders return a restricted
            marker.
          headers:
            X-Request-Id:
              schema:
                type: string
              required: true
              description: >-
                Request ID, also included in error bodies. Include it when
                contacting support.
            Cache-Control:
              schema:
                type: string
                enum:
                  - private, no-store
                  - private, no-store, no-transform
              required: false
              description: API responses are private and must not be cached.
            X-RateLimit-Limit:
              schema:
                type: string
                example: '500'
              required: false
              description: >-
                Requests allowed per minute for this credential, or failed API
                key attempts allowed per minute from this IP address.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/InvoicePurchaseOrder'
                  summary:
                    $ref: '#/components/schemas/InvoicePurchaseOrderSummary'
                required:
                  - data
                  - summary
        '400':
          description: >-
            The request is invalid. details lists up to 20 field errors. Request
            bodies are limited to 2 MiB.
          headers:
            X-Request-Id:
              schema:
                type: string
              required: true
              description: >-
                Request ID, also included in error bodies. Include it when
                contacting support.
            Cache-Control:
              schema:
                type: string
                enum:
                  - private, no-store
                  - private, no-store, no-transform
              required: false
              description: API responses are private and must not be cached.
            X-RateLimit-Limit:
              schema:
                type: string
                example: '500'
              required: false
              description: >-
                Requests allowed per minute for this credential, or failed API
                key attempts allowed per minute from this IP address.
          content:
            application/json:
              example:
                error:
                  code: validation_error
                  message: >-
                    The request is invalid. details lists up to 20 field errors.
                    Request bodies are limited to 2 MiB.
                  request_id: req_example
              schema:
                $ref: '#/components/schemas/Error_validation_error'
        '401':
          description: The bearer token is missing or invalid.
          headers:
            X-Request-Id:
              schema:
                type: string
              required: true
              description: >-
                Request ID, also included in error bodies. Include it when
                contacting support.
            Cache-Control:
              schema:
                type: string
                enum:
                  - private, no-store
                  - private, no-store, no-transform
              required: false
              description: API responses are private and must not be cached.
            X-RateLimit-Limit:
              schema:
                type: string
                example: '500'
              required: false
              description: >-
                Requests allowed per minute for this credential, or failed API
                key attempts allowed per minute from this IP address.
            WWW-Authenticate:
              schema:
                type: string
              required: false
              description: Bearer authentication challenge, when supplied.
          content:
            application/json:
              example:
                error:
                  code: invalid_token
                  message: The bearer token is missing or invalid.
                  request_id: req_example
              schema:
                $ref: '#/components/schemas/Error_invalid_token'
        '403':
          description: >-
            Access denied. The error code says why: forbidden, token_disabled,
            organization_required, insufficient_role or mfa_required.
          headers:
            X-Request-Id:
              schema:
                type: string
              required: true
              description: >-
                Request ID, also included in error bodies. Include it when
                contacting support.
            Cache-Control:
              schema:
                type: string
                enum:
                  - private, no-store
                  - private, no-store, no-transform
              required: false
              description: API responses are private and must not be cached.
            X-RateLimit-Limit:
              schema:
                type: string
                example: '500'
              required: false
              description: >-
                Requests allowed per minute for this credential, or failed API
                key attempts allowed per minute from this IP address.
          content:
            application/json:
              example:
                error:
                  code: forbidden
                  message: >-
                    Access denied. The error code says why: forbidden,
                    token_disabled, organization_required, insufficient_role or
                    mfa_required.
                  request_id: req_example
              schema:
                $ref: >-
                  #/components/schemas/Error_forbidden_token_disabled_organization_required_insufficient_role_mfa_required
        '404':
          description: The resource does not exist in the current organization.
          headers:
            X-Request-Id:
              schema:
                type: string
              required: true
              description: >-
                Request ID, also included in error bodies. Include it when
                contacting support.
            Cache-Control:
              schema:
                type: string
                enum:
                  - private, no-store
                  - private, no-store, no-transform
              required: false
              description: API responses are private and must not be cached.
            X-RateLimit-Limit:
              schema:
                type: string
                example: '500'
              required: false
              description: >-
                Requests allowed per minute for this credential, or failed API
                key attempts allowed per minute from this IP address.
          content:
            application/json:
              example:
                error:
                  code: not_found
                  message: The resource does not exist in the current organization.
                  request_id: req_example
              schema:
                $ref: '#/components/schemas/Error_not_found'
        '409':
          description: >-
            The invoice, accepted relationship, currency or order lifecycle is
            not eligible for this operation.
          headers:
            X-Request-Id:
              schema:
                type: string
              required: true
              description: >-
                Request ID, also included in error bodies. Include it when
                contacting support.
            Cache-Control:
              schema:
                type: string
                enum:
                  - private, no-store
                  - private, no-store, no-transform
              required: false
              description: API responses are private and must not be cached.
            X-RateLimit-Limit:
              schema:
                type: string
                example: '500'
              required: false
              description: >-
                Requests allowed per minute for this credential, or failed API
                key attempts allowed per minute from this IP address.
          content:
            application/json:
              example:
                error:
                  code: conflict
                  message: >-
                    The invoice, accepted relationship, currency or order
                    lifecycle is not eligible for this operation.
                  request_id: req_example
              schema:
                $ref: '#/components/schemas/Error_conflict'
        '429':
          description: Too many requests. Wait for the Retry-After delay before retrying.
          headers:
            X-Request-Id:
              schema:
                type: string
              required: true
              description: >-
                Request ID, also included in error bodies. Include it when
                contacting support.
            Cache-Control:
              schema:
                type: string
                enum:
                  - private, no-store
                  - private, no-store, no-transform
              required: false
              description: API responses are private and must not be cached.
            X-RateLimit-Limit:
              schema:
                type: string
                example: '500'
              required: false
              description: >-
                Requests allowed per minute for this credential, or failed API
                key attempts allowed per minute from this IP address.
            Retry-After:
              schema:
                type: string
                example: '60'
              required: true
              description: Seconds to wait before retrying the request.
          content:
            application/json:
              example:
                error:
                  code: rate_limit_exceeded
                  message: >-
                    Too many requests. Wait for the Retry-After delay before
                    retrying.
                  request_id: req_example
              schema:
                $ref: '#/components/schemas/Error_rate_limit_exceeded'
        '500':
          description: >-
            Unexpected server failure. Include the request ID when contacting
            support.
          headers:
            X-Request-Id:
              schema:
                type: string
              required: true
              description: >-
                Request ID, also included in error bodies. Include it when
                contacting support.
            Cache-Control:
              schema:
                type: string
                enum:
                  - private, no-store
                  - private, no-store, no-transform
              required: false
              description: API responses are private and must not be cached.
            X-RateLimit-Limit:
              schema:
                type: string
                example: '500'
              required: false
              description: >-
                Requests allowed per minute for this credential, or failed API
                key attempts allowed per minute from this IP address.
          content:
            application/json:
              example:
                error:
                  code: internal_error
                  message: >-
                    Unexpected server failure. Include the request ID when
                    contacting support.
                  request_id: req_example
              schema:
                $ref: '#/components/schemas/Error_internal_error'
        '503':
          description: >-
            Temporarily unavailable. Retry after the Retry-After delay, when
            provided.
          headers:
            X-Request-Id:
              schema:
                type: string
              required: true
              description: >-
                Request ID, also included in error bodies. Include it when
                contacting support.
            Cache-Control:
              schema:
                type: string
                enum:
                  - private, no-store
                  - private, no-store, no-transform
              required: false
              description: API responses are private and must not be cached.
            X-RateLimit-Limit:
              schema:
                type: string
                example: '500'
              required: false
              description: >-
                Requests allowed per minute for this credential, or failed API
                key attempts allowed per minute from this IP address.
            Retry-After:
              schema:
                type: string
                example: '60'
              required: true
              description: Seconds to wait before retrying the request.
          content:
            application/json:
              example:
                error:
                  code: service_unavailable
                  message: >-
                    Temporarily unavailable. Retry after the Retry-After delay,
                    when provided.
                  request_id: req_example
              schema:
                $ref: '#/components/schemas/Error_service_unavailable'
      security:
        - ApiKeyBearer: []
components:
  schemas:
    InvoicePurchaseOrder:
      type: object
      properties:
        status:
          type: string
          enum:
            - suggested
            - accepted
            - rejected
        origin:
          type: string
          enum:
            - automatic
            - manual
        reason:
          type:
            - string
            - 'null'
        parties_differ:
          type: boolean
          description: >-
            An accepted link whose invoice has another supplier or buyer than
            the order: a party override, or a link the order kept when its
            parties changed. False for suggestions, rejections and hidden
            orders.
        purchase_order:
          oneOf:
            - type: object
              properties:
                restricted:
                  type: boolean
                  enum:
                    - true
              required:
                - restricted
            - type: object
              properties:
                restricted:
                  type: boolean
                  enum:
                    - false
                id:
                  type: string
                  format: uuid
                number:
                  type:
                    - string
                    - 'null'
                title:
                  type:
                    - string
                    - 'null'
                status:
                  type: string
                currency_code:
                  type:
                    - string
                    - 'null'
                commitment_basis:
                  type: string
                  enum:
                    - lines
                    - amount_limit
              required:
                - restricted
                - id
                - number
                - title
                - status
                - currency_code
                - commitment_basis
        assigned:
          type:
            - object
            - 'null'
          properties:
            lines:
              type: integer
              minimum: 0
            amount:
              type: string
              description: The assigned lines, excluding VAT.
          required:
            - lines
            - amount
          description: >-
            The invoice's lines assigned to this accepted order. Null for
            suggestions, rejections and hidden orders.
        alert_counts:
          type:
            - object
            - 'null'
          properties:
            pending:
              type: object
              properties:
                credited:
                  type: integer
                  minimum: 0
                uncredited:
                  type: integer
                  minimum: 0
              required:
                - credited
                - uncredited
            accepted:
              type: object
              properties:
                credited:
                  type: integer
                  minimum: 0
                uncredited:
                  type: integer
                  minimum: 0
              required:
                - credited
                - uncredited
            dismissed:
              type: object
              properties:
                credited:
                  type: integer
                  minimum: 0
                uncredited:
                  type: integer
                  minimum: 0
              required:
                - credited
                - uncredited
            skipped:
              type: object
              properties:
                credited:
                  type: integer
                  minimum: 0
                uncredited:
                  type: integer
                  minimum: 0
              required:
                - credited
                - uncredited
          required:
            - pending
            - accepted
            - dismissed
            - skipped
          description: Null unless accepted and visible.
        model_match:
          type:
            - object
            - 'null'
          properties:
            linked_by_model:
              type: boolean
              description: >-
                Whether the order matcher linked this order because no reference
                matched. Always true.
            confirmed:
              type: boolean
              description: Whether a person accepted the link.
            confidence:
              type:
                - string
                - 'null'
              enum:
                - high
                - medium
                - low
                - null
              description: >-
                The order matcher's confidence in the link; null unless
                `linked_by_model`.
            evidence:
              type: array
              items:
                type: string
              description: >-
                What ties the invoice to the order; empty unless
                `linked_by_model`.
            differences:
              type: array
              items:
                type: string
              description: >-
                Where the invoice differs from the order; empty unless
                `linked_by_model`.
            decided_at:
              type: string
              format: date-time
            ties:
              type: array
              items:
                $ref: '#/components/schemas/PurchaseOrderModelMatchTie'
              description: 'Always empty: no model ties invoice lines to order lines.'
            questions:
              type: object
              properties:
                order:
                  type: boolean
                  description: >-
                    Whether a person still has to say the invoice bills this
                    order: the link is automatic and the model was not highly
                    confident. Linking the order answers it; the ties keep their
                    basis.
                lines:
                  type: array
                  items:
                    type: object
                    properties:
                      invoice_item_id:
                        type: string
                        format: uuid
                      line_number:
                        type: integer
                      description:
                        type:
                          - string
                          - 'null'
                      total_excluding_vat:
                        type: string
                      reason:
                        type: string
                        enum:
                          - group_not_exact
                          - line_does_not_fit
                          - unassigned
                        description: 'Why the line bills nothing: always `unassigned`.'
                      purchase_order_line_ids:
                        type: array
                        items:
                          type: string
                          format: uuid
                        description: Always empty.
                    required:
                      - invoice_item_id
                      - line_number
                      - description
                      - total_excluding_vat
                      - reason
                      - purchase_order_line_ids
                  description: >-
                    Lines that bill nothing and wait for a person to choose
                    their order lines. Tying a line answers its question.
              required:
                - order
                - lines
              description: >-
                What is still open. Lines billing the order as a whole are not
                questions. Nothing open: the match needs no person.
          required:
            - linked_by_model
            - confirmed
            - confidence
            - evidence
            - differences
            - decided_at
            - ties
            - questions
          description: >-
            Set when the order matcher linked this accepted order because no
            reference matched; `questions` says what a person still has to
            answer.
      required:
        - status
        - origin
        - reason
        - parties_differ
        - purchase_order
        - assigned
        - alert_counts
        - model_match
    InvoicePurchaseOrderSummary:
      type: object
      properties:
        unassigned:
          type: object
          properties:
            lines:
              type: integer
              minimum: 0
            amount:
              type: string
              description: Excluding VAT.
          required:
            - lines
            - amount
          description: >-
            Lines of a cent or more that bill no order and are not excluded:
            they wait for a person.
        unresolved_references:
          type: array
          items:
            type: string
          description: >-
            Order numbers the invoice or its lines cite that match no issued
            order.
      required:
        - unassigned
        - unresolved_references
    Error_validation_error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - validation_error
            message:
              type: string
            request_id:
              type: string
            description:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                  field:
                    type: string
                  message:
                    type: string
                required:
                  - code
                  - field
                  - message
              maxItems: 20
            workflow_run_id:
              type: string
              format: uuid
            import_id:
              type: string
              format: uuid
            existing_party:
              type: object
              properties:
                type:
                  type: string
                  enum:
                    - supplier
                    - recipient
                id:
                  type: string
                  format: uuid
              required:
                - type
                - id
          required:
            - code
            - message
            - request_id
      required:
        - error
    Error_invalid_token:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - invalid_token
            message:
              type: string
            request_id:
              type: string
            description:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                  field:
                    type: string
                  message:
                    type: string
                required:
                  - code
                  - field
                  - message
              maxItems: 20
            workflow_run_id:
              type: string
              format: uuid
            import_id:
              type: string
              format: uuid
            existing_party:
              type: object
              properties:
                type:
                  type: string
                  enum:
                    - supplier
                    - recipient
                id:
                  type: string
                  format: uuid
              required:
                - type
                - id
          required:
            - code
            - message
            - request_id
      required:
        - error
    Error_forbidden_token_disabled_organization_required_insufficient_role_mfa_required:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - forbidden
                - token_disabled
                - organization_required
                - insufficient_role
                - mfa_required
            message:
              type: string
            request_id:
              type: string
            description:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                  field:
                    type: string
                  message:
                    type: string
                required:
                  - code
                  - field
                  - message
              maxItems: 20
            workflow_run_id:
              type: string
              format: uuid
            import_id:
              type: string
              format: uuid
            existing_party:
              type: object
              properties:
                type:
                  type: string
                  enum:
                    - supplier
                    - recipient
                id:
                  type: string
                  format: uuid
              required:
                - type
                - id
          required:
            - code
            - message
            - request_id
      required:
        - error
    Error_not_found:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - not_found
            message:
              type: string
            request_id:
              type: string
            description:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                  field:
                    type: string
                  message:
                    type: string
                required:
                  - code
                  - field
                  - message
              maxItems: 20
            workflow_run_id:
              type: string
              format: uuid
            import_id:
              type: string
              format: uuid
            existing_party:
              type: object
              properties:
                type:
                  type: string
                  enum:
                    - supplier
                    - recipient
                id:
                  type: string
                  format: uuid
              required:
                - type
                - id
          required:
            - code
            - message
            - request_id
      required:
        - error
    Error_conflict:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - conflict
            message:
              type: string
            request_id:
              type: string
            description:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                  field:
                    type: string
                  message:
                    type: string
                required:
                  - code
                  - field
                  - message
              maxItems: 20
            workflow_run_id:
              type: string
              format: uuid
            import_id:
              type: string
              format: uuid
            existing_party:
              type: object
              properties:
                type:
                  type: string
                  enum:
                    - supplier
                    - recipient
                id:
                  type: string
                  format: uuid
              required:
                - type
                - id
          required:
            - code
            - message
            - request_id
      required:
        - error
    Error_rate_limit_exceeded:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - rate_limit_exceeded
            message:
              type: string
            request_id:
              type: string
            description:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                  field:
                    type: string
                  message:
                    type: string
                required:
                  - code
                  - field
                  - message
              maxItems: 20
            workflow_run_id:
              type: string
              format: uuid
            import_id:
              type: string
              format: uuid
            existing_party:
              type: object
              properties:
                type:
                  type: string
                  enum:
                    - supplier
                    - recipient
                id:
                  type: string
                  format: uuid
              required:
                - type
                - id
          required:
            - code
            - message
            - request_id
      required:
        - error
    Error_internal_error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - internal_error
            message:
              type: string
            request_id:
              type: string
            description:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                  field:
                    type: string
                  message:
                    type: string
                required:
                  - code
                  - field
                  - message
              maxItems: 20
            workflow_run_id:
              type: string
              format: uuid
            import_id:
              type: string
              format: uuid
            existing_party:
              type: object
              properties:
                type:
                  type: string
                  enum:
                    - supplier
                    - recipient
                id:
                  type: string
                  format: uuid
              required:
                - type
                - id
          required:
            - code
            - message
            - request_id
      required:
        - error
    Error_service_unavailable:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              enum:
                - service_unavailable
            message:
              type: string
            request_id:
              type: string
            description:
              type: string
            details:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                  field:
                    type: string
                  message:
                    type: string
                required:
                  - code
                  - field
                  - message
              maxItems: 20
            workflow_run_id:
              type: string
              format: uuid
            import_id:
              type: string
              format: uuid
            existing_party:
              type: object
              properties:
                type:
                  type: string
                  enum:
                    - supplier
                    - recipient
                id:
                  type: string
                  format: uuid
              required:
                - type
                - id
          required:
            - code
            - message
            - request_id
      required:
        - error
    PurchaseOrderModelMatchTie:
      type: object
      properties:
        invoice_item_id:
          type: string
          format: uuid
        line_number:
          type: integer
        description:
          type:
            - string
            - 'null'
        target:
          type: string
          enum:
            - line
            - group
            - order
            - unassigned
          description: >-
            `line`: one order line; `group`: several order lines whose amounts
            add up to the invoice line's total; `order`: the order as a whole;
            `unassigned`: the model's tie was refused, so the line waits for a
            person.
        purchase_order_line_ids:
          type: array
          items:
            type: string
            format: uuid
          description: >-
            The order lines the invoice line bills: one for `line`, several for
            `group`.
        exact:
          type: boolean
          description: >-
            Whether code proved the tie from the amounts (`basis: exact`): a
            group that adds up to the øre, or a line billed at the order line's
            price within what it has left. No person need confirm it.
        proposal:
          type:
            - object
            - 'null'
          properties:
            purchase_order_line_ids:
              type: array
              items:
                type: string
                format: uuid
            reason:
              type: string
              enum:
                - line_does_not_fit
                - group_not_exact
              description: >-
                `line_does_not_fit`: the one order line cannot be all the
                invoice line bills; `group_not_exact`: the order lines do not
                add up to the invoice line's total to the øre.
          required:
            - purchase_order_line_ids
            - reason
          description: >-
            For an `unassigned` line: the order lines the model proposed. Null
            otherwise.
      required:
        - invoice_item_id
        - line_number
        - description
        - target
        - purchase_order_line_ids
        - exact
        - proposal
  securitySchemes:
    ApiKeyBearer:
      type: http
      scheme: bearer
      description: >-
        Personal API key sent as a bearer token, together with
        X-Organization-Id. The key must have at least the access level the
        endpoint requires (read, write or admin).

````

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