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

# Update an approval rule

> Omitted fields are unchanged; supplied `conditions` replace every row and supplied `approver_ids` replace every approver. An invoice rule gives approvers to invoices as they arrive, an order rule to orders as they ask for approval: when a draft is opened, a change needs approval, or a waiting draft is asked again. Invoices and orders already waiting keep their approvers.



## OpenAPI

````yaml /openapi.json patch /v1/approval-rules/{id}
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/approval-rules/{id}:
    patch:
      tags:
        - Approval rules
        - Invoices
        - Settings
      summary: Update an approval rule
      description: >-
        Omitted fields are unchanged; supplied `conditions` replace every row
        and supplied `approver_ids` replace every approver. An invoice rule
        gives approvers to invoices as they arrive, an order rule to orders as
        they ask for approval: when a draft is opened, a change needs approval,
        or a waiting draft is asked again. Invoices and orders already waiting
        keep their approvers.
      operationId: updateApprovalRule
      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.
        - schema:
            type: string
            format: uuid
          required: true
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateApprovalRule'
      responses:
        '200':
          description: The saved rule.
          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:
                $ref: '#/components/schemas/ApprovalRule'
        '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: >-
            An approval rule with this case-sensitive name already exists.
            Nothing was saved.
          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: >-
                    An approval rule with this case-sensitive name already
                    exists. Nothing was saved.
                  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:
    UpdateApprovalRule:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
        conditions:
          type: object
          properties:
            schema_version:
              type: number
              enum:
                - 1
            root:
              $ref: '#/components/schemas/ApprovalRuleConditionRoot'
          required:
            - schema_version
            - root
          additionalProperties: false
          description: >-
            What the rule applies to, as a View filter over the subject's
            fields. Both subjects: the workspace company (company.id). Invoices:
            only fields an invoice answers by itself: supplier, supplier
            country, recipient, amount, currency, references, delivery address
            and issued date (no relative ranges). Agreement fields are rejected,
            since agreements are matched after an invoice arrives. Purchase
            orders: supplier, buyer (recipient.id), amount excluding VAT,
            currency and owner. Required on create, except for the fallback
            rule, which has none.
        approver_ids:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 255
          maxItems: 50
          description: >-
            Members who approve what the rule matches. Rules add people, never
            access. Puts everyone in step 1; send `steps` instead to approve in
            several steps, never both. Refused on a rule in several steps: send
            `steps` for it.
        approver_team_ids:
          type: array
          items:
            type: string
            format: uuid
          maxItems: 50
          description: >-
            Teams that approve what the rule matches: each counts as one
            approver, and whoever is in it while a request waits may decide for
            it. Puts everyone in step 1; send `steps` instead to approve in
            several steps, never both. Refused on a rule in several steps: send
            `steps` for it.
        steps:
          type: array
          items:
            $ref: '#/components/schemas/ApprovalRuleStep'
          maxItems: 10
          description: >-
            Who approves what the rule matches, in steps, first step first
            (WD-2904). Steps set only the order: one approval from anyone in a
            step ends its turn and starts the next step's. The invoice is
            approved at the organization's required number of approvals,
            whatever the number of steps. A person or team is in one step only,
            and empty steps are dropped. Invoice rules only: a purchase order
            rule has one step. When several rules give an invoice approvers
            (without `single_rule`), approvers with the same step number share
            that step, and someone several rules name takes the step of the
            first rule in the rules' order. Invoices already waiting keep their
            approvers.
        fallback:
          type: boolean
          description: >-
            Whether the rule is the fallback, as it was created: a rule never
            becomes or stops being the fallback (WD-2930). Accepted when it
            matches.
      additionalProperties: false
    ApprovalRule:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        subject:
          type: string
          enum:
            - invoice
            - purchase_order
          description: >-
            What the rule approves: `invoice`, or `purchase_order` for orders
            made in Watchdog before they open, and amendments that raise their
            commitment or change their supplier, buyer, currency or commitment
            basis. Fixed once the rule is created.
        conditions:
          $ref: '#/components/schemas/StoredSubscriptionFilter'
        fallback:
          type: boolean
          description: >-
            The fallback rule: who approves what no other rule of its subject
            gives approvers, at intake after the other rules, and when a waiting
            record loses its last approver. It has no conditions and matches
            every record, so a fallback for purchase orders makes every order
            made in Watchdog wait for approval. At most one per subject
            (WD-2930). Rules made as fallbacks before then may still have
            conditions and keep them.
        position:
          type: integer
          minimum: 0
          description: >-
            Where the rule stands in the organization's order, lowest first.
            Under the approval policy's `single_rule`, an invoice takes its
            approvers from the first rule that matches it, in that rule's steps.
            Otherwise every matching rule adds its approvers by step number, and
            someone several rules name takes the step of the first.
        approvers:
          type: array
          items:
            $ref: '#/components/schemas/ApprovalRuleApprover'
        approver_teams:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
              name:
                type: string
              step:
                type: integer
                minimum: 1
                description: The step the rule puts the approver in, 1 first (WD-2904).
            required:
              - id
              - name
              - step
          description: Teams that approve what the rule matches, by name.
        references:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
              name:
                type:
                  - string
                  - 'null'
              missing:
                type: boolean
              supplier_names:
                type: array
                items:
                  type: string
                description: Supplier names for agreement references.
              type:
                type: string
                enum:
                  - supplier
                  - recipient
                  - agreement
                  - agreement_tag
                  - company
                description: >-
                  `company`: a workspace company, which only approval rules
                  name.
            required:
              - id
              - name
              - missing
              - type
          description: >-
            Names of the companies, suppliers and recipients the conditions
            name.
        skipped_people:
          type: array
          items:
            type: object
            properties:
              user_id:
                type: string
                minLength: 1
                maxLength: 255
              name:
                type:
                  - string
                  - 'null'
              reason:
                type: string
                enum:
                  - no_access
                  - no_write
                  - removed_by_hand
                description: >-
                  `no_access`: their access limits hide the invoice. `no_write`:
                  role without write access. `removed_by_hand`: a person removed
                  them from the invoice.
              count:
                type: integer
                exclusiveMinimum: 0
                description: How many invoices the rule skipped them on.
              invoices:
                $ref: '#/components/schemas/ApprovalRuleSkippedInvoices'
            required:
              - user_id
              - name
              - reason
              - count
              - invoices
          description: >-
            People the rule names but did not add, once per person and reason,
            on invoices in Inbox or Needs approval, as of when each invoice
            arrived. Blocking reasons come first, then hand removals.
        skipped_teams:
          type: array
          items:
            type: object
            properties:
              team_id:
                type: string
                format: uuid
              name:
                type:
                  - string
                  - 'null'
              reason:
                type: string
                enum:
                  - nobody_can_act
                description: >-
                  `nobody_can_act`: nobody in the team had write access and
                  could see the invoice.
              count:
                type: integer
                exclusiveMinimum: 0
                description: How many invoices the rule skipped the team on.
              invoices:
                $ref: '#/components/schemas/ApprovalRuleSkippedInvoices'
            required:
              - team_id
              - name
              - reason
              - count
              - invoices
          description: >-
            Teams the rule names but did not add, on invoices in Inbox or Needs
            approval, as of when each invoice arrived, by name. Such an invoice
            gets the fallback rules' approvers, or none.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - name
        - subject
        - fallback
        - position
        - approvers
        - approver_teams
        - references
        - skipped_people
        - skipped_teams
        - created_at
        - updated_at
    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
    ApprovalRuleConditionRoot:
      type: object
      properties:
        combinator:
          type: string
          enum:
            - and
            - or
        children:
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/ViewInvoiceCategoryCondition'
              - $ref: '#/components/schemas/ViewReferenceCondition'
              - $ref: '#/components/schemas/ViewExactTextCondition'
              - $ref: '#/components/schemas/ViewContainsCondition'
              - $ref: '#/components/schemas/ViewContainsAnyCondition'
              - $ref: '#/components/schemas/ViewNumberCondition'
              - $ref: '#/components/schemas/ViewDateCondition'
              - $ref: '#/components/schemas/ViewRelativeDateCondition'
              - $ref: '#/components/schemas/ApprovalRuleCompanyCondition'
              - $ref: '#/components/schemas/PurchaseOrderRuleOwnerCondition'
              - $ref: '#/components/schemas/PurchaseOrderRuleCurrencyCondition'
              - $ref: >-
                  #/components/schemas/PurchaseOrderRuleCurrencyContainsCondition
              - $ref: '#/components/schemas/PurchaseOrderRuleAmountCondition'
              - $ref: '#/components/schemas/ApprovalRuleConditionGroupLevel2'
          minItems: 1
          maxItems: 20
      required:
        - combinator
        - children
      additionalProperties: false
    ApprovalRuleStep:
      type: object
      properties:
        user_ids:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 255
          maxItems: 50
          default: []
          description: Members who approve in this step.
        team_ids:
          type: array
          items:
            type: string
            format: uuid
          maxItems: 50
          default: []
          description: >-
            Teams that approve in this step; any one member decides for the
            team.
      additionalProperties: false
    StoredSubscriptionFilter:
      description: >-
        A saved View filter, returned as stored for unrestricted callers; it may
        be null or no longer valid. A restricted caller receives null with
        filter_restricted=true when the definition contains unavailable
        references or cannot be safely read. To replace it, send a filter in the
        shape the View create and update requests accept.
    ApprovalRuleApprover:
      allOf:
        - $ref: '#/components/schemas/ApproverPerson'
        - type: object
          properties:
            step:
              type: integer
              minimum: 1
              description: The step the rule puts the approver in, 1 first (WD-2904).
          required:
            - step
    ApprovalRuleSkippedInvoices:
      type: object
      properties:
        invoices:
          type: array
          items:
            type: object
            properties:
              invoice_id:
                type: string
                format: uuid
              invoice_number:
                type:
                  - string
                  - 'null'
              supplier_name:
                type:
                  - string
                  - 'null'
            required:
              - invoice_id
              - invoice_number
              - supplier_name
          maxItems: 10
          description: >-
            Up to 10 of the invoices, by supplier and number. The count gives
            the total.
        supplier_name:
          type:
            - string
            - 'null'
          description: >-
            The supplier every one of the invoices is from, or null when there
            are several.
      required:
        - invoices
        - supplier_name
    ViewInvoiceCategoryCondition:
      type: object
      properties:
        field:
          type: string
          enum:
            - invoice.category
        op:
          type: string
          enum:
            - is
            - is_not
            - is_any_of
            - is_none_of
        value:
          anyOf:
            - type: string
              enum:
                - invoice
                - credit_note
                - self_billed_invoice
                - reminder
                - collection_notice
            - type: array
              items:
                type: string
                enum:
                  - invoice
                  - credit_note
                  - self_billed_invoice
                  - reminder
                  - collection_notice
              minItems: 1
              maxItems: 100
      required:
        - field
        - op
        - value
      additionalProperties: false
    ViewReferenceCondition:
      type: object
      properties:
        field:
          type: string
          enum:
            - supplier.id
            - recipient.id
            - agreement.id
            - agreement.tag
        op:
          type: string
          enum:
            - is
            - is_not
            - is_any_of
            - is_none_of
        value:
          anyOf:
            - type: string
              format: uuid
            - type: array
              items:
                type: string
                format: uuid
              minItems: 1
              maxItems: 100
      required:
        - field
        - op
        - value
      additionalProperties: false
    ViewExactTextCondition:
      type: object
      properties:
        field:
          type: string
          enum:
            - supplier.country
            - invoice.currency
            - invoice.reference
            - invoice.buyer_reference
            - invoice.seller_reference
            - invoice.buyer_contact_name
            - invoice.order_references
            - invoice.contract_reference
            - invoice.project_reference
            - invoice.accounting_cost
            - invoice.delivery_name
            - invoice.delivery_street
            - invoice.delivery_postal_code
            - invoice.delivery_city
            - invoice.delivery_country
            - invoice.invoice_number
            - invoice.invoice_note
            - invoice.delivery_address
        op:
          type: string
          enum:
            - is
            - is_not
            - is_any_of
            - is_none_of
        value:
          anyOf:
            - type: string
              minLength: 1
            - type: array
              items:
                type: string
                minLength: 1
              minItems: 1
              maxItems: 100
      required:
        - field
        - op
        - value
      additionalProperties: false
    ViewContainsCondition:
      type: object
      properties:
        field:
          type: string
          enum:
            - supplier.country
            - invoice.currency
            - invoice.reference
            - invoice.buyer_reference
            - invoice.seller_reference
            - invoice.buyer_contact_name
            - invoice.order_references
            - invoice.contract_reference
            - invoice.project_reference
            - invoice.accounting_cost
            - invoice.delivery_name
            - invoice.delivery_street
            - invoice.delivery_postal_code
            - invoice.delivery_city
            - invoice.delivery_country
            - invoice.invoice_number
            - invoice.invoice_note
            - invoice.delivery_address
        op:
          type: string
          enum:
            - contains
            - not_contains
        value:
          type: string
          minLength: 1
      required:
        - field
        - op
        - value
      additionalProperties: false
    ViewContainsAnyCondition:
      type: object
      properties:
        field:
          type: string
          enum:
            - supplier.country
            - invoice.currency
            - invoice.reference
            - invoice.buyer_reference
            - invoice.seller_reference
            - invoice.buyer_contact_name
            - invoice.order_references
            - invoice.contract_reference
            - invoice.project_reference
            - invoice.accounting_cost
            - invoice.delivery_name
            - invoice.delivery_street
            - invoice.delivery_postal_code
            - invoice.delivery_city
            - invoice.delivery_country
            - invoice.invoice_number
            - invoice.invoice_note
            - invoice.delivery_address
        op:
          type: string
          enum:
            - contains_any
        value:
          type: array
          items:
            type: string
            minLength: 1
          minItems: 1
          maxItems: 100
      required:
        - field
        - op
        - value
      additionalProperties: false
    ViewNumberCondition:
      type: object
      properties:
        field:
          type: string
          enum:
            - invoice.amount
        op:
          type: string
          enum:
            - eq
            - gt
            - gte
            - lt
            - lte
        value:
          anyOf:
            - type: number
            - type: string
              pattern: ^-?\d+(\.\d+)?$
      required:
        - field
        - op
        - value
      additionalProperties: false
    ViewDateCondition:
      type: object
      properties:
        field:
          type: string
          enum:
            - agreement.expiration_date
            - invoice.issued_date
            - invoice.due_date
            - invoice.delivery_date
        op:
          type: string
          enum:
            - 'on'
            - before
            - on_or_before
            - after
            - on_or_after
        value:
          type: string
          format: date
      required:
        - field
        - op
        - value
      additionalProperties: false
    ViewRelativeDateCondition:
      type: object
      properties:
        field:
          type: string
          enum:
            - agreement.expiration_date
            - invoice.issued_date
            - invoice.due_date
            - invoice.delivery_date
        op:
          type: string
          enum:
            - within
        value:
          type: string
          enum:
            - last_30_days
            - last_90_days
            - last_365_days
            - expiring_30_days
            - expiring_60_days
            - expiring_90_days
      required:
        - field
        - op
        - value
      additionalProperties: false
    ApprovalRuleCompanyCondition:
      type: object
      properties:
        field:
          type: string
          enum:
            - company.id
        op:
          type: string
          enum:
            - is
            - is_not
            - is_any_of
            - is_none_of
        value:
          anyOf:
            - type: string
              format: uuid
            - type: array
              items:
                type: string
                format: uuid
              minItems: 1
              maxItems: 100
      required:
        - field
        - op
        - value
      additionalProperties: false
      description: >-
        The workspace company an invoice or order belongs to: IDs from `GET
        /v1/companies`. An invoice without a company is in none.
    PurchaseOrderRuleOwnerCondition:
      type: object
      properties:
        field:
          type: string
          enum:
            - purchase_order.owner
        op:
          type: string
          enum:
            - is
            - is_not
            - is_any_of
            - is_none_of
        value:
          anyOf:
            - type: string
              minLength: 1
            - type: array
              items:
                type: string
                minLength: 1
              minItems: 1
              maxItems: 100
      required:
        - field
        - op
        - value
      additionalProperties: false
    PurchaseOrderRuleCurrencyCondition:
      type: object
      properties:
        field:
          type: string
          enum:
            - purchase_order.currency
        op:
          type: string
          enum:
            - is
            - is_not
            - is_any_of
            - is_none_of
        value:
          anyOf:
            - type: string
              minLength: 1
            - type: array
              items:
                type: string
                minLength: 1
              minItems: 1
              maxItems: 100
      required:
        - field
        - op
        - value
      additionalProperties: false
    PurchaseOrderRuleCurrencyContainsCondition:
      type: object
      properties:
        field:
          type: string
          enum:
            - purchase_order.currency
        op:
          type: string
          enum:
            - contains
            - not_contains
        value:
          type: string
          minLength: 1
      required:
        - field
        - op
        - value
      additionalProperties: false
    PurchaseOrderRuleAmountCondition:
      type: object
      properties:
        field:
          type: string
          enum:
            - purchase_order.amount
        op:
          type: string
          enum:
            - eq
            - gt
            - gte
            - lt
            - lte
        value:
          anyOf:
            - type: number
            - type: string
              pattern: ^-?\d+(\.\d+)?$
      required:
        - field
        - op
        - value
      additionalProperties: false
    ApprovalRuleConditionGroupLevel2:
      type: object
      properties:
        combinator:
          type: string
          enum:
            - and
            - or
        children:
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/ViewInvoiceCategoryCondition'
              - $ref: '#/components/schemas/ViewReferenceCondition'
              - $ref: '#/components/schemas/ViewExactTextCondition'
              - $ref: '#/components/schemas/ViewContainsCondition'
              - $ref: '#/components/schemas/ViewContainsAnyCondition'
              - $ref: '#/components/schemas/ViewNumberCondition'
              - $ref: '#/components/schemas/ViewDateCondition'
              - $ref: '#/components/schemas/ViewRelativeDateCondition'
              - $ref: '#/components/schemas/ApprovalRuleCompanyCondition'
              - $ref: '#/components/schemas/PurchaseOrderRuleOwnerCondition'
              - $ref: '#/components/schemas/PurchaseOrderRuleCurrencyCondition'
              - $ref: >-
                  #/components/schemas/PurchaseOrderRuleCurrencyContainsCondition
              - $ref: '#/components/schemas/PurchaseOrderRuleAmountCondition'
              - $ref: '#/components/schemas/ApprovalRuleConditionGroupLevel3'
          minItems: 1
          maxItems: 20
      required:
        - combinator
        - children
      additionalProperties: false
    ApproverPerson:
      type: object
      properties:
        user_id:
          type: string
          minLength: 1
          maxLength: 255
        first_name:
          type:
            - string
            - 'null'
        last_name:
          type:
            - string
            - 'null'
        email:
          type:
            - string
            - 'null'
      required:
        - user_id
        - first_name
        - last_name
        - email
    ApprovalRuleConditionGroupLevel3:
      type: object
      properties:
        combinator:
          type: string
          enum:
            - and
            - or
        children:
          type: array
          items:
            anyOf:
              - $ref: '#/components/schemas/ViewInvoiceCategoryCondition'
              - $ref: '#/components/schemas/ViewReferenceCondition'
              - $ref: '#/components/schemas/ViewExactTextCondition'
              - $ref: '#/components/schemas/ViewContainsCondition'
              - $ref: '#/components/schemas/ViewContainsAnyCondition'
              - $ref: '#/components/schemas/ViewNumberCondition'
              - $ref: '#/components/schemas/ViewDateCondition'
              - $ref: '#/components/schemas/ViewRelativeDateCondition'
              - $ref: '#/components/schemas/ApprovalRuleCompanyCondition'
              - $ref: '#/components/schemas/PurchaseOrderRuleOwnerCondition'
              - $ref: '#/components/schemas/PurchaseOrderRuleCurrencyCondition'
              - $ref: >-
                  #/components/schemas/PurchaseOrderRuleCurrencyContainsCondition
              - $ref: '#/components/schemas/PurchaseOrderRuleAmountCondition'
          minItems: 1
          maxItems: 20
      required:
        - combinator
        - children
      additionalProperties: false
  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.