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

# Get the AP flow statistics

> How the organization’s invoices moved through the eight stages of the accounts payable flow, in order: intake, reading, match, checks, coding, validation, approval and transfer to the accounting system. Each figure covers the period and, where it has previous, the period of the same length right before it. Rebuilt every night (computed_at); each period ends on the last whole day before that. A stage is touched when a person changed or overrode something in it before the decision (comments, the approval click and the send are not touches); a stage that cannot be measured for an invoice counts as neither. Rates, the funnel, times and stage figures count invoices decided (approved or rejected) in the period; received and intake.channels count invoices received in it, intake.stopped documents that arrived in it. Every share is {count, of, share}: share is count / of, and null when of is 0, which means not measured; change is current.share − previous.share. untouched_until_approval: decided invoices no stage before approval touched. no_touch: decided invoices untouched in every measured stage, approval included. Durations are in seconds. Every figure counts whole invoices, so a caller whose access is limited by supplier, recipient or the invoices they approve gets 403 forbidden, as do organizations without accounts payable. A member with access to some companies sees those companies’ invoices.



## OpenAPI

````yaml /openapi.json get /v1/overview/ap-flow
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/overview/ap-flow:
    get:
      tags:
        - Overview
      summary: Get the AP flow statistics
      description: >-
        How the organization’s invoices moved through the eight stages of the
        accounts payable flow, in order: intake, reading, match, checks, coding,
        validation, approval and transfer to the accounting system. Each figure
        covers the period and, where it has previous, the period of the same
        length right before it. Rebuilt every night (computed_at); each period
        ends on the last whole day before that. A stage is touched when a person
        changed or overrode something in it before the decision (comments, the
        approval click and the send are not touches); a stage that cannot be
        measured for an invoice counts as neither. Rates, the funnel, times and
        stage figures count invoices decided (approved or rejected) in the
        period; received and intake.channels count invoices received in it,
        intake.stopped documents that arrived in it. Every share is {count, of,
        share}: share is count / of, and null when of is 0, which means not
        measured; change is current.share − previous.share.
        untouched_until_approval: decided invoices no stage before approval
        touched. no_touch: decided invoices untouched in every measured stage,
        approval included. Durations are in seconds. Every figure counts whole
        invoices, so a caller whose access is limited by supplier, recipient or
        the invoices they approve gets 403 forbidden, as do organizations
        without accounts payable. A member with access to some companies sees
        those companies’ invoices.
      operationId: getApFlowStatistics
      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; use dots for nested fields, such as
            headline.untouched_until_approval. Fields: computed_at, timezone,
            organization_currency, period, from, through, previous_from,
            previous_through, bucket_days, headline, funnel,
            top_first_touch_stage, stages, trend.
        - schema:
            type: string
            enum:
              - 7d
              - 30d
              - 13w
              - 52w
            default: 30d
            description: >-
              The last 7 or 30 days, 13 weeks or 52 weeks, ending the day before
              the figures were computed (yesterday before they ever were), in
              the organization’s timezone. Trend buckets are days, days, weeks
              and four-week blocks.
          required: false
          description: >-
            The last 7 or 30 days, 13 weeks or 52 weeks, ending the day before
            the figures were computed (yesterday before they ever were), in the
            organization’s timezone. Trend buckets are days, days, weeks and
            four-week blocks.
          name: period
          in: query
        - schema:
            type: array
            items:
              type: string
              format: uuid
            minItems: 1
            maxItems: 1000
            description: >-
              Only the invoices of these workspace companies. intake.stopped
              stays the whole workspace’s: a stopped document never became an
              invoice, so it has no company. Omit for every company the caller
              can access. An unknown or inaccessible company is 404.
          required: false
          description: >-
            Only the invoices of these workspace companies. intake.stopped stays
            the whole workspace’s: a stopped document never became an invoice,
            so it has no company. Omit for every company the caller can access.
            An unknown or inaccessible company is 404.
          style: form
          explode: false
          name: company_ids
          in: query
      responses:
        '200':
          description: How the invoices moved through the AP flow in the period.
          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/ApFlowStatistics'
        '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
        '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:
    ApFlowStatistics:
      type: object
      properties:
        computed_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            When the figures were rebuilt (every night); null until the
            organization has an invoice in them.
        timezone:
          type: string
        organization_currency:
          type: string
        period:
          type: string
          enum:
            - 7d
            - 30d
            - 13w
            - 52w
        from:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
          description: The period’s first day, in the organization’s timezone.
        through:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
          description: >-
            The period’s last day: the day before the figures were computed, or
            yesterday before they ever were.
        previous_from:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
        previous_through:
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}$
          description: The day before from.
        bucket_days:
          type: integer
          exclusiveMinimum: 0
          description: 'Days per trend bucket: 1, 7 or 28.'
        headline:
          type: object
          properties:
            untouched_until_approval:
              allOf:
                - $ref: '#/components/schemas/ApFlowShareChange'
                - description: Decided invoices no stage before approval touched.
            no_touch:
              allOf:
                - $ref: '#/components/schemas/ApFlowShareChange'
                - description: Decided invoices untouched in every measured stage.
            decision_time:
              type: object
              properties:
                current:
                  $ref: '#/components/schemas/ApFlowDuration'
                previous:
                  $ref: '#/components/schemas/ApFlowDuration'
                median_change_seconds:
                  type:
                    - integer
                    - 'null'
                  description: >-
                    current.median_seconds − previous.median_seconds: negative
                    is faster. Null when either has no invoices.
              required:
                - current
                - previous
                - median_change_seconds
              description: From received to decided.
            received:
              type: object
              properties:
                current:
                  type: integer
                  minimum: 0
                previous:
                  type: integer
                  minimum: 0
                change:
                  type:
                    - number
                    - 'null'
                  description: >-
                    (current − previous) / previous: 0.1 is 10 % more invoices.
                    Null when previous is 0.
              required:
                - current
                - previous
                - change
              description: Invoices received (first arrival) in the period.
            paid_on_time:
              allOf:
                - $ref: '#/components/schemas/ApFlowShareChange'
                - description: >-
                    Decided invoices the accounting system paid on or before the
                    due date, of those with both dates.
          required:
            - untouched_until_approval
            - no_touch
            - decision_time
            - received
            - paid_on_time
        funnel:
          type: array
          items:
            type: object
            properties:
              stage:
                type: string
                enum:
                  - intake
                  - reading
                  - match
                  - checks
                  - coding
                  - validation
                  - approval
                  - transfer
              passed:
                allOf:
                  - $ref: '#/components/schemas/ApFlowShare'
                  - description: >-
                      Untouched among the decided invoices the stage was
                      measured on.
              remaining:
                allOf:
                  - $ref: '#/components/schemas/ApFlowShare'
                  - description: >-
                      Decided invoices no stage up to and including this one
                      touched.
              first_touched:
                allOf:
                  - $ref: '#/components/schemas/ApFlowShare'
                  - description: >-
                      Decided invoices whose first touch was in this stage, of
                      all decided: what it took from the remaining share before
                      it.
              top_touch:
                allOf:
                  - $ref: '#/components/schemas/ApFlowTouch'
                  - type:
                      - object
                      - 'null'
                    description: The stage’s most common touch; null without one.
            required:
              - stage
              - passed
              - remaining
              - first_touched
              - top_touch
          description: The eight stages in flow order.
        top_first_touch_stage:
          type:
            - string
            - 'null'
          enum:
            - intake
            - reading
            - match
            - checks
            - coding
            - validation
            - null
          description: >-
            The stage before approval where the most decided invoices got their
            first touch, the earliest on a tie; null when no stage before
            approval touched one. Approval is left out: a person decides every
            invoice until the approval policy decides some.
        stages:
          $ref: '#/components/schemas/ApFlowStages'
        trend:
          type: array
          items:
            type: object
            properties:
              from:
                type: string
                pattern: ^\d{4}-\d{2}-\d{2}$
              through:
                type: string
                pattern: ^\d{4}-\d{2}-\d{2}$
              received:
                type: integer
                minimum: 0
              untouched_until_approval:
                allOf:
                  - $ref: '#/components/schemas/ApFlowShare'
                  - description: Decided invoices no stage before approval touched.
              no_touch:
                allOf:
                  - $ref: '#/components/schemas/ApFlowShare'
                  - description: Decided invoices untouched in every measured stage.
              decision_time:
                allOf:
                  - $ref: '#/components/schemas/ApFlowDuration'
                  - description: From received to decided.
              paid_on_time:
                allOf:
                  - $ref: '#/components/schemas/ApFlowShare'
                  - description: >-
                      Decided invoices the accounting system paid on or before
                      the due date, of those with both dates.
              passed:
                type: object
                properties:
                  intake:
                    $ref: '#/components/schemas/ApFlowShare'
                  reading:
                    $ref: '#/components/schemas/ApFlowShare'
                  match:
                    $ref: '#/components/schemas/ApFlowShare'
                  checks:
                    $ref: '#/components/schemas/ApFlowShare'
                  coding:
                    $ref: '#/components/schemas/ApFlowShare'
                  validation:
                    $ref: '#/components/schemas/ApFlowShare'
                  approval:
                    $ref: '#/components/schemas/ApFlowShare'
                  transfer:
                    $ref: '#/components/schemas/ApFlowShare'
                required:
                  - intake
                  - reading
                  - match
                  - checks
                  - coding
                  - validation
                  - approval
                  - transfer
                description: >-
                  Per stage, untouched among the decided invoices it was
                  measured on.
              remaining:
                type: object
                properties:
                  intake:
                    $ref: '#/components/schemas/ApFlowShare'
                  reading:
                    $ref: '#/components/schemas/ApFlowShare'
                  match:
                    $ref: '#/components/schemas/ApFlowShare'
                  checks:
                    $ref: '#/components/schemas/ApFlowShare'
                  coding:
                    $ref: '#/components/schemas/ApFlowShare'
                  validation:
                    $ref: '#/components/schemas/ApFlowShare'
                  approval:
                    $ref: '#/components/schemas/ApFlowShare'
                  transfer:
                    $ref: '#/components/schemas/ApFlowShare'
                required:
                  - intake
                  - reading
                  - match
                  - checks
                  - coding
                  - validation
                  - approval
                  - transfer
                description: >-
                  Per stage, decided invoices no stage up to and including it
                  touched.
            required:
              - from
              - through
              - received
              - untouched_until_approval
              - no_touch
              - decision_time
              - paid_on_time
              - passed
              - remaining
          description: >-
            Per bucket of bucket_days, oldest first, empty buckets included:
            invoices received in it, and the flow’s figures over the invoices
            decided in it.
      required:
        - computed_at
        - timezone
        - organization_currency
        - period
        - from
        - through
        - previous_from
        - previous_through
        - bucket_days
        - headline
        - funnel
        - top_first_touch_stage
        - stages
        - trend
    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_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
    ApFlowShareChange:
      type: object
      properties:
        current:
          allOf:
            - $ref: '#/components/schemas/ApFlowShare'
            - description: In the period.
        previous:
          allOf:
            - $ref: '#/components/schemas/ApFlowShare'
            - description: In the period of the same length right before it.
        change:
          type:
            - number
            - 'null'
          minimum: -1
          maximum: 1
          description: >-
            current.share − previous.share: 0.05 is five percentage points more.
            Null when either is not measured.
      required:
        - current
        - previous
        - change
      description: A share in the period and in the one before it.
    ApFlowDuration:
      type: object
      properties:
        median_seconds:
          type:
            - integer
            - 'null'
          description: Null without invoices.
        p90_seconds:
          type:
            - integer
            - 'null'
          description: 90th percentile. Null without invoices.
        invoices:
          type: integer
          minimum: 0
          description: The invoices it is measured on.
      required:
        - median_seconds
        - p90_seconds
        - invoices
      description: >-
        How long something took, in seconds, over the invoices it is measured
        on.
    ApFlowShare:
      type: object
      properties:
        count:
          type: integer
          minimum: 0
        of:
          type: integer
          minimum: 0
          description: What count is a share of. 0 means nothing was measured.
        share:
          type:
            - number
            - 'null'
          minimum: 0
          maximum: 1
          description: count / of; null when of is 0.
      required:
        - count
        - of
        - share
      description: 'A share: count of of, and their ratio.'
    ApFlowTouch:
      type: object
      properties:
        key:
          type: string
          description: >-
            What a person did, in the stage’s own terms. intake: retried,
            read_as_invoice or document_replaced. reading: a header or line
            field they corrected, line_added or line_removed. match:
            party_changed, or <kind>_removed / <kind>_added for agreement,
            credit_note or purchase_order. checks: a check type that raised
            alerts for a person, still pending ones included, as the stage
            counts them. coding: account, vat_code or dimension:<id>. approval:
            decided_by_person, approver_added_by_hand, approver_removed_by_hand
            or held. transfer: the latest send failure’s code.
        label:
          type:
            - string
            - 'null'
          description: The dimension’s name for a dimension key; else null.
        invoices:
          type: integer
          minimum: 0
          description: Decided invoices whose stage a person touched this way.
      required:
        - key
        - label
        - invoices
      description: A kind of touch in a stage, and the decided invoices it touched.
    ApFlowStages:
      type: object
      properties:
        intake:
          type: object
          properties:
            channels:
              type: array
              items:
                type: object
                properties:
                  channel:
                    type:
                      - string
                      - 'null'
                    enum:
                      - upload
                      - api
                      - email
                      - integration
                      - peppol
                      - null
                    description: Null when no source created the invoice.
                  received:
                    allOf:
                      - $ref: '#/components/schemas/ApFlowShare'
                      - description: Of the invoices received in the period.
                required:
                  - channel
                  - received
              description: >-
                The channels the invoices received in the period came through,
                most first.
            stopped:
              type:
                - array
                - 'null'
              items:
                type: object
                properties:
                  outcome:
                    type: string
                    enum:
                      - duplicate
                      - not_invoice
                      - reminder
                  documents:
                    type: integer
                    minimum: 0
                required:
                  - outcome
                  - documents
              description: >-
                Documents that arrived in the period and never became an invoice
                of their own, per outcome, for the whole workspace: they have no
                company. Null for a member with access to some companies only,
                who sees nothing without a company.
            passed:
              allOf:
                - $ref: '#/components/schemas/ApFlowShareChange'
                - description: >-
                    Untouched among the decided invoices the stage was measured
                    on; of 0 means not measured.
            touches:
              type: array
              items:
                $ref: '#/components/schemas/ApFlowTouch'
              description: Intake touches by kind, most first.
          required:
            - channels
            - stopped
            - passed
            - touches
        reading:
          type: object
          properties:
            graded:
              type: object
              properties:
                snapshot:
                  type: integer
                  minimum: 0
                  description: Graded against the invoice as first published.
                log:
                  type: integer
                  minimum: 0
                  description: 'Published before snapshots: graded against people’s edits.'
              required:
                - snapshot
                - log
              description: >-
                Decided invoices whose reading was graded, by basis; one
                Watchdog did not read from a document is not.
            lines:
              type: object
              properties:
                changed:
                  type: integer
                  minimum: 0
                added:
                  type: integer
                  minimum: 0
                removed:
                  type: integer
                  minimum: 0
              required:
                - changed
                - added
                - removed
              description: Lines people changed, added and removed on the graded invoices.
            fields:
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  part:
                    type: string
                    enum:
                      - header
                      - line
                  invoices:
                    type: integer
                    minimum: 0
                    description: Graded invoices a person corrected the field on.
                  per_thousand:
                    type: number
                    description: invoices per 1,000 graded invoices.
                required:
                  - field
                  - part
                  - invoices
                  - per_thousand
              description: The fields people corrected, most first.
            passed:
              allOf:
                - $ref: '#/components/schemas/ApFlowShareChange'
                - description: >-
                    Untouched among the decided invoices the stage was measured
                    on; of 0 means not measured.
          required:
            - graded
            - lines
            - fields
            - passed
        match:
          type: object
          properties:
            party_changed:
              type: integer
              minimum: 0
              description: Decided invoices whose supplier or recipient a person changed.
            recorded:
              type: integer
              minimum: 0
              description: >-
                Decided invoices whose match changes were recorded (published
                from 2026-11-11); links counts these.
            links:
              type: array
              items:
                type: object
                properties:
                  kind:
                    type: string
                    enum:
                      - agreement
                      - credit_note
                      - purchase_order
                  proposed:
                    type: integer
                    minimum: 0
                    description: Matches Watchdog proposed.
                  removed:
                    type: integer
                    minimum: 0
                    description: Proposed matches a person removed.
                  added:
                    type: integer
                    minimum: 0
                    description: Matches a person added by hand.
                  kept:
                    allOf:
                      - $ref: '#/components/schemas/ApFlowShare'
                      - description: Proposed matches still in place.
                required:
                  - kind
                  - proposed
                  - removed
                  - added
                  - kept
              description: Per link kind, always all three.
            passed:
              allOf:
                - $ref: '#/components/schemas/ApFlowShareChange'
                - description: >-
                    Untouched among the decided invoices the stage was measured
                    on; of 0 means not measured.
          required:
            - party_changed
            - recorded
            - links
            - passed
        checks:
          type: object
          properties:
            types:
              type: array
              items:
                type: object
                properties:
                  check_type:
                    type: string
                    enum:
                      - agreement
                      - purchase_order
                      - duplicate
                  raised:
                    type: integer
                    minimum: 0
                    description: >-
                      Live alerts raised for a person: pending + accepted +
                      dismissed + skipped.
                  pending:
                    type: integer
                    minimum: 0
                    description: Still to review.
                  accepted:
                    type: integer
                    minimum: 0
                    description: Confirmed.
                  dismissed:
                    type: integer
                    minimum: 0
                    description: False alarms.
                  skipped:
                    type: integer
                    minimum: 0
                    description: Unsure.
                  confirmed:
                    allOf:
                      - $ref: '#/components/schemas/ApFlowShare'
                      - description: >-
                          accepted of accepted + dismissed + skipped: the
                          reviewed ones.
                  accepted_amount:
                    type: string
                    pattern: ^-?\d+(?:\.\d+)?$
                    description: >-
                      The confirmed alerts’ impact in the organization currency,
                      excluding VAT.
                  dismissed_as:
                    type: array
                    items:
                      type: object
                      properties:
                        category:
                          type: string
                          enum:
                            - misread
                            - missing_context
                            - duplicate
                            - other
                        alerts:
                          type: integer
                          minimum: 0
                      required:
                        - category
                        - alerts
                    description: >-
                      False alarms by recorded reason; those without one are
                      left out.
                required:
                  - check_type
                  - raised
                  - pending
                  - accepted
                  - dismissed
                  - skipped
                  - confirmed
                  - accepted_amount
                  - dismissed_as
              description: Per check type that raised alerts, most first.
            passed:
              allOf:
                - $ref: '#/components/schemas/ApFlowShareChange'
                - description: >-
                    Untouched among the decided invoices the stage was measured
                    on; of 0 means not measured.
          required:
            - types
            - passed
        coding:
          type: object
          properties:
            fields:
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                    enum:
                      - account
                      - vat_code
                      - dimension
                  dimension_id:
                    type:
                      - string
                      - 'null'
                    format: uuid
                  name:
                    type:
                      - string
                      - 'null'
                    description: The dimension’s name; null for account and VAT code.
                  suggested:
                    type: integer
                    minimum: 0
                    description: Lines whose value Watchdog suggested and nobody changed.
                  confirmed:
                    type: integer
                    minimum: 0
                    description: Lines a person confirmed as suggested.
                  changed:
                    type: integer
                    minimum: 0
                    description: Lines a person changed from the suggestion.
                  manual:
                    type: integer
                    minimum: 0
                    description: Lines a person set without a suggestion.
                  kept:
                    allOf:
                      - $ref: '#/components/schemas/ApFlowShare'
                      - description: suggested + confirmed of all four.
                required:
                  - field
                  - dimension_id
                  - name
                  - suggested
                  - confirmed
                  - changed
                  - manual
                  - kept
              description: 'Per coding field: account, VAT code, then each dimension.'
            passed:
              allOf:
                - $ref: '#/components/schemas/ApFlowShareChange'
                - description: >-
                    Untouched among the decided invoices the stage was measured
                    on; of 0 means not measured.
          required:
            - fields
            - passed
        validation:
          type: object
          properties:
            passed:
              allOf:
                - $ref: '#/components/schemas/ApFlowShareChange'
                - description: >-
                    Untouched among the decided invoices the stage was measured
                    on; of 0 means not measured.
          required:
            - passed
          description: Not measured yet for any organization.
        approval:
          type: object
          properties:
            approved:
              type: integer
              minimum: 0
            rejected:
              type: integer
              minimum: 0
            decided_by:
              type: object
              properties:
                person:
                  type: integer
                  minimum: 0
                  description: A person decided.
                not_recorded:
                  type: integer
                  minimum: 0
                  description: >-
                    The decision names no one, as one carried over from before
                    approval requests.
              required:
                - person
                - not_recorded
            wait:
              allOf:
                - $ref: '#/components/schemas/ApFlowDuration'
                - description: From the first approver asked to the decision.
            approvers:
              type: object
              properties:
                added_by_rule:
                  type: integer
                  minimum: 0
                added_by_hand:
                  type: integer
                  minimum: 0
                removed_by_hand:
                  type: integer
                  minimum: 0
              required:
                - added_by_rule
                - added_by_hand
                - removed_by_hand
              description: >-
                Approvers added by an approval rule, added by hand and removed
                by hand.
            held:
              type: integer
              minimum: 0
              description: Invoices ever put on hold.
            passed:
              allOf:
                - $ref: '#/components/schemas/ApFlowShareChange'
                - description: >-
                    Untouched among the decided invoices the stage was measured
                    on; of 0 means not measured.
          required:
            - approved
            - rejected
            - decided_by
            - wait
            - approvers
            - held
            - passed
        transfer:
          type: object
          properties:
            approved:
              type: integer
              minimum: 0
              description: Decided invoices that were approved.
            outcomes:
              type: object
              properties:
                sent:
                  $ref: '#/components/schemas/ApFlowShare'
                in_accounting_system:
                  $ref: '#/components/schemas/ApFlowShare'
                not_sent:
                  $ref: '#/components/schemas/ApFlowShare'
              required:
                - sent
                - in_accounting_system
                - not_sent
              description: >-
                Where the approved invoices ended up: sent by Watchdog, in the
                accounting system already (from it, booked there or found
                there), or not sent.
            retried:
              type: integer
              minimum: 0
              description: Invoices sent more than once.
            failures:
              type: array
              items:
                type: object
                properties:
                  code:
                    type: string
                  invoices:
                    type: integer
                    minimum: 0
                required:
                  - code
                  - invoices
              description: Invoices by their latest send failure’s code, most first.
            passed:
              allOf:
                - $ref: '#/components/schemas/ApFlowShareChange'
                - description: >-
                    Untouched among the decided invoices the stage was measured
                    on; of 0 means not measured.
          required:
            - approved
            - outcomes
            - retried
            - failures
            - passed
      required:
        - intake
        - reading
        - match
        - checks
        - coding
        - validation
        - approval
        - transfer
  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.