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

# Update an alert

> Updates alert metadata, query, condition, notifiers, or enabled state. Query and condition changes restart the evaluation schedule; disabling stops it. Alert scope, `project_id`, and telemetry source are immutable.

> [!NOTE]
>
> **Guia relacionado**: Guia de alertas. Consulte o [Guia de alertas](/docs/pt-BR/ai-studio/observability/alerts.md) para ver um passo a passo com exemplos.


## OpenAPI

````yaml patch /v2/alerts/{alert_id}
openapi: 3.1.0
info:
  title: Toqan Router API
  version: '2.0'
  description: Toqan Router API documentation
servers:
  - url: https://router.toqan.ai/eu
    description: Frankfurt (Europe)
  - url: https://router.toqan.ai/br
    description: São Paulo (Brazil)
security:
  - ApiKey: []
tags:
  - description: >-
      API keys authenticate programmatic access to the workspace. They expose
      opaque tokens, per-domain access grants, and budget and rate-limit
      constraints.
    name: API keys
  - name: Logs
    description: >-
      OpenTelemetry log query API. Search, filter, aggregate, and facet log
      records ingested via OTLP.
  - name: Reporting
    description: >-
      GenAI reporting API over canonical analytics rollups. Accepts a metric
      name, time range, grain, group-by, and filters; returns a typed time
      series and optional totals.
  - name: Telemetry
    description: >-
      Unified query envelope for traces, metrics, and logs. One request shape,
      one filter dialect, and one response shape per source, validated by a
      per-source registry.
  - name: Traces
    description: >-
      Query and inspect ingested trace data: search trace summaries, aggregate
      metrics, and read individual traces and their spans.
  - name: Views
    description: Saved filters and columns for workspace observability pages.
  - description: List models available through the AI Router.
    name: Models
  - name: Alerts
    description: >-
      Alerts evaluate a telemetry metric on a fixed interval and fire
      notifications through notifiers when the value breaches a threshold. Each
      breach opens a trigger that tracks the incident until the value recovers.
  - name: Annotation Queues
    description: Annotation queues collect spans for human review.
  - name: Budgets
    description: >-
      Budgets govern spend, token usage, and request rate across six scopes:
      workspace, project, identity, API key, provider, and model. Every
      applicable budget is enforced, and the most restrictive limit applies per
      dimension.
  - name: Files
    description: File upload and retrieval operations.
  - name: Guardrail Rules
    description: >-
      Guardrail Rules conditionally enforce evaluators and plugins for AI
      Gateway traffic. Rules may be scoped to a project or the whole workspace.
  - name: Identities
    description: >-
      Identities represent end users from your system for usage and engagement
      tracking.
  - name: Management keys
    description: >-
      Management keys are workspace-scoped credentials that authenticate
      programmatic access to workspace administration surfaces (API keys,
      budgets). Unlike project-scoped API keys, a management key always operates
      at the workspace level.
  - name: MCP Gateway
    description: >-
      Register upstream MCP servers, discover and sync their tools, and assemble
      gateways that expose a curated tool surface to MCP clients.
  - name: Model Catalog
    description: >-
      Browse the Toqan Router model catalog: every model Toqan Router offers,
      across every provider, with pricing, capabilities and benchmark data. List
      endpoints only return models that are not deprecated. This API is public,
      requires no authentication, and is rate limited to 120 requests per minute
      per IP. Responses carry a 5-minute cache-control max-age.
  - name: Monitors
    description: >-
      Monitors are custom observability dashboards for traces, runtime metrics,
      and logs. Each monitor holds widgets that chart one telemetry query. List
      the metrics, operations, and dimensions available to your workspace with
      `GET /v3/telemetry/capabilities`, or start from a preset with `GET
      /v2/monitors/presets`.
  - name: Notifiers
    description: Notifier destinations used to send delivery and workflow notifications.
  - name: Routing Rules
    description: >-
      Routing Rules conditionally select models and enforce request plugins for
      AI Gateway traffic. Rules are evaluated by ascending priority and may be
      scoped to a project or the whole workspace.
  - name: Threads
    description: Threads group related trace invocations and their aggregate usage
  - name: Smart Routers
    description: >-
      Create and manage workspace Smart Routers. A Smart Router selects a model
      from an eligible pool for each request according to a quality, balanced,
      or cost profile.
  - name: Responses
  - name: Embeddings
  - description: Beta. Run typed classification questions against a classify model.
    name: Classify
  - description: Beta. Run classification decisions with the classify contract.
    name: Decisions
  - description: >-
      Run large offline workloads as JSONL batches and download
      OpenAI-compatible result files.
    name: Batches
