PydanticAI Alerts API

The Alerts API from PydanticAI — 2 operation(s) for alerts.

OpenAPI Specification

pydantic-ai-alerts-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Pydantic API Discovery Alerts API
  version: 1.0.0
  summary: Discovery document for Pydantic's region-partitioned APIs.
  description: 'Pydantic Logfire is region-partitioned. This document does not describe the Logfire API directly — it advertises a single discovery endpoint that lists the per-region OpenAPI specifications.


    - **US region**: https://logfire-us.pydantic.dev/api/openapi.json

    - **EU region**: https://logfire-eu.pydantic.dev/api/openapi.json


    ## Versioning


    This discovery API uses URL path versioning. The current major version is `v1` and is served from `https://pydantic.dev/api/v1/`. Unversioned requests to `https://pydantic.dev/api` and `https://pydantic.dev/api/` are permanently redirected (HTTP 308) to the current major version. Breaking changes will be released under a new major version (e.g. `/api/v2/`) and the previous version will be supported for at least 12 months after the new version ships, with the deprecation date advertised in the `Deprecation` and `Sunset` response headers (RFC 8594, RFC 9745).


    Responses include an `X-API-Version` header identifying the version that served the request.


    Related discovery resources:


    - [`/.well-known/api-catalog`](https://pydantic.dev/.well-known/api-catalog) — RFC 9727 Linkset of available API descriptions.

    - [`/.well-known/openapi-specs`](https://pydantic.dev/.well-known/openapi-specs) — JSON list of per-region OpenAPI specs.

    - [`/.well-known/oauth-protected-resource`](https://pydantic.dev/.well-known/oauth-protected-resource) — RFC 9728 OAuth protected resource metadata.'
  contact:
    name: Pydantic
    url: https://pydantic.dev
    email: hello@pydantic.dev
  license:
    name: Pydantic Terms of Service
    url: https://pydantic.dev/legal/terms-of-service
servers:
- url: https://pydantic.dev/api/v1
  description: Host Discovery — version 1
tags:
- name: Alerts
paths:
  /v1/projects/{project_id}/alerts/:
    get:
      tags:
      - Alerts
      summary: List Alerts
      description: List all alerts for a project.
      operationId: list_alerts_v1_projects__project_id__alerts__get
      security:
      - OAuth2AuthorizationCodeBearer:
        - project:read_alert
      parameters:
      - name: project_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Project Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AlertWithLastRun'
                title: Response List Alerts V1 Projects  Project Id  Alerts  Get
        '429':
          description: Rate limit exceeded
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - Alerts
      summary: Create Alert
      description: Create a new alert.
      operationId: create_alert_v1_projects__project_id__alerts__post
      security:
      - OAuth2AuthorizationCodeBearer:
        - project:write_alert
      parameters:
      - name: project_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Project Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AlertCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertRead'
        '429':
          description: Rate limit exceeded
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/projects/{project_id}/alerts/{alert_id}/:
    get:
      tags:
      - Alerts
      summary: Get Alert
      description: Get an alert.
      operationId: get_alert_v1_projects__project_id__alerts__alert_id___get
      security:
      - OAuth2AuthorizationCodeBearer:
        - project:read_alert
      parameters:
      - name: alert_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Alert Id
      - name: project_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Project Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertWithLastRun'
        '429':
          description: Rate limit exceeded
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    put:
      tags:
      - Alerts
      summary: Update Alert
      description: Update an alert.
      operationId: update_alert_v1_projects__project_id__alerts__alert_id___put
      security:
      - OAuth2AuthorizationCodeBearer:
        - project:write_alert
      parameters:
      - name: alert_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Alert Id
      - name: project_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Project Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AlertUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertRead'
        '429':
          description: Rate limit exceeded
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Alerts
      summary: Delete Alert
      description: Delete an alert.
      operationId: delete_alert_v1_projects__project_id__alerts__alert_id___delete
      security:
      - OAuth2AuthorizationCodeBearer:
        - project:write_alert
      parameters:
      - name: alert_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Alert Id
      - name: project_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Project Id
      responses:
        '204':
          description: Successful Response
        '429':
          description: Rate limit exceeded
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AlertCreate:
      properties:
        name:
          type: string
          title: Name
        description:
          type: string
          title: Description
        query:
          title: Query
          examples:
          - SELECT 1
        time_window:
          type: string
          format: duration
          title: Time Window
        frequency:
          type: string
          format: duration
          title: Frequency
        watermark:
          type: string
          format: duration
          title: Watermark
        active:
          type: boolean
          title: Active
          description: Whether the alert starts enabled.
          default: true
        channel_ids:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Channel Ids
          description: Legacy shorthand for assigning channels without schedules.
        channel_assignments:
          anyOf:
          - items:
              $ref: '#/components/schemas/AlertChannelAssignment'
            type: array
          - type: 'null'
          title: Channel Assignments
          description: Schedule-aware channel configuration. When both `channel_assignments` and `channel_ids` are provided, `channel_assignments` is used.
        notify_when:
          type: string
          enum:
          - has_matches
          - has_matches_changed
          - matches_changed
          - starts_having_matches
          title: Notify When
      type: object
      required:
      - name
      - description
      - query
      - time_window
      - frequency
      - watermark
      - notify_when
      title: AlertCreate
    HTTPExceptionError:
      properties:
        detail:
          type: string
          title: Detail
      type: object
      required:
      - detail
      title: HTTPExceptionError
    Opsgenie:
      properties:
        type:
          type: string
          enum:
          - opsgenie
          title: Type
        auth_key:
          type: string
          title: Auth Key
        base_url:
          type: string
          title: Base Url
      type: object
      required:
      - type
      - auth_key
      title: Opsgenie
    WebhookFormat:
      type: string
      enum:
      - auto
      - slack-blockkit
      - slack-legacy
      - raw-data
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    AlertWithLastRun:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        organization_id:
          type: string
          format: uuid
          title: Organization Id
        project_id:
          type: string
          format: uuid
          title: Project Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Updated At
        created_by_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Created By Name
        updated_by_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Updated By Name
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        query:
          type: string
          title: Query
        time_window:
          type: string
          format: duration
          title: Time Window
        frequency:
          type: string
          format: duration
          title: Frequency
        watermark:
          type: string
          format: duration
          title: Watermark
        channels:
          items:
            $ref: '#/components/schemas/AlertChannelRead'
          type: array
          title: Channels
        notify_when:
          type: string
          enum:
          - has_matches
          - has_matches_changed
          - matches_changed
          - starts_having_matches
          title: Notify When
        active:
          type: boolean
          title: Active
        last_run:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Last Run
        has_matches:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Has Matches
        has_errors:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Has Errors
        result:
          $ref: '#/components/schemas/JSONBData'
        result_length:
          anyOf:
          - type: integer
          - type: 'null'
          title: Result Length
      type: object
      required:
      - id
      - organization_id
      - project_id
      - created_at
      - updated_at
      - created_by_name
      - updated_by_name
      - name
      - description
      - query
      - time_window
      - frequency
      - watermark
      - channels
      - notify_when
      - active
      - last_run
      - has_matches
      - has_errors
      - result
      - result_length
      title: AlertWithLastRun
    Webhook:
      properties:
        type:
          type: string
          enum:
          - webhook
          title: Type
        format:
          $ref: '#/components/schemas/WebhookFormat'
        url:
          type: string
          title: Url
      type: object
      required:
      - type
      - format
      - url
      title: Webhook
    AlertChannelRead:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        organization_id:
          type: string
          format: uuid
          title: Organization Id
        label:
          type: string
          title: Label
        active:
          type: boolean
          title: Active
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Updated At
        created_by_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Created By Name
        updated_by_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Updated By Name
        config:
          oneOf:
          - $ref: '#/components/schemas/Webhook'
          - $ref: '#/components/schemas/Opsgenie'
          - $ref: '#/components/schemas/Notification'
          title: Config
          discriminator:
            propertyName: type
            mapping:
              notification: '#/components/schemas/Notification'
              opsgenie: '#/components/schemas/Opsgenie'
              webhook: '#/components/schemas/Webhook'
        schedule_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Schedule Id
      type: object
      required:
      - id
      - organization_id
      - label
      - active
      - created_at
      - updated_at
      - created_by_name
      - updated_by_name
      - config
      - schedule_id
      title: AlertChannelRead
    AlertChannelAssignment:
      properties:
        channel_id:
          type: string
          format: uuid
          title: Channel Id
        schedule_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Schedule Id
      type: object
      required:
      - channel_id
      title: AlertChannelAssignment
    Notification:
      properties:
        type:
          type: string
          enum:
          - notification
          title: Type
        recipients:
          items:
            type: string
            format: uuid
          type: array
          title: Recipients
      type: object
      required:
      - type
      - recipients
      title: Notification
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AlertUpdate:
      properties:
        name:
          type: string
          title: Name
        description:
          type: string
          title: Description
        time_window:
          type: string
          format: duration
          title: Time Window
        frequency:
          type: string
          format: duration
          title: Frequency
        watermark:
          type: string
          format: duration
          title: Watermark
        active:
          type: boolean
          title: Active
        query:
          type: string
          title: Query
        channel_ids:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Channel Ids
          description: Legacy shorthand for assigning channels without schedules.
        channel_assignments:
          items:
            $ref: '#/components/schemas/AlertChannelAssignment'
          type: array
          title: Channel Assignments
          description: Schedule-aware channel configuration. When both `channel_assignments` and `channel_ids` are provided, `channel_assignments` is used.
        notify_when:
          type: string
          enum:
          - has_matches
          - has_matches_changed
          - matches_changed
          - starts_having_matches
          title: Notify When
      type: object
      title: AlertUpdate
      description: The fields that can be updated on an alert.
    AlertRead:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        organization_id:
          type: string
          format: uuid
          title: Organization Id
        project_id:
          type: string
          format: uuid
          title: Project Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Updated At
        created_by_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Created By Name
        updated_by_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Updated By Name
        name:
          type: string
          title: Name
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        query:
          type: string
          title: Query
        time_window:
          type: string
          format: duration
          title: Time Window
        frequency:
          type: string
          format: duration
          title: Frequency
        watermark:
          type: string
          format: duration
          title: Watermark
        channels:
          items:
            $ref: '#/components/schemas/AlertChannelRead'
          type: array
          title: Channels
        notify_when:
          type: string
          enum:
          - has_matches
          - has_matches_changed
          - matches_changed
          - starts_having_matches
          title: Notify When
        active:
          type: boolean
          title: Active
      type: object
      required:
      - id
      - organization_id
      - project_id
      - created_at
      - updated_at
      - created_by_name
      - updated_by_name
      - name
      - description
      - query
      - time_window
      - frequency
      - watermark
      - channels
      - notify_when
      - active
      title: AlertRead
    JSONBData:
      anyOf:
      - additionalProperties:
          $ref: '#/components/schemas/JSONBData'
        type: object
      - items:
          $ref: '#/components/schemas/JSONBData'
        type: array
      - type: string
      - type: integer
      - type: boolean
      - type: number
      - type: 'null'