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

# Generate alert recommendations

> Recommends alert rules for the project from its traffic and streams the progress and every recommendation
as soon as it is decided, as `application/x-ndjson`. The result is stored: it replaces the project's
earlier recommendations and is what `GET /observe/alertRecommendations` returns.

What is recommended: `forecast_kpi` rules on the flows counted and the success rate of every flow type the
project has 5-minute data for. A KPI is recommended when it has at least about five flows per 5-minute
bucket on each of the last 7 complete days: its rule over all flows, and a rule grouped by each of its at
most three best dimensions (application, browser, operating system or a custom tag). A dimension is a good
grouping when at least two of its groups have enough flows on every day to be judged, those groups hold at
least half of the flows and no group holds 90% or more; dimensions whose groups would hide a drop in the
whole (groups below 30% of the flows) rank first. Rules the project has already (same type, KPI and
grouping, however tuned) and dismissed recommendations are left out.

Every recommendation is then simulated with the rule type's defaults over the last 1 or 2 days, as the
rule form simulates, in the order of the list, as long as the generation's simulation budget (20,000
forecasts) and its time limit (10 minutes) last. A grouped rule whose groups do not fit is simulated in its
largest groups only (`simulation.topGroups`). The rest are returned with `status` `not_simulated` and a
reason; the rule form simulates them on request.

Events, one JSON object per line: `started` first (with `run`), `progress` as phases advance (repeated
while nothing else happens, so the connection never idles), `recommendation` for each recommendation,
and `finished` (with `run`) or `error` last. Closing the connection cancels the generation; its partial
results are discarded.

One generation per project runs at a time (409), and a project may start one 10 minutes after its last
finished at the earliest (429 with `Retry-After`); the stored recommendations are what to show meanwhile.
When the service runs as many generations as it may, it answers 429 too.

Required API key permission: `observe:alerts:write`.



## OpenAPI

````yaml /api-reference/openapi/observe.yaml post /observe/alertRecommendations/generate
openapi: 3.1.1
info:
  version: 1.0.0
  title: Corbado API
  description: >
    # Introduction

    This documentation gives an overview of all Corbado API calls to implement
    authentication observe.
  contact:
    name: Corbado team
    email: support@corbado.com
    url: https://www.corbado.com
servers:
  - url: https://api.cloud.corbado.io/v1
security:
  - bearerAuth: []
