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

# Preview an explicit check selection

> Read-only preview. Filters resolve the entire agreement collection, not a page. Topics select distinct invoice–agreement pairs, so replacement also affects other topics. Samples choose ten distinct invoices deterministically using the supplied seed. Oversized selections cannot execute.



## OpenAPI

````yaml /openapi-preview.json post /v1/check-selections/preview
openapi: 3.1.0
info:
  title: Watchdog API
  version: 1.0.0
  description: >-
    The Watchdog API is served from https://api-canary.watchdog.no until it
    moves to 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-canary.watchdog.no
    description: Watchdog API
security: []
paths:
  /v1/check-selections/preview:
    post:
      tags:
        - Compliance checks
      summary: Preview an explicit check selection
      description: >-
        Read-only preview. Filters resolve the entire agreement collection, not
        a page. Topics select distinct invoice–agreement pairs, so replacement
        also affects other topics. Samples choose ten distinct invoices
        deterministically using the supplied seed. Oversized selections cannot
        execute.
      operationId: previewCheckSelection
      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.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                selection:
                  $ref: '#/components/schemas/CheckSelection'
              required:
                - selection
              additionalProperties: false
      responses:
        '200':
          description: Exact scope, exclusions and confirmation fingerprint.
          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/CheckSelectionPreview'
        '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:
              schema:
                $ref: '#/components/schemas/Error_validation_error'
              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
        '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:
              schema:
                $ref: '#/components/schemas/Error_invalid_token'
              example:
                error:
                  code: invalid_token
                  message: The bearer token is missing or invalid.
                  request_id: req_example
        '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:
              schema:
                $ref: >-
                  #/components/schemas/Error_forbidden_token_disabled_organization_required_insufficient_role_mfa_required
              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
        '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:
              schema:
                $ref: '#/components/schemas/Error_not_found'
              example:
                error:
                  code: not_found
                  message: The resource does not exist in the current organization.
                  request_id: req_example
        '409':
          description: Scope is too large or cannot be retried.
          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/Error_conflict'
              example:
                error:
                  code: conflict
                  message: Scope is too large or cannot be retried.
                  request_id: req_example
        '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:
              schema:
                $ref: '#/components/schemas/Error_rate_limit_exceeded'
              example:
                error:
                  code: rate_limit_exceeded
                  message: >-
                    Too many requests. Wait for the Retry-After delay before
                    retrying.
                  request_id: req_example
        '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:
              schema:
                $ref: '#/components/schemas/Error_internal_error'
              example:
                error:
                  code: internal_error
                  message: >-
                    Unexpected server failure. Include the request ID when
                    contacting support.
                  request_id: req_example
        '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:
              schema:
                $ref: '#/components/schemas/Error_service_unavailable'
              example:
                error:
                  code: service_unavailable
                  message: >-
                    Temporarily unavailable. Retry after the Retry-After delay,
                    when provided.
                  request_id: req_example
      security:
        - ApiKeyBearer: []