paths:
  /v2/alerts/{alert_id}:
    patch:
      tags:
        - Alerts
      summary: Update an alert
      description: >-
        Updates alert metadata, query, condition, notifiers, or enabled state.
        Query and condition changes restart the evaluation schedule; disabling
        stops it. Alert scope, `project_id`, and telemetry source are immutable.
      operationId: AlertUpdate
      parameters:
        - name: alert_id
          in: path
          description: Alert ID to update.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAlertRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateAlertResponse'
        '401':
          description: >-
            Authentication required. See
            https://router.toqan.ai/docs/reference/errors for the error codes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKey: []
components:
  schemas:
    UpdateAlertRequest:
      required: []
      type: object
      properties:
        display_name:
          type: string
          description: New workspace-unique display name. Omit to keep the current name.
        description:
          type: string
          description: New description. Omit to keep the current description.
        signal:
          type: string
          description: New UI signal preset. Omit to keep the current value.
        query:
          allOf:
            - $ref: '#/components/schemas/AlertQuery'
          description: >-
            Replacement query. Metric, operation, and filters may change within
            the
             current telemetry source. Source changes require creating a new alert.
        condition:
          allOf:
            - $ref: '#/components/schemas/AlertCondition'
          description: Replacement condition. Omit to keep the current condition.
        notifier_ids:
          type: array
          items:
            type: string
          description: Replacement notifier set. Omit to keep the current notifiers.
        enabled:
          type: boolean
          description: New enabled state. Omit to keep the current state.
        display:
          allOf:
            - $ref: '#/components/schemas/AlertDisplay'
          description: Display options to merge. Omitted fields keep their current values.
    UpdateAlertResponse:
      required:
        - alert
      type: object
      properties:
        alert:
          allOf:
            - $ref: '#/components/schemas/Alert'
          description: Updated alert.
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Human-readable error message.
        code:
          type: integer
          description: Numeric error code, when one is available.
        details:
          type: array
          items: {}
          description: Additional error details, when the service reports any.
      required:
        - message
    AlertQuery:
      required:
        - metric
      type: object
      properties:
        metric:
          type: string
          description: >-
            Source-owned metric identifier. Trace metrics are validated against
            the
             Reporting catalogue; runtime metrics are validated against telemetry
             capabilities in the alert's scope.
        filters:
          type: array
          items:
            $ref: '#/components/schemas/MonitorFilter'
          description: Source-owned filters combined with AND.
        source:
          $ref: '#/components/schemas/AlertTelemetrySource'
          description: |-
            Telemetry source. Unspecified is accepted for compatibility and
             normalizes to traces when the alert is saved or read.
        operation:
          type: string
          description: |-
            Aggregation operation advertised by the selected metric capability.
             Existing trace queries may omit it; the server resolves their canonical
             Reporting operation.
    AlertCondition:
      required:
        - comparator
        - threshold
        - window
        - interval
      type: object
      properties:
        comparator:
          enum:
            - gt
            - gte
            - lt
            - lte
            - eq
          type: string
          description: Comparison applied as `value <comparator> threshold`.
        threshold:
          type: number
          description: |-
            Critical-tier threshold. Breaching it opens (or escalates) a
             trigger at critical severity.
          format: double
        degraded_threshold:
          type: number
          description: |-
            Optional degraded-tier threshold. Values past it but short of
             `threshold` open a trigger at degraded severity. Must sit on the
             recovery side of `threshold` for the chosen comparator and is not
             supported with `eq`.
          format: double
        resolve_threshold:
          type: number
          description: |-
            Optional custom resolve bound (hysteresis). An open trigger
             resolves only once the value recovers past this bound; defaults to
             the lowest configured tier. Must sit at or past that tier on the
             recovery side. Not supported with `eq`.
          format: double
        window:
          enum:
            - 5m
            - 15m
            - 30m
            - 1h
            - 4h
            - 1d
          type: string
          description: Look-back window aggregated on each evaluation tick.
        interval:
          enum:
            - 5m
            - 15m
            - 1h
            - 1d
          type: string
          description: How often the alert is evaluated. Plan limits may enforce a minimum.
        delay:
          enum:
            - 30s
            - 60s
            - 120s
            - 300s
            - 600s
          type: string
          description: >-
            Ingestion delay subtracted from the evaluation window. Defaults to
            `30s`.
    AlertDisplay:
      type: object
      properties:
        visualization:
          enum:
            - lines
            - bars
          type: string
          description: Chart style for the alert activity chart.
        preview_range:
          enum:
            - 1h
            - 4h
            - 1d
            - 7d
          type: string
          description: Default time range for the alert activity chart.
    Alert:
      required:
        - alert_id
        - display_name
        - description
        - scope
        - project_id
        - signal
        - query
        - condition
        - notifier_ids
        - enabled
        - status
        - created_at
        - updated_at
        - created_by_id
        - updated_by_id
      type: object
      properties:
        alert_id:
          type: string
          description: >-
            Unique alert identifier assigned by Toqan Router, for example
            `alert_01H...`.
             Use this value in retrieve, update, and delete requests.
        display_name:
          type: string
          description: Workspace-unique display name.
        description:
          type: string
          description: Short human-readable summary of what the alert watches.
        project_id:
          type: string
          description: >-
            Project that owns a project-scoped alert. Empty for workspace
            alerts. Immutable after creation.
        signal:
          enum:
            - cost
            - latency
            - errors
            - evals
            - custom
          type: string
          description: UI signal preset the alert was created from.
        query:
          allOf:
            - $ref: '#/components/schemas/AlertQuery'
          description: Metric query evaluated on each tick.
        condition:
          allOf:
            - $ref: '#/components/schemas/AlertCondition'
          description: Threshold condition applied to the query result.
        notifier_ids:
          type: array
          items:
            type: string
          description: |-
            Notifiers that receive trigger-open and trigger-resolve
             notifications.
        enabled:
          type: boolean
          description: |-
            Whether the alert is evaluated. Disabled alerts keep their trigger
             history but stop firing.
        status:
          enum:
            - ok
            - degraded
            - triggered
          type: string
          description: Current runtime status, maintained by the evaluation engine.
        last_triggered_at:
          type:
            - string
            - 'null'
          description: >-
            Time when the alert last opened a trigger. `null` until the alert
            first triggers.
          format: date-time
        recent_runs:
          type: array
          items:
            $ref: '#/components/schemas/AlertRun'
          description: |-
            Rolling window of the most recent evaluation ticks, oldest first.
             Maintained by the evaluation engine; read-only.
        created_at:
          type: string
          description: Time when the alert was created.
          format: date-time
        updated_at:
          type: string
          description: Time when the alert was last updated.
          format: date-time
        created_by_id:
          type: string
          description: User ID that created the alert.
        updated_by_id:
          type: string
          description: User ID that last updated the alert.
        display:
          description: >-
            Display options for the alert activity chart. `null` when none are
            saved.
          anyOf:
            - allOf:
                - $ref: '#/components/schemas/AlertDisplay'
            - type: 'null'
        scope:
          $ref: '#/components/schemas/AlertScope'
          description: Immutable ownership and telemetry evaluation boundary.
    MonitorFilter:
      required:
        - field
        - op
        - values
      type: object
      properties:
        field:
          type: string
          description: |-
            Reporting dimension to filter on. Valid fields depend on the
             metric; validated when the monitor is saved.
        op:
          enum:
            - eq
            - neq
            - in
            - not_in
            - gt
            - gte
            - lt
            - lte
            - between
            - contains
            - exists
            - not_exists
          type: string
          description: >-
            Predicate operator. `eq` and `neq` accept exactly one value; `in`
            and `not_in` accept 1-100 values.
        values:
          type: array
          items:
            type: string
          description: Values compared against the selected field.
    AlertTelemetrySource:
      type: string
      enum:
        - ALERT_TELEMETRY_SOURCE_TRACES
        - ALERT_TELEMETRY_SOURCE_METRICS
    AlertRun:
      required:
        - at
        - value
        - breached
        - has_data
      type: object
      properties:
        at:
          type: string
          description: Time of the evaluation tick.
          format: date-time
        value:
          type: number
          description: Observed metric value. Zero when `has_data` is false.
          format: double
        breached:
          type: boolean
          description: Whether the value breached the alert condition.
        has_data:
          type: boolean
          description: Whether the evaluation window contained any data.
        severity:
          enum:
            - critical
            - degraded
          type: string
          description: Tier the value landed in when breached. Empty when not breached.
    AlertScope:
      type: string
      enum:
        - ALERT_SCOPE_PROJECT
        - ALERT_SCOPE_WORKSPACE
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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