tags:
  - name: ObserveFlow
    description: Flow search and related APIs
    x-group: Journeys and users
  - name: ObserveSubFlow
    description: Subflow search and related APIs
    x-group: Journeys and users
  - name: ObserveUser
    description: User search and related APIs
    x-group: Journeys and users
  - name: ObserveIdentifier
    description: Identifier search over submitted identifiers
    x-group: Journeys and users
  - name: ObservePasskeyIntelligence
    description: Passkey login predictions and support diagnosis
    x-group: Passkey Intelligence
  - name: ObserveClientEnv
    description: Client environment search APIs
    x-group: Journeys and users
  - name: ObserveTimeSeries
    description: Time series query APIs
    x-group: Metrics and funnels
  - name: ObserveFunnel
    description: Historical funnel metrics, dictionaries and coverage.
    x-group: Metrics and funnels
  - name: ObserveEvent
    description: Event ingestion and event feed APIs
    x-group: Events
  - name: ObserveError
    description: Named authentication errors.
    x-group: Error management
  - name: ObserveErrorFlavour
    description: Error variants and their impact on authentication outcomes.
    x-group: Error management
  - name: ObserveErrorModel
    description: >-
      The Observe error model, imported as one bundle file per version (Corbado
      internal)
  - name: ObserveFinding
    description: Curated findings that explain errors, their impact and who has to act.
    x-group: Error management
  - name: ObserveAlert
    description: Authentication alert rules, instances and history.
    x-group: Alert management
  - name: ObserveAnnotation
    description: >-
      Annotations, the project's memory (what is true about the data and how to
      read it)
    x-group: Annotations
  - name: ObserveTableExport
    description: Table export file listing and download APIs
    x-group: Data exports
  - name: ObserveTimeSeriesExport
    description: Time-series export generation and downloads.
    x-group: Data exports
  - name: ObserveDataExport
    description: Data export APIs
    x-group: User data
  - name: ObserveDataDeletionJob
    description: Data deletion job APIs
    x-group: User data
  - name: ObserveFlowTypeDefinition
    description: Flow type definitions used in authentication journeys.
    x-group: Catalogs and labels
  - name: ObserveCatalog
    description: Catalog APIs
    x-group: Catalogs and labels
  - name: ObserveSavedFilter
    description: >-
      Saved filters, named flow filters a project stores once and applies by
      reference
    x-group: Saved filters
  - name: OpenAPI
    description: Downloadable API specification
  - name: ProjectOperationExecution
    description: Project-scoped operation history and pipeline health
  - name: ObserveClassification
    description: Flow and subflow classification APIs
  - name: ObserveIntegrationStats
    description: Integration stats APIs
  - name: ObserveTimeSeriesPrecalculation
    description: Time series precalculation APIs
  - name: ObserveIDList
    x-group: Saved ID lists
    description: Stored ID-list selection APIs
  - name: ObserveDataContext
    description: Schema-loose data context APIs for agent and debugging tooling
  - name: ObserveData
    description: Observe data administration APIs
  - name: ObserveTrackingStats
    description: Tracking ingestion stats APIs
  - name: ObserveProbe
    description: Raw probe capture items (internal autocapture diagnostics)
  - name: ObserveTelemetry
    description: Raw SDK/integration diagnostic telemetry
  - name: ObserveExperiment
    x-group: Experiments
    description: Experiment catalog and run APIs
  - name: ObserveDataPolicy
    description: >-
      Project data policy catalogue (retention selected by the SDK's
      meta.dataPolicy code)
  - name: ObserveMetadata
    x-group: Metadata
    description: Authenticator metadata APIs
  - name: ObserveSri
    description: Subresource Integrity hashes of the scripts Corbado hosts for a project
  - name: ObserveAutocapture
    description: >-
      Autocapture builds, candidates and releases, registered by Corbado's
      delivery pipeline
  - name: ObserveNotification
    description: >-
      Who is notified about what happens in a project, e.g. autocapture
      releases, and how it was delivered
  - name: ObservePasskey
    x-group: Passkey analysis
    description: Observed passkey search and cohort analysis.
paths:
  /observe/alertRecommendations/generate:
    post:
      tags:
        - ObserveAlert
      summary: Generate alert recommendations
      description: >-
        Recommends alert rules for the project from its traffic and streams the
        progress and every recommendation

        as soon as it is decided, as `application/x-ndjson`. The result is
        stored: it replaces the project's

        earlier recommendations and is what `GET /observe/alertRecommendations`
        returns.


        What is recommended: `forecast_kpi` rules on the flows counted and the
        success rate of every flow type the

        project has 5-minute data for. A KPI is recommended when it has at least
        about five flows per 5-minute

        bucket on each of the last 7 complete days: its rule over all flows, and
        a rule grouped by each of its at

        most three best dimensions (application, browser, operating system or a
        custom tag). A dimension is a good

        grouping when at least two of its groups have enough flows on every day
        to be judged, those groups hold at

        least half of the flows and no group holds 90% or more; dimensions whose
        groups would hide a drop in the

        whole (groups below 30% of the flows) rank first. Rules the project has
        already (same type, KPI and

        grouping, however tuned) and dismissed recommendations are left out.


        Every recommendation is then simulated with the rule type's defaults
        over the last 1 or 2 days, as the

        rule form simulates, in the order of the list, as long as the
        generation's simulation budget (20,000

        forecasts) and its time limit (10 minutes) last. A grouped rule whose
        groups do not fit is simulated in its

        largest groups only (`simulation.topGroups`). The rest are returned with
        `status` `not_simulated` and a

        reason; the rule form simulates them on request.


        Events, one JSON object per line: `started` first (with `run`),
        `progress` as phases advance (repeated

        while nothing else happens, so the connection never idles),
        `recommendation` for each recommendation,

        and `finished` (with `run`) or `error` last. Closing the connection
        cancels the generation; its partial

        results are discarded.


        One generation per project runs at a time (409), and a project may start
        one 10 minutes after its last

        finished at the earliest (429 with `Retry-After`); the stored
        recommendations are what to show meanwhile.

        When the service runs as many generations as it may, it answers 429 too.


        Required API key permission: `observe:alerts:write`.
      operationId: ObserveAlertRecommendationGenerate
      responses:
        '200':
          description: Newline-delimited JSON stream of the generation's events.
          content:
            application/x-ndjson:
              schema:
                $ref: '#/components/schemas/observeAlertRecommendationEvent'
        default:
          $ref: '#/components/responses/error'
      security:
        - bearerAuth:
            - observe:alerts:write
