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

# Total alert amounts, overall or per supplier, agreement, topic or month

> Counts the alerts matching the requested filters and totals their impact amounts, per currency and in the organization currency, for example the uncredited amount of pending alerts with verdicts=pending&credited=false. Use these totals when assessing the full selection; a single page of alerts may show only part of it. Add group_by to also get the same totals per agreement, supplier, topic, claim, verdict or invoice issue month, such as the overcharged amount per supplier or per month. Pass a group's key to the matching filter (agreement_ids, supplier_ids, topic_ids, claim_ids or verdicts) to list its alerts or its subgroups; for a month key (YYYY-MM), set issued_from and issued_through to the first and last day of that month.



## OpenAPI

````yaml /openapi.json get /v1/alerts/metrics
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/alerts/metrics:
    get:
      tags:
        - Alerts
      summary: Total alert amounts, overall or per supplier, agreement, topic or month
      description: >-
        Counts the alerts matching the requested filters and totals their impact
        amounts, per currency and in the organization currency, for example the
        uncredited amount of pending alerts with
        verdicts=pending&credited=false. Use these totals when assessing the
        full selection; a single page of alerts may show only part of it. Add
        group_by to also get the same totals per agreement, supplier, topic,
        claim, verdict or invoice issue month, such as the overcharged amount
        per supplier or per month. Pass a group's key to the matching filter
        (agreement_ids, supplier_ids, topic_ids, claim_ids or verdicts) to list
        its alerts or its subgroups; for a month key (YYYY-MM), set issued_from
        and issued_through to the first and last day of that month.
      operationId: getAlertMetrics
      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
            counts.pending. Fields: total_count, invoice_count, counts,
            currencies, organization_currency, groups, next_cursor.
        - schema:
            type: array
            items:
              type: string
          required: false
          style: form
          explode: false
          name: view_ids
          in: query
        - schema:
            type: array
            items:
              type: string
          required: false
          style: form
          explode: false
          name: claim_ids
          in: query
        - schema:
            type: boolean
            description: Attached to a claim now.
          required: false
          description: Attached to a claim now.
          name: has_claim
          in: query
        - schema:
            type: array
            items:
              type: string
              enum:
                - pending
                - in_progress
                - completed
                - cancelled
            description: Of the current claim.
          required: false
          description: Of the current claim.
          style: form
          explode: false
          name: claim_statuses
          in: query
        - schema:
            type: array
            items:
              type: string
              format: uuid
          required: false
          style: form
          explode: false
          name: invoice_ids
          in: query
        - schema:
            type: array
            items:
              type: string
              format: uuid
            description: >-
              Alerts on invoices of these workspace companies: a company scope,
              applied to every alert whatever join_operator says.
          required: false
          description: >-
            Alerts on invoices of these workspace companies: a company scope,
            applied to every alert whatever join_operator says.
          style: form
          explode: false
          name: company_ids
          in: query
        - schema:
            type: array
            items:
              type: string
              format: uuid
          required: false
          style: form
          explode: false
          name: agreement_ids
          in: query
        - schema:
            type: array
            items:
              type: string
              format: uuid
            description: Alerts of purchase-order checks against these orders.
          required: false
          description: Alerts of purchase-order checks against these orders.
          style: form
          explode: false
          name: purchase_order_ids
          in: query
        - schema:
            type: array
            items:
              type: string
              enum:
                - draft
                - active
                - archived
          required: false
          style: form
          explode: false
          name: agreement_statuses
          in: query
        - schema:
            type: array
            items:
              type: string
              format: uuid
          required: false
          style: form
          explode: false
          name: supplier_ids
          in: query
        - schema:
            type: array
            items:
              type: string
              format: uuid
          required: false
          style: form
          explode: false
          name: recipient_ids
          in: query
        - schema:
            type: array
            items:
              type: string
              format: uuid
            description: Tags of the agreement.
          required: false
          description: Tags of the agreement.
          style: form
          explode: false
          name: tag_ids
          in: query
        - schema:
            type: array
            items:
              type: string
          required: false
          style: form
          explode: false
          name: topic_ids
          in: query
        - schema:
            type: boolean
          required: false
          name: has_topic
          in: query
        - schema:
            type: array
            items:
              type: string
              enum:
                - agreement
                - purchase_order
                - duplicate
          required: false
          style: form
          explode: false
          name: check_types
          in: query
        - schema:
            type: array
            items:
              type: string
              enum:
                - pending
                - accepted
                - dismissed
                - skipped
            description: >-
              Whatever the credit. pending: to review; accepted: confirmed;
              dismissed: false alarm; skipped: unsure. Reviewed: all but
              pending.
          required: false
          description: >-
            Whatever the credit. pending: to review; accepted: confirmed;
            dismissed: false alarm; skipped: unsure. Reviewed: all but pending.
          style: form
          explode: false
          name: verdicts
          in: query
        - schema:
            type: boolean
            description: Whatever the verdict.
          required: false
          description: Whatever the verdict.
          name: credited
          in: query
        - schema:
            type: array
            items:
              type: string
              enum:
                - certain
                - uncertain
                - 'null'
          required: false
          style: form
          explode: false
          name: confidence_levels
          in: query
        - schema:
            type: array
            items:
              type: string
              pattern: ^[A-Z]{3}$
          required: false
          style: form
          explode: false
          name: currency_codes
          in: query
        - schema:
            type: array
            items:
              type: string
              enum:
                - modify_item
                - modify_invoice
                - add_item
          required: false
          style: form
          explode: false
          name: correction_types
          in: query
        - schema:
            type: string
            enum:
              - current
              - older
            description: >-
              The alert assessed the current agreement version or an older one;
              an unknown version or no agreement matches neither.
          required: false
          description: >-
            The alert assessed the current agreement version or an older one; an
            unknown version or no agreement matches neither.
          name: agreement_version_status
          in: query
        - schema:
            type: string
            enum:
              - live
              - invalidated
              - all
            description: >-
              live (default): alerts that count; invalidated: those that stopped
              (invalidation.reason says why). Alerts in claims named by
              claim_ids are included either way.
          required: false
          description: >-
            live (default): alerts that count; invalidated: those that stopped
            (invalidation.reason says why). Alerts in claims named by claim_ids
            are included either way.
          name: validity
          in: query
        - schema:
            type: string
            maxLength: 100
            pattern: ^-?\d+(?:\.\d+)?$
            description: >-
              Impact in the organization currency, inclusive. Alerts without one
              never match.
          required: false
          description: >-
            Impact in the organization currency, inclusive. Alerts without one
            never match.
          name: impact_min
          in: query
        - schema:
            type: string
            maxLength: 100
            pattern: ^-?\d+(?:\.\d+)?$
          required: false
          name: impact_max
          in: query
        - schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
            description: Invoice issue date.
          required: false
          description: Invoice issue date.
          name: issued_from
          in: query
        - schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          required: false
          name: issued_through
          in: query
        - schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          required: false
          name: created_from
          in: query
        - schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          required: false
          name: created_through
          in: query
        - schema:
            type: string
            minLength: 1
            maxLength: 200
            description: >-
              Alert, invoice, supplier, agreement and topic text. A UUID matches
              the alert, invoice, supplier or agreement ID.
          required: false
          description: >-
            Alert, invoice, supplier, agreement and topic text. A UUID matches
            the alert, invoice, supplier or agreement ID.
          name: search
          in: query
        - schema:
            type: string
            enum:
              - and
              - or
            description: >-
              or combines only the invoice, agreement, supplier, recipient and
              topic IDs.
          required: false
          description: >-
            or combines only the invoice, agreement, supplier, recipient and
            topic IDs.
          name: join_operator
          in: query
        - schema:
            type: array
            items:
              type: string
              enum:
                - claim_ids
                - claim_statuses
                - invoice_ids
                - agreement_ids
                - purchase_order_ids
                - agreement_statuses
                - supplier_ids
                - recipient_ids
                - tag_ids
                - topic_ids
                - check_types
                - verdicts
                - confidence_levels
                - currency_codes
                - correction_types
            description: List filters to invert.
          required: false
          description: List filters to invert.
          style: form
          explode: false
          name: not
          in: query
        - schema:
            type: boolean
            default: false
            description: Also count distinct invoices. Slower on large selections.
          required: false
          description: Also count distinct invoices. Slower on large selections.
          name: include_invoice_count
          in: query
        - schema:
            type: string
            enum:
              - agreement
              - supplier
              - topic
              - claim
              - verdict
              - month
            description: >-
              Also return the totals per agreement, supplier, topic, claim,
              verdict or invoice issue month in groups, one page at a time.
          required: false
          description: >-
            Also return the totals per agreement, supplier, topic, claim,
            verdict or invoice issue month in groups, one page at a time.
          name: group_by
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 50
          required: false
          name: limit
          in: query
        - schema:
            type: string
            maxLength: 4096
          required: false
          name: cursor
          in: query
        - schema:
            type: string
            enum:
              - impact_amount
              - pending_accepted_impact_amount
              - total_count
              - title
              - key
            default: impact_amount
            description: >-
              Group order, with group_by. impact_amount sorts by
              organization-currency impact. pending_accepted_impact_amount sorts
              by the organization-currency impact of the alerts to review or
              confirmed, credited or not (by_verdict pending plus accepted), so
              false alarms and unsure alerts add nothing. key sorts by the group
              key, so months in calendar order.
          required: false
          description: >-
            Group order, with group_by. impact_amount sorts by
            organization-currency impact. pending_accepted_impact_amount sorts
            by the organization-currency impact of the alerts to review or
            confirmed, credited or not (by_verdict pending plus accepted), so
            false alarms and unsure alerts add nothing. key sorts by the group
            key, so months in calendar order.
          name: sort
          in: query
        - schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
          required: false
          name: direction
          in: query
      responses:
        '200':
          description: >-
            Alert counts and amounts per currency and in the organization
            currency, for the same filters as the alert list, and with group_by
            a page of groups.
          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/AlertMetricsResult'
        '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: >-
            One or more selected Views have invalid saved filter rules. Update
            the View filters 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.
          content:
            application/json:
              example:
                error:
                  code: conflict
                  message: >-
                    One or more selected Views have invalid saved filter rules.
                    Update the View filters before retrying.
                  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:
    AlertMetricsResult:
      allOf:
        - $ref: '#/components/schemas/AlertMetrics'
        - type: object
          properties:
            groups:
              type: array
              items:
                $ref: '#/components/schemas/AlertGroup'
              description: >-
                With group_by: a page of groups, each with the same totals for
                its alerts.
            next_cursor:
              type:
                - string
                - 'null'
              description: >-
                With group_by: the cursor for the next page of groups; null at
                the end.
    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
    AlertMetrics:
      type: object
      properties:
        total_count:
          type: integer
        invoice_count:
          type:
            - integer
            - 'null'
          description: >-
            Distinct invoices among the matching alerts. Null unless
            include_invoice_count is true.
        counts:
          type: object
          properties:
            pending:
              type: object
              properties:
                credited:
                  type: integer
                  minimum: 0
                uncredited:
                  type: integer
                  minimum: 0
              required:
                - credited
                - uncredited
            accepted:
              type: object
              properties:
                credited:
                  type: integer
                  minimum: 0
                uncredited:
                  type: integer
                  minimum: 0
              required:
                - credited
                - uncredited
            dismissed:
              type: object
              properties:
                credited:
                  type: integer
                  minimum: 0
                uncredited:
                  type: integer
                  minimum: 0
              required:
                - credited
                - uncredited
            skipped:
              type: object
              properties:
                credited:
                  type: integer
                  minimum: 0
                uncredited:
                  type: integer
                  minimum: 0
              required:
                - credited
                - uncredited
          required:
            - pending
            - accepted
            - dismissed
            - skipped
          description: Alerts by verdict, each split into credited and uncredited alerts.
        currencies:
          type: array
          items:
            type: object
            properties:
              currency_code:
                type: string
              alert_count:
                type: integer
              impact_amount:
                type: string
                pattern: ^-?\d+(?:\.\d+)?$
                description: >-
                  Sum of the alerts’ impacts; alerts without an impact add
                  nothing.
              by_verdict:
                type: object
                properties:
                  pending:
                    type: object
                    properties:
                      credited:
                        type: object
                        properties:
                          alert_count:
                            type: integer
                          impact_amount:
                            type: string
                            pattern: ^-?\d+(?:\.\d+)?$
                            description: >-
                              Sum of the alerts’ impacts; alerts without an
                              impact add nothing.
                        required:
                          - alert_count
                          - impact_amount
                      uncredited:
                        type: object
                        properties:
                          alert_count:
                            type: integer
                          impact_amount:
                            type: string
                            pattern: ^-?\d+(?:\.\d+)?$
                            description: >-
                              Sum of the alerts’ impacts; alerts without an
                              impact add nothing.
                        required:
                          - alert_count
                          - impact_amount
                    required:
                      - credited
                      - uncredited
                  accepted:
                    type: object
                    properties:
                      credited:
                        type: object
                        properties:
                          alert_count:
                            type: integer
                          impact_amount:
                            type: string
                            pattern: ^-?\d+(?:\.\d+)?$
                            description: >-
                              Sum of the alerts’ impacts; alerts without an
                              impact add nothing.
                        required:
                          - alert_count
                          - impact_amount
                      uncredited:
                        type: object
                        properties:
                          alert_count:
                            type: integer
                          impact_amount:
                            type: string
                            pattern: ^-?\d+(?:\.\d+)?$
                            description: >-
                              Sum of the alerts’ impacts; alerts without an
                              impact add nothing.
                        required:
                          - alert_count
                          - impact_amount
                    required:
                      - credited
                      - uncredited
                  dismissed:
                    type: object
                    properties:
                      credited:
                        type: object
                        properties:
                          alert_count:
                            type: integer
                          impact_amount:
                            type: string
                            pattern: ^-?\d+(?:\.\d+)?$
                            description: >-
                              Sum of the alerts’ impacts; alerts without an
                              impact add nothing.
                        required:
                          - alert_count
                          - impact_amount
                      uncredited:
                        type: object
                        properties:
                          alert_count:
                            type: integer
                          impact_amount:
                            type: string
                            pattern: ^-?\d+(?:\.\d+)?$
                            description: >-
                              Sum of the alerts’ impacts; alerts without an
                              impact add nothing.
                        required:
                          - alert_count
                          - impact_amount
                    required:
                      - credited
                      - uncredited
                  skipped:
                    type: object
                    properties:
                      credited:
                        type: object
                        properties:
                          alert_count:
                            type: integer
                          impact_amount:
                            type: string
                            pattern: ^-?\d+(?:\.\d+)?$
                            description: >-
                              Sum of the alerts’ impacts; alerts without an
                              impact add nothing.
                        required:
                          - alert_count
                          - impact_amount
                      uncredited:
                        type: object
                        properties:
                          alert_count:
                            type: integer
                          impact_amount:
                            type: string
                            pattern: ^-?\d+(?:\.\d+)?$
                            description: >-
                              Sum of the alerts’ impacts; alerts without an
                              impact add nothing.
                        required:
                          - alert_count
                          - impact_amount
                    required:
                      - credited
                      - uncredited
                required:
                  - pending
                  - accepted
                  - dismissed
                  - skipped
                description: >-
                  Impact in the original currency by verdict, each split into
                  credited and uncredited alerts.
            required:
              - currency_code
              - alert_count
              - impact_amount
              - by_verdict
        organization_currency:
          type: object
          properties:
            currency_code:
              type: string
              description: The organization's reporting currency from its settings.
            impact_amount:
              type: string
              pattern: ^-?\d+(?:\.\d+)?$
            by_verdict:
              type: object
              properties:
                pending:
                  type: object
                  properties:
                    credited:
                      type: object
                      properties:
                        alert_count:
                          type: integer
                        impact_amount:
                          type: string
                          pattern: ^-?\d+(?:\.\d+)?$
                          description: >-
                            Sum of the alerts’ impacts; alerts without an impact
                            add nothing.
                      required:
                        - alert_count
                        - impact_amount
                    uncredited:
                      type: object
                      properties:
                        alert_count:
                          type: integer
                        impact_amount:
                          type: string
                          pattern: ^-?\d+(?:\.\d+)?$
                          description: >-
                            Sum of the alerts’ impacts; alerts without an impact
                            add nothing.
                      required:
                        - alert_count
                        - impact_amount
                  required:
                    - credited
                    - uncredited
                accepted:
                  type: object
                  properties:
                    credited:
                      type: object
                      properties:
                        alert_count:
                          type: integer
                        impact_amount:
                          type: string
                          pattern: ^-?\d+(?:\.\d+)?$
                          description: >-
                            Sum of the alerts’ impacts; alerts without an impact
                            add nothing.
                      required:
                        - alert_count
                        - impact_amount
                    uncredited:
                      type: object
                      properties:
                        alert_count:
                          type: integer
                        impact_amount:
                          type: string
                          pattern: ^-?\d+(?:\.\d+)?$
                          description: >-
                            Sum of the alerts’ impacts; alerts without an impact
                            add nothing.
                      required:
                        - alert_count
                        - impact_amount
                  required:
                    - credited
                    - uncredited
                dismissed:
                  type: object
                  properties:
                    credited:
                      type: object
                      properties:
                        alert_count:
                          type: integer
                        impact_amount:
                          type: string
                          pattern: ^-?\d+(?:\.\d+)?$
                          description: >-
                            Sum of the alerts’ impacts; alerts without an impact
                            add nothing.
                      required:
                        - alert_count
                        - impact_amount
                    uncredited:
                      type: object
                      properties:
                        alert_count:
                          type: integer
                        impact_amount:
                          type: string
                          pattern: ^-?\d+(?:\.\d+)?$
                          description: >-
                            Sum of the alerts’ impacts; alerts without an impact
                            add nothing.
                      required:
                        - alert_count
                        - impact_amount
                  required:
                    - credited
                    - uncredited
                skipped:
                  type: object
                  properties:
                    credited:
                      type: object
                      properties:
                        alert_count:
                          type: integer
                        impact_amount:
                          type: string
                          pattern: ^-?\d+(?:\.\d+)?$
                          description: >-
                            Sum of the alerts’ impacts; alerts without an impact
                            add nothing.
                      required:
                        - alert_count
                        - impact_amount
                    uncredited:
                      type: object
                      properties:
                        alert_count:
                          type: integer
                        impact_amount:
                          type: string
                          pattern: ^-?\d+(?:\.\d+)?$
                          description: >-
                            Sum of the alerts’ impacts; alerts without an impact
                            add nothing.
                      required:
                        - alert_count
                        - impact_amount
                  required:
                    - credited
                    - uncredited
              required:
                - pending
                - accepted
                - dismissed
                - skipped
              description: >-
                Counts and impact by verdict, each split into credited and
                uncredited alerts.
          required:
            - currency_code
            - impact_amount
            - by_verdict
          description: >-
            Impact in the organization currency: the sum of the alerts’
            converted impacts.
      required:
        - total_count
        - invoice_count
        - counts
        - currencies
        - organization_currency
    AlertGroup:
      allOf:
        - $ref: '#/components/schemas/AlertMetrics'
        - type: object
          properties:
            group_by:
              type: string
              enum:
                - agreement
                - supplier
                - topic
                - claim
                - verdict
                - month
            key:
              type:
                - string
                - 'null'
              description: >-
                The group's filter value: an agreement, supplier, topic or claim
                ID, a verdict, or the invoice issue month as YYYY-MM (select it
                with issued_from and issued_through set to its first and last
                day). Null means no supplier, topic, claim or issue date.
            resource:
              type:
                - object
                - 'null'
              properties:
                id:
                  type: string
                  format: uuid
                title:
                  type:
                    - string
                    - 'null'
              required:
                - id
                - title
              description: >-
                The agreement, supplier, topic or claim of the group, with its
                current title or name. Null for verdict and month groups, and
                for alerts without one.
          required:
            - group_by
            - key
            - resource
  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.