---
title: "Update Alert"
method: PUT
path: "/v1/projects/{project_id}/alerts/{alert_id}/"
tags: ["Projects", "Alerts"]
---

# Update Alert

`PUT /v1/projects/{project_id}/alerts/{alert_id}/`

## Request

- Base URL: `https://logfire-api.pydantic.dev/api`
- URL: `https://logfire-api.pydantic.dev/api/v1/projects/{project_id}/alerts/{alert_id}/`
- Auth: OAuth 2
  - Authorization code: `api/oauth/authorize`
  - Token URL: `/api/oauth/token` scopes: `project:write_alert`
- TypeScript: <https://skmtc.dev/pydantic/apis/pydantic-logfire-api/docs/v1/projects/:project_id/alerts/:alert_id/put.ts> (a function with typed inputs; its response is checked against the schema)

Update an alert.

## Path parameters

- `alert_id` string, uuid, required
- `project_id` string, uuid, required

## Request body

- AlertUpdate: The fields that can be updated on an alert.
  - `name` string
  - `description` string
  - `time_window` string, duration
  - `frequency` string, duration
  - `watermark` string, duration
  - `active` boolean
  - `query` string
  - `channel_ids` string[], nullable: Legacy shorthand for assigning channels without schedules.
  - `channel_assignments` AlertChannelAssignment[]: Schedule-aware channel configuration. When both `channel_assignments` and `channel_ids` are provided, `channel_assignments` is used.
    - `channel_id` string, uuid, required
    - `schedule_id` string, uuid, nullable
  - `notify_when` 'has_matches' | 'has_matches_changed' | 'matches_changed' | 'starts_having_matches'
  - `environments` string[]
  - `instance_policy` AlertInstancePolicy: Track each result row as its own occurrence, keyed by the values of the identity columns. Identity column names are unique. `continuity_runs` is deprecated and ignored by settlement, and at least `missing_runs`.
    - `identity_columns` string[], required: Result columns whose values identify an occurrence. Names must be unique.
    - `pending_runs` integer, required: Consecutive matching runs before a new occurrence fires.
    - `missing_runs` integer, required: Consecutive runs without the occurrence before it closes.
    - `missing_behavior` 'no_longer_matching' | 'expire', required: The close reason of an occurrence that is missing for `missing_runs` runs.
    - `continuity_runs` integer, required: Deprecated and ignored by settlement: runs that fail or are skipped never close an occurrence. Still required and stored for compatibility, and changing it still counts as a configuration change. At least `missing_runs`.

## Response `200`

Successful Response