components:
  schemas:
    observeAlertRecommendationEvent:
      type: object
      description: One line of a generation's stream.
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - started
            - progress
            - recommendation
            - finished
            - error
          description: >-
            `started` comes first, `progress` as the phases advance (repeated
            while nothing else is sent),

            `recommendation` once per recommendation, and either `finished` or
            `error` last.
        phase:
          type: string
          enum:
            - score
            - simulate
          description: >-
            The phase a progress event counts: `score` counts the rule types
            scored, `simulate` the

            recommendations decided.
        done:
          type: integer
          description: Done so far in the phase (progress events).
        total:
          type: integer
          description: To do in the phase (progress events).
        run:
          $ref: '#/components/schemas/observeAlertRecommendationRun'
        recommendation:
          $ref: '#/components/schemas/observeAlertRecommendation'
        message:
          type: string
          description: Why the generation failed (error events).
    observeAlertRecommendationRun:
      type: object
      description: One generation of recommendations.
      required:
        - id
        - status
        - startedMs
        - candidates
        - recommendations
        - simulated
        - forecastsUsed
        - budget
      properties:
        id:
          type: string
          description: Generation ID (format `arr-<number>`).
        status:
          type: string
          enum:
            - running
            - succeeded
            - partial
            - failed
            - canceled
          description: >-
            `succeeded`: every recommendation was simulated; `partial`: some
            were not (budget, time limit, no

            simulation available); `failed` and `canceled` (the connection was
            closed) keep no recommendations.
        startedMs:
          type: integer
          format: int64
        finishedMs:
          type: integer
          format: int64
          description: When the generation finished; absent while it runs.
        candidates:
          type: integer
          description: >-
            Rules recommended, before simulation; dismissed ones and those the
            project has are not counted.
        recommendations:
          type: integer
          description: Recommendations stored.
        simulated:
          type: integer
          description: Recommendations simulated.
        skippedExisting:
          type: integer
          description: >-
            Recommendations left out because the project has a rule watching the
            same (finished events only).
        skippedDismissed:
          type: integer
          description: >-
            Recommendations left out because they were dismissed (finished
            events only).
        forecastsUsed:
          type: integer
          description: Forecasts the simulations made.
        budget:
          type: integer
          description: Forecasts the simulations of one generation may make.
    observeAlertRecommendation:
      type: object
      required:
        - key
        - ruleType
        - rule
        - label
        - position
        - status
        - variant
        - days
        - perSlot
        - coverage
        - dimensions
        - daily
        - groups
      properties:
        key:
          type: string
          description: >-
            Identifies what the rule watches (type, KPI, grouping), however it
            is tuned; what dismissing names.
        ruleType:
          type: string
          enum:
            - relative_flow_count
            - relative_subflow_count
            - absolute_flow_count
            - relative_kpi
            - absolute_kpi
            - forecast_kpi
        rule:
          $ref: '#/components/schemas/observeAlertRuleConfig'
        label:
          type: string
          description: The rule's name for a list, e.g. "Login · Success rate by Country".
        position:
          type: integer
          description: Order in the list, 0 first.
        status:
          type: string
          enum:
            - simulated
            - not_simulated
        notSimulatedReason:
          type: string
          enum:
            - budget
            - deadline
            - unavailable
            - too_expensive
            - failed
          description: >-
            Why it was not simulated: the generation's simulation budget or time
            limit ran out, the rule type

            cannot be simulated here, it has more groups than a simulation
            takes, or its simulation failed.
        variant:
          type: string
          description: >-
            The rule type's variant, the flow type of a `forecast_kpi` rule's
            KPI.
        dimension:
          type: string
          description: The dimension the rule groups by; absent for a rule over all flows.
        dimensionName:
          type: string
        days:
          type: integer
          description: The days the traffic was measured over.
        perSlot:
          type: number
          format: double
          description: >-
            Flows per 5-minute bucket on average over those days, all groups
            together.
        coverage:
          $ref: '#/components/schemas/observeAlertRecommendationCoverage'
        dimensions:
          type: array
          description: >-
            For a rule over all flows: how every dimension it could be grouped
            by scored, recommended or not.

            Empty for a grouped rule.
          items:
            $ref: '#/components/schemas/observeAlertRecommendationDimension'
        fromMs:
          type: integer
          format: int64
          description: >-
            Start of the days the traffic was measured over (midnight in the
            project's time zone); absent for

            recommendations generated before it was recorded.
        toMs:
          type: integer
          format: int64
          description: End of the days the traffic was measured over (exclusive).
        daily:
          type: array
          description: >-
            Flows per measured day, all groups together, oldest first (`days`
            entries).
          items:
            type: number
            format: double
        dailyRate:
          type: array
          x-go-type: '[]*float64'
          description: >-
            For a rate KPI: its rate in percent per measured day, all groups
            together; null on a day without flows.

            Absent for a count KPI.
          items:
            type:
              - number
              - 'null'
            format: double
        groups:
          type: array
          description: >-
            For a grouped rule: its largest groups by flows, at most 20, largest
            first, then one entry summing the

            rest (`otherGroups`) when there are more. Empty for a rule over all
            flows.
          items:
            $ref: '#/components/schemas/observeAlertRecommendationGroup'
        simulation:
          $ref: '#/components/schemas/observeAlertRecommendationSimulation'
    errorRspV2:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            message:
              description: Error message
              type: string
              example: Validation failed
            details:
              description: Validation error details per field
              type: array
              items:
                type: object
                required:
                  - field
                  - message
                properties:
                  field:
                    description: Field name that failed validation
                    type: string
                    example: projectID
                  message:
                    description: Validation error message
                    type: string
                    example: required
    observeAlertRuleConfig:
      type: object
      description: >
        The configuration of an alert rule: the generic envelope every rule type
        shares, plus one settings object belonging to the rule type named by
        type. Everything outside settings is implemented once, generically - the
        window is resolved and handed to the rule type as two absolute
        timestamps, and the conditions are applied to whatever number the rule
        type returned, so a rule type never sees the thresholds.

        Shape and vocabulary are validated here. The semantics that span fields
        - that the bands get stricter as the level does, that recovery sits on
        the lenient side of them, that the window is a whole number of days, and
        that groupBy names dimensions this project actually has - are validated
        when the rule is saved and again when it is evaluated, because only the
        second catches a project that changed after the rule was written.
      required:
        - version
        - type
        - window
        - conditions
      properties:
        version:
          type: integer
          minimum: 1
          maximum: 1
          description: >-
            Config schema version. Only 1 exists; a stored rule carries it so a
            later shape change can be migrated rather than guessed at.
          x-oapi-codegen-extra-tags:
            validate: required,oneof=1
        type:
          type: string
          enum:
            - relative_flow_count
            - relative_subflow_count
            - absolute_flow_count
            - relative_kpi
            - absolute_kpi
            - forecast_kpi
          description: >
            The rule type this config belongs to. Must equal the rule's ruleType
            - the two are stored separately and the evaluator reads the column
            to pick the implementation, so letting them disagree would store a
            rule whose settings belong to one type and whose evaluation belongs
            to another.
          x-oapi-codegen-extra-tags:
            validate: >-
              required,oneof=relative_flow_count relative_subflow_count
              absolute_flow_count relative_kpi absolute_kpi forecast_kpi
        window:
          type: string
          description: >
            How much history the value covers - "5m", "1h", "3d". Go duration
            syntax extended with "d" and "w". relative_flow_count,
            relative_subflow_count, absolute_flow_count and relative_kpi take
            one of their offered windows (1m to 1h) and slide with the
            evaluation instant. The window ends a type-specific delay behind the
            evaluation instant, so the data it covers has arrived; that delay is
            not configurable.
          x-oapi-codegen-extra-tags:
            validate: required
        groupBy:
          type: array
          maxItems: 10
          description: >
            Dimension keys to alert separately by: one alert instance per
            combination of values, each with its own state and its own for
            clock. Keys are dimension names as reported by the rule type for
            this project, never columns or tag slots - a project that reorders
            its tags must not silently regroup a rule onto whatever now sits in
            that position. Empty means one ungrouped instance.
          items:
            type: string
          x-oapi-codegen-extra-tags:
            validate: omitempty,unique,dive,required
        filters:
          type: array
          maxItems: 50
          description: >
            Label sets to count exclusively: data is read only where its
            dimension values equal one of the entries, every pair of it. Each
            entry names every groupBy dimension, no more and no fewer - the same
            shape as an override's match - so one entry allows exactly one
            alert. Alerts outside the entries are never created; empty or absent
            means no filtering. Requires a groupBy, and two identical entries
            are rejected. Only relative_flow_count, relative_subflow_count,
            absolute_flow_count and relative_kpi rules support filters so far.
          items:
            type: object
            additionalProperties:
              type: string
        maxInstances:
          type: integer
          minimum: 1
          maximum: 500
          description: >-
            Cardinality cap for a grouped rule. Exceeding it is an error rather
            than a truncation, so a rule cannot quietly stop covering part of
            its groups. Defaults to 50.
          x-oapi-codegen-extra-tags:
            validate: omitempty,min=1,max=500
        settings:
          type: object
          additionalProperties: true
          description: >
            Settings belonging to type, opaque to the envelope. For
            relative_flow_count this is
            observeAlertRuleSettingsRelativeFlowCount, for
            relative_subflow_count observeAlertRuleSettingsRelativeSubflowCount,
            for absolute_flow_count observeAlertRuleSettingsAbsoluteFlowCount,
            for relative_kpi observeAlertRuleSettingsRelativeKpi, for
            absolute_kpi observeAlertRuleSettingsAbsoluteKpi, for forecast_kpi
            observeAlertRuleSettingsForecastKpi. This field stays open rather
            than a union, so a rule type can be added without a breaking change
            to this schema.
        conditions:
          type: array
          minItems: 1
          maxItems: 3
          description: >
            The severity bands, most severe matching band wins. All conditions
            must compare in the same direction, each level may appear at most
            once, and a more severe band must breach later than a less severe
            one. An equality band stands alone. There is no rule-level severity;
            each condition carries its own level.
          items:
            $ref: '#/components/schemas/observeAlertRuleCondition'
          x-oapi-codegen-extra-tags:
            validate: required,min=1,max=3,dive
        recovery:
          $ref: '#/components/schemas/observeAlertRuleRecovery'
        for:
          type: string
          description: >
            How long a group must stay breached before it fires, measured per
            instance from its own first breach - e.g. "1d". Omit to fire on the
            first breaching evaluation.
        noData:
          type: string
          enum:
            - ok
            - no_data
            - alerting
            - keep_last
          description: >
            What an instance does when its group produces no value. Defaults to
            no_data, which is visible in the panel and sends nothing - where
            keep_last would hold a firing alert firing forever and ok would
            quietly resolve one.
          x-oapi-codegen-extra-tags:
            validate: omitempty,oneof=ok no_data alerting keep_last
        evaluationHours:
          $ref: '#/components/schemas/observeAlertHours'
        overrides:
          type: array
          description: >
            Exceptions to the rule for particular alerts. An override's match is
            a complete label set - one value for every groupBy key - and it
            applies to exactly the alert with that label set. The alert is
            judged by the override's values instead of the rule's, field by
            field: a field the override sets replaces the rule's wholesale, a
            field it leaves out is inherited. Editing overrides never touches an
            alert's identity or history - the new values simply apply at the
            next evaluation. Requires groupBy; no cap on the count.
          items:
            $ref: '#/components/schemas/observeAlertRuleOverride'
          x-oapi-codegen-extra-tags:
            validate: omitempty,dive
    observeAlertRecommendationCoverage:
      type: object
      description: >-
        How a grouping's groups split the flows: "watches `alertableGroups` of
        `groups` groups, `coveredShare` of

        the flows". A group is alertable with about five flows per 5-minute
        bucket on average and flows on every

        day; the others stay without a value in the rule. A rule over all flows
        has one group.
      required:
        - groups
        - alertableGroups
        - coveredShare
        - largestShare
        - hiddenShare
      properties:
        groups:
          type: integer
        alertableGroups:
          type: integer
        coveredShare:
          type: number
          format: double
          description: Share of the flows (0 to 1) in alertable groups.
        largestShare:
          type: number
          format: double
          description: Share of the flows in the largest group.
        hiddenShare:
          type: number
          format: double
          description: >-
            Share of the flows in alertable groups below 30% of the flows each,
            whose drops hardly show in the whole.
    observeAlertRecommendationDimension:
      type: object
      required:
        - dimension
        - name
        - coverage
        - recommended
      properties:
        dimension:
          type: string
        name:
          type: string
        coverage:
          $ref: '#/components/schemas/observeAlertRecommendationCoverage'
        recommended:
          type: boolean
        reason:
          type: string
          enum:
            - no_volume
            - too_few_alertable_groups
            - low_coverage
            - one_dominant_group
            - too_many_groups
            - ranked_lower
          description: Why it was not recommended.
    observeAlertRecommendationGroup:
      type: object
      description: >-
        One group of a grouped rule over the measured days, or the sum of the
        groups not listed.
      required:
        - value
        - perSlot
        - share
        - daysPresent
        - alertable
        - daily
      properties:
        value:
          type: string
          description: >-
            The group's value of the dimension; empty for the entry summing the
            rest.
        otherGroups:
          type: integer
          description: Only on the entry summing the rest, how many groups it sums.
        otherAlertableGroups:
          type: integer
          description: Only on the entry summing the rest, how many of them are alertable.
        perSlot:
          type: number
          format: double
          description: Flows per 5-minute bucket on average over the measured days.
        share:
          type: number
          format: double
          description: Share of the flows (0 to 1).
        daysPresent:
          type: integer
          description: Measured days with flows.
        alertable:
          type: boolean
          description: >-
            Whether the rule judges the group: about five flows per 5-minute
            bucket on average and flows on every

            day. False for the entry summing the rest.
        daily:
          type: array
          description: Flows per measured day, oldest first.
          items:
            type: number
            format: double
        dailyRate:
          type: array
          x-go-type: '[]*float64'
          description: >-
            For a rate KPI, its rate in percent per measured day; null on a day
            without flows.
          items:
            type:
              - number
              - 'null'
            format: double
        fired:
          type: integer
          description: >-
            How often an alert fired for the group in the simulation; absent
            when the recommendation was not simulated

            or the simulation did not cover the group (`topGroups`).
        firedPerHour:
          type: array
          items:
            type: integer
          description: >-
            How often an alert fired for the group per hour of the simulated
            range, oldest first, as the simulation's

            `firedPerHour`; the entry summing the rest sums its groups. Absent
            like `fired`.
    observeAlertRecommendationSimulation:
      type: object
      description: What the simulation found, e.g. "5 firings in 2 days (FR 3, BR 2)".
      required:
        - fired
        - days
        - groups
        - refinementComplete
        - forecasts
      properties:
        fired:
          type: integer
          description: How often an alert fired.
        days:
          type: integer
          description: The days simulated.
        topGroups:
          type: integer
          description: >-
            The simulation covered only this many groups, the largest; absent
            when it covered every group.
        fromMs:
          type: integer
          format: int64
          description: >-
            Start of the simulated range; absent for recommendations simulated
            before it was recorded.
        toMs:
          type: integer
          format: int64
          description: End of the simulated range (exclusive).
        firedPerHour:
          type: array
          description: >-
            How often an alert fired per hour of the simulated range, all groups
            together, oldest first.
          items:
            type: integer
        groups:
          type: array
          description: The groups that fired, at most 20, most firings first.
          items:
            $ref: '#/components/schemas/observeAlertRecommendationSimulationGroup'
        refinementComplete:
          type: boolean
          description: >-
            False when a limit stopped the simulation from refining its data
            (see Simulate alert rule).
        forecasts:
          type: integer
          description: The forecasts the simulation made.
    observeAlertRuleCondition:
      type: object
      description: >-
        One severity band - a comparison against a threshold that yields a
        level.
      required:
        - severity
        - operator
        - threshold
      properties:
        severity:
          type: string
          enum:
            - info
            - warning
            - critical
          description: >-
            The severity this band produces. It belongs to the condition rather
            than to the rule, so an alert may fire at warning and escalate to
            critical without changing identity.
          x-oapi-codegen-extra-tags:
            validate: required,oneof=info warning critical
        operator:
          type: string
          enum:
            - above
            - above_or_equal
            - below
            - below_or_equal
            - equal
            - not_equal
          description: How the rule's value is compared against threshold.
          x-oapi-codegen-extra-tags:
            validate: >-
              required,oneof=above above_or_equal below below_or_equal equal
              not_equal
        threshold:
          type: number
          format: double
          description: >-
            The value the band compares against. Zero is a meaningful threshold,
            so this field carries no required-value validation of its own.
    observeAlertRuleRecovery:
      type: object
      description: >
        An optional separate threshold a firing instance must clear before it
        resolves. Without one a rule can fire and resolve at the same value,
        which is the flapping this exists to prevent, so it must compare in the
        opposite direction to the conditions and sit on the lenient side of the
        least severe band.
      required:
        - operator
        - threshold
      properties:
        operator:
          type: string
          enum:
            - above
            - above_or_equal
            - below
            - below_or_equal
            - equal
            - not_equal
          x-oapi-codegen-extra-tags:
            validate: >-
              required,oneof=above above_or_equal below below_or_equal equal
              not_equal
        threshold:
          type: number
          format: double
    observeAlertHours:
      type: object
      description: >
        A weekly schedule, used in two places. It is read in the project's
        timezone, looked up each time the schedule is checked, so changing the
        project's timezone moves the schedule along. Only an override's
        evaluationHours may set a timezone of their own.

        As a contact point's deliveryHours it is when the contact point's
        integrations may deliver. A notification that falls outside these hours
        is not sent, and not sent later either; the alert's state is recorded
        all the same. Omit on create to deliver at any time, omit on update to
        keep the current hours.

        As a rule's evaluationHours it is when the rule's alerts are evaluated
        at all. Outside these hours an alert gets no value, with noDataReason
        outside_evaluation_hours, and the no-data policy does not apply: a
        firing alert stays firing, a pending alert returns to normal so its for
        period starts again, and nothing is notified. Set on an override, it
        replaces the rule's hours for that alert and may set a timezone, e.g.
        Australia/Sydney for an alert on Australia; mode always evaluates that
        alert at any time. Omit to evaluate at any time (on an override: to
        inherit the rule's hours).
      required:
        - mode
      properties:
        mode:
          type: string
          enum:
            - always
            - scheduled
          x-enum-varnames:
            - ObserveAlertHoursModeAlways
            - ObserveAlertHoursModeScheduled
          x-oapi-codegen-extra-tags:
            validate: required,oneof=always scheduled
          description: >-
            always is open at any time and takes no timezone or ranges;
            scheduled is open only inside ranges.
        timezone:
          type: string
          description: >
            IANA timezone the ranges are read in, e.g. Australia/Sydney. Only on
            an override's evaluationHours, and optional there; omit it to use
            the project's timezone. Delivery hours and a rule's own
            evaluationHours always use the project's timezone and reject this
            field.
          x-oapi-codegen-extra-tags:
            validate: omitempty,max=64
        ranges:
          type: array
          maxItems: 10
          description: Required when mode is scheduled.
          items:
            $ref: '#/components/schemas/observeAlertHoursRange'
          x-oapi-codegen-extra-tags:
            validate: omitempty,max=10,dive
    observeAlertRuleOverride:
      type: object
      description: >
        One exception to a rule: an alert's label set and a sparse patch of the
        per-alert fields. Only fields the evaluator and the rule type apply per
        alert can be set here - what shapes the read (window, groupBy,
        maxInstances) is one value per rule.
      required:
        - match
      properties:
        match:
          type: object
          additionalProperties:
            type: string
          description: >
            The alert's label set: one exact value for every one of the rule's
            groupBy keys, no more and no fewer. An override applies to exactly
            the alert carrying this label set. Two overrides with the same match
            are rejected.
        conditions:
          type: array
          minItems: 1
          maxItems: 3
          description: >
            The complete band set for matching alerts, validated by the same
            rules as the rule's own conditions and against the recovery
            threshold that applies (this override's, or the rule's when
            inherited). Omit to inherit the rule's bands.
          items:
            $ref: '#/components/schemas/observeAlertRuleCondition'
          x-oapi-codegen-extra-tags:
            validate: omitempty,min=1,max=3,dive
        recovery:
          $ref: '#/components/schemas/observeAlertRuleRecovery'
        for:
          type: string
          description: >-
            Pending period for matching alerts, e.g. "3h". "0s" is a value -
            fire on the first breaching evaluation - and omitting it inherits
            the rule's.
        noData:
          type: string
          enum:
            - ok
            - no_data
            - alerting
            - keep_last
          description: No-data policy for matching alerts. Omit to inherit the rule's.
          x-oapi-codegen-extra-tags:
            validate: omitempty,oneof=ok no_data alerting keep_last
        settings:
          type: object
          additionalProperties: true
          description: >
            The complete settings object of the rule type for matching alerts.
            Replaces the rule's settings wholesale rather than merging into
            them. Omit to inherit the rule's. For relative_flow_count,
            relative_subflow_count and relative_kpi an override may only set
            minExpected, for absolute_kpi only minSample, and an
            absolute_flow_count override sets no settings at all; the other
            settings shape the one read a rule makes.
        evaluationHours:
          $ref: '#/components/schemas/observeAlertHours'
    observeAlertRecommendationSimulationGroup:
      type: object
      required:
        - labels
        - fired
      properties:
        labels:
          type: object
          additionalProperties:
            type: string
        fired:
          type: integer
    observeAlertHoursRange:
      type: object
      description: >
        One block of time within a day, on some weekdays. start is before end;
        end is exclusive and may be 24:00, so a whole day is 00:00-24:00. Times
        are on a 15-minute step.
      required:
        - weekdays
        - start
        - end
      properties:
        weekdays:
          type: array
          minItems: 1
          maxItems: 7
          items:
            type: string
            enum:
              - mon
              - tue
              - wed
              - thu
              - fri
              - sat
              - sun
            x-enum-varnames:
              - ObserveAlertHoursRangeWeekdaysMon
              - ObserveAlertHoursRangeWeekdaysTue
              - ObserveAlertHoursRangeWeekdaysWed
              - ObserveAlertHoursRangeWeekdaysThu
              - ObserveAlertHoursRangeWeekdaysFri
              - ObserveAlertHoursRangeWeekdaysSat
              - ObserveAlertHoursRangeWeekdaysSun
          x-oapi-codegen-extra-tags:
            validate: required,min=1,max=7,dive,oneof=mon tue wed thu fri sat sun
        start:
          type: string
          description: Start time, HH:MM.
          example: '09:00'
          x-oapi-codegen-extra-tags:
            validate: required,min=5,max=5
        end:
          type: string
          description: End time, HH:MM, exclusive. 24:00 runs to the end of the day.
          example: '18:00'
          x-oapi-codegen-extra-tags:
            validate: required,min=5,max=5
  responses:
    error:
      description: Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errorRspV2'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Use an Observe API key from the management console. The key selects the
        project and must grant the permission listed on the operation. Keep this
        key on your server.

````

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