components:
  schemas:
    CheckSelection:
      type: object
      properties:
        scope:
          oneOf:
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - agreements
                filter:
                  type: object
                  properties:
                    mine:
                      type: boolean
                      description: >-
                        Only records matched by the filters of teams you belong
                        to. Teams combine with OR; other filters combine with
                        AND. Cannot be combined with team_ids.
                    team_ids:
                      type: array
                      items:
                        type: string
                      minItems: 1
                      maxItems: 50
                      description: >-
                        Only records matched by the filters of these teams: at
                        most 50, comma-separated in a query string or an array
                        in a JSON body. Teams combine with OR. Unknown teams
                        return 404.
                    ids:
                      type: array
                      items:
                        type: string
                        format: uuid
                      minItems: 1
                      maxItems: 50
                      description: Only these agreement IDs (maximum 50).
                    renewal_action_kinds:
                      type: array
                      items:
                        type: string
                        enum:
                          - cancel_by
                          - renew_by
                          - automatic_notice
                          - missing_details
                          - none
                      minItems: 1
                      maxItems: 50
                    renewal_deadline_from:
                      type: string
                      pattern: ^\d{4}-\d{2}-\d{2}$
                      description: Renewal action deadline on or after this date.
                    renewal_deadline_through:
                      type: string
                      pattern: ^\d{4}-\d{2}-\d{2}$
                      description: Renewal action deadline on or before this date.
                    search:
                      type: string
                      minLength: 1
                      maxLength: 200
                      description: Text in the agreement title or a supplier name.
                    statuses:
                      type: array
                      items:
                        type: string
                        enum:
                          - draft
                          - active
                          - archived
                      minItems: 1
                      maxItems: 50
                    supplier_ids:
                      type: array
                      items:
                        type: string
                        format: uuid
                      minItems: 1
                      maxItems: 50
                      description: Agreements covering any of these suppliers.
                    recipient_ids:
                      type: array
                      items:
                        type: string
                        format: uuid
                      minItems: 1
                      maxItems: 50
                      description: >-
                        Agreements covering any of these recipients, including
                        agreements for any recipient.
                    tag_ids:
                      type: array
                      items:
                        type: string
                        format: uuid
                      minItems: 1
                      maxItems: 50
                      description: Agreements with any of these tags.
                    supplier_operator:
                      type: string
                      enum:
                        - is
                        - is_not
                    tag_operator:
                      type: string
                      enum:
                        - is
                        - is_not
                    join_operator:
                      type: string
                      enum:
                        - and
                        - or
                      description: >-
                        Combine supplier and tag ID filters with AND (default)
                        or OR. Other filters and the organization boundary
                        always apply.
                    has_alert_verdicts:
                      type: array
                      items:
                        type: string
                        enum:
                          - pending
                          - accepted
                          - dismissed
                      minItems: 1
                      maxItems: 50
                      description: >-
                        Agreements with at least one alert with any of these
                        verdicts. Combine with has_alert_credited to match both
                        on the same alert.
                    has_alert_credited:
                      type: boolean
                      description: >-
                        Agreements with at least one alert that is (true) or is
                        not (false) credited.
                    effective_from:
                      type: string
                      pattern: ^\d{4}-\d{2}-\d{2}$
                    effective_through:
                      type: string
                      pattern: ^\d{4}-\d{2}-\d{2}$
                    expiration_from:
                      type: string
                      pattern: ^\d{4}-\d{2}-\d{2}$
                    expiration_through:
                      type: string
                      pattern: ^\d{4}-\d{2}-\d{2}$
                    valid_on:
                      type: string
                      pattern: ^\d{4}-\d{2}-\d{2}$
                  additionalProperties: false
                agreement_ids:
                  type: array
                  items:
                    type: string
                    format: uuid
                  maxItems: 1000
                excluded_agreement_ids:
                  type: array
                  items:
                    type: string
                    format: uuid
                  maxItems: 1000
                  default: []
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - topics
                agreement_id:
                  type: string
                  format: uuid
                topic_ids:
                  type: array
                  items:
                    type: string
                    format: uuid
                  maxItems: 1000
                include_uncategorized:
                  type: boolean
                  default: false
              required:
                - type
                - agreement_id
                - topic_ids
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - retry
                workflow_run_id:
                  type: string
                  format: uuid
              required:
                - type
                - workflow_run_id
              additionalProperties: false
        mode:
          type: string
          enum:
            - outstanding
            - again
            - reset
          default: outstanding
        invoices:
          oneOf:
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - all
                excluded_invoice_ids:
                  type: array
                  items:
                    type: string
                    format: uuid
                  maxItems: 5000
                  default: []
                  description: Invoices left out of an otherwise complete selection.
              required:
                - type
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - sample
                seed:
                  type: string
                  format: uuid
                invoice_ids:
                  type: array
                  items:
                    type: string
                    format: uuid
                  maxItems: 10
                  description: >-
                    Invoice IDs returned by the preview, pinned until the user
                    changes the selection.
              required:
                - type
                - seed
              additionalProperties: false
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - selected
                invoice_ids:
                  type: array
                  items:
                    type: string
                    format: uuid
                  maxItems: 5000
              required:
                - type
                - invoice_ids
              additionalProperties: false
          default:
            type: all
            excluded_invoice_ids: []
        issued_from:
          type: string
          format: date
        issued_through:
          type: string
          format: date
      required:
        - scope
      additionalProperties: false
    CheckSelectionPreview:
      type: object
      properties:
        options:
          type: object
          properties:
            outstanding:
              type: object
              properties:
                invoice_count:
                  type: integer
                  description: >-
                    Every invoice this mode could check in the scope, before
                    exclusions or sampling.
                replaced_alert_count:
                  type: integer
                  description: >-
                    Current alerts that a successful check replaces, after
                    exclusions and sampling.
                handled_alert_count:
                  type: integer
                  description: The replaced alerts that are no longer pending.
              required:
                - invoice_count
                - replaced_alert_count
                - handled_alert_count
            again:
              type: object
              properties:
                invoice_count:
                  type: integer
                  description: >-
                    Every invoice this mode could check in the scope, before
                    exclusions or sampling.
                replaced_alert_count:
                  type: integer
                  description: >-
                    Current alerts that a successful check replaces, after
                    exclusions and sampling.
                handled_alert_count:
                  type: integer
                  description: The replaced alerts that are no longer pending.
              required:
                - invoice_count
                - replaced_alert_count
                - handled_alert_count
          required:
            - outstanding
            - again
          description: >-
            What each check mode would run in this scope, whichever mode is
            selected.
        fingerprint:
          type: string
        sample_invoice_ids:
          type:
            - array
            - 'null'
          items:
            type: string
            format: uuid
        agreements:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
              title:
                type:
                  - string
                  - 'null'
              reasons:
                type: array
                items:
                  type: string
                  enum:
                    - inactive
                    - missing_title
                    - missing_supplier
                    - missing_content
                    - documents_not_ready
              check_count:
                type: integer
            required:
              - id
              - title
              - reasons
              - check_count
        invoice_count:
          type: integer
        check_count:
          type: integer
        exceeds_limit:
          type: boolean
        maximum_checks:
          type: integer
        maximum_runs:
          type: integer
        exclusions:
          type: array
          items:
            type: object
            properties:
              reason:
                type: string
                enum:
                  - not_ready
                  - not_checkable
                  - claimed
                  - running
                  - completed
              count:
                type: integer
            required:
              - reason
              - count
        deletable_alert_count:
          type: integer
        kept_alert_count:
          type: integer
        kept_user_alert_count:
          type: integer
        cancelled_check_count:
          type: integer
        other_topic_alert_count:
          type: integer
      required:
        - options
        - fingerprint
        - sample_invoice_ids
        - agreements
        - invoice_count
        - check_count
        - exceeds_limit
        - maximum_checks
        - maximum_runs
        - exclusions
        - deletable_alert_count
        - kept_alert_count
        - kept_user_alert_count
        - cancelled_check_count
        - other_topic_alert_count
    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
  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).

````