- AlertSaveResult: A created or updated alert, with the result of the save check of its query.
  - `id` string, uuid, required
  - `organization_id` string, uuid, required
  - `project_id` string, uuid, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, nullable, required
  - `created_by_name` string, nullable, required
  - `updated_by_name` string, nullable, required
  - `name` string, required
  - `description` string, nullable, required
  - `query` string, required
  - `time_window` string, duration, required
  - `frequency` string, duration, required
  - `watermark` string, duration, required
  - `environments` string[], required
  - `channels` AlertChannelRead[], required
    - `id` string, uuid, required
    - `organization_id` string, uuid, required
    - `label` string, required
    - `active` boolean, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, nullable, required
    - `created_by_name` string, nullable, required
    - `updated_by_name` string, nullable, required
    - `config` union, required
      - Webhook
        - `type` 'webhook', required
        - `format` 'auto' | 'slack-blockkit' | 'slack-legacy' | 'raw-data', required
        - `url` string, required
      - Opsgenie
        - `type` 'opsgenie', required
        - `auth_key` string, required
        - `base_url` string
      - Pagerduty: Pages via the PagerDuty Events API v2 using a service integration's routing key. `region` selects the events endpoint (`events.pagerduty.com` vs `events.eu.pagerduty.com`); routing keys only work on the region their PagerDuty account is hosted in.
        - `type` 'pagerduty', required
        - `routing_key` string, required
        - `region` 'us' | 'eu'
      - PagerdutyIntegration: Pages a service selected from a PagerDuty App installation. The persisted channel references the selected service relationally. `install_id` and `service_id` form the API representation used to select that service, whose encrypted Events API key is resolved immediately before delivery.
        - `type` 'pagerduty-integration', required
        - `install_id` string, uuid, required
        - `service_id` string, uuid, required
      - Notification
        - `type` 'notification', required
        - `recipients` string[], required
      - SlackIntegration: Posts to a channel of a customer's installed Slack App (the `external_installations` integration). Unlike `webhook` (a bearer-capable incoming-webhook URL), this stores no secret: `install_id` points at the install whose encrypted bot token the worker decrypts at send time, and `channel_id` is the Slack channel the bot must already be a member of.
        - `type` 'slack-integration', required
        - `install_id` string, uuid, required
        - `channel_id` string, required
        - `include_agent_prompt` boolean: Whether Slack App notifications include an agent investigation prompt.
      - Email
        - `type` 'email', required
        - `recipients` string[], required
      - WebPush: Sends a browser notification to every device the named members turned push on for. Recipients are members rather than devices: a person, not a laptop, is who an alert is addressed to, and which of their devices are registered is theirs to change from their own settings without editing anyone's alert. A member with no registered device receives nothing, exactly as a muted one does.
        - `type` 'web-push', required
        - `recipients` string[], required
    - `schedule_id` string, uuid, nullable, required
  - `channel_assignments` AlertChannelAssignmentRead[], required: The channels in `channels`, in the shape that create and update accept as `channel_assignments`, sorted by `channel_id`.
    - `channel_id` string, uuid, required
    - `schedule_id` string, uuid, nullable, required
  - `notify_when` 'has_matches' | 'has_matches_changed' | 'matches_changed' | 'starts_having_matches', required
  - `active` boolean, required
  - `slo_id` string, uuid, nullable
  - `instance_policy` AlertInstancePolicy: Track each result row as its own occurrence, keyed by the values of the identity columns. Identity column names are unique. `continuity_runs` is deprecated and ignored by settlement, and at least `missing_runs`.
    - `identity_columns` string[], required: Result columns whose values identify an occurrence. Names must be unique.
    - `pending_runs` integer, required: Consecutive matching runs before a new occurrence fires.
    - `missing_runs` integer, required: Consecutive runs without the occurrence before it closes.
    - `missing_behavior` 'no_longer_matching' | 'expire', required: The close reason of an occurrence that is missing for `missing_runs` runs.
    - `continuity_runs` integer, required: Deprecated and ignored by settlement: runs that fail or are skipped never close an occurrence. Still required and stored for compatibility, and changing it still counts as a configuration change. At least `missing_runs`.
  - `integration_id` string, nullable
  - `schedule_warning` string, nullable
  - `slo_tier` integer, nullable
  - `slo_tier_viable` boolean, nullable
  - `slo_bucket_tier` integer, nullable
  - `snoozed_until` string, date-time, nullable, required
  - `suppression` AlertSuppression, required
    - `reason` 'paused' | 'snoozed' | 'target_too_low', required
    - `until` string, date-time, nullable, required
    - `evaluated` boolean, required
  - `query_check` AlertQueryCheck, required: The result of one save check of an alert query.
    - `status` 'ok' | 'slow' | 'timed_out' | 'not_checked', required
    - `duration_ms` integer, nullable, required
    - `timed_out` boolean, required
    - `message` string, required

## Other responses

- `422`: Validation Error
- `429`: Rate limit exceeded

---

[API](https://skmtc.dev/pydantic/apis/pydantic-logfire-api.md) - [All operations](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/llms.txt) - [OpenAPI document](https://skmtc.dev/pydantic/apis/pydantic-logfire-api/revisions/7996e45256f4?raw)
