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

# Query alert logs

> Use when viewing or searching alert history (e.g. support triage or customer-facing alert log). Returns a paginated list; supports filtering by type, customer, subscription.



## OpenAPI

````yaml /api-reference/openapi.json post /alerts/search
openapi: 3.0.1
info:
  title: Flexprice API
  description: Flexprice API Service
  contact:
    name: API Support
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1.0'
servers:
  - url: https://us.api.flexprice.io/v1
    description: US Region
  - url: https://api.cloud.flexprice.io/v1
    description: India Region
security: []
paths:
  /alerts/search:
    post:
      tags:
        - Alerts
      summary: Query alert logs
      description: >-
        Use when viewing or searching alert history (e.g. support triage or
        customer-facing alert log). Returns a paginated list; supports filtering
        by type, customer, subscription.
      operationId: queryAlertLog
      requestBody:
        description: Filter
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/types.AlertLogFilter'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListAlertLogsResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    types.AlertLogFilter:
      type: object
      properties:
        alert_status:
          $ref: '#/components/schemas/types.AlertState'
        alert_type:
          $ref: '#/components/schemas/types.AlertType'
        customer_id:
          type: string
        end_time:
          type: string
          format: date-time
        entity_id:
          type: string
        entity_type:
          $ref: '#/components/schemas/types.AlertEntityType'
        expand:
          type: string
        filters:
          type: array
          description: filters allows complex filtering based on multiple fields
          items:
            $ref: '#/components/schemas/types.FilterCondition'
        limit:
          maximum: 1000
          minimum: 1
          type: integer
        offset:
          minimum: 0
          type: integer
        order:
          type: string
          enum:
            - asc
            - desc
        sort:
          type: array
          items:
            $ref: '#/components/schemas/types.SortCondition'
        start_time:
          type: string
          format: date-time
        status:
          $ref: '#/components/schemas/types.Status'
      x-speakeasy-name-override: AlertLogFilter
    ListAlertLogsResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/AlertLogResponse'
        pagination:
          $ref: '#/components/schemas/types.PaginationResponse'
    errors.ErrorResponse:
      type: object
      properties:
        code:
          type: string
          enum:
            - not_found
            - already_exists
            - version_conflict
            - validation_error
            - invalid_operation
            - permission_denied
            - http_client_error
            - database_error
            - system_error
            - internal_error
            - service_unavailable
        details:
          type: object
          additionalProperties:
            type: object
        http_status_code:
          type: integer
        message:
          type: string
      x-speakeasy-name-override: ErrorResponse
    types.AlertState:
      type: string
      enum:
        - ok
        - info
        - warning
        - in_alarm
      x-enum-varnames:
        - AlertStateOk
        - AlertStateInfo
        - AlertStateWarning
        - AlertStateInAlarm
      x-speakeasy-name-override: AlertState
    types.AlertType:
      type: string
      enum:
        - low_ongoing_balance
        - low_credit_balance
        - feature_wallet_balance
      x-enum-varnames:
        - AlertTypeLowOngoingBalance
        - AlertTypeLowCreditBalance
        - AlertTypeFeatureWalletBalance
      x-speakeasy-name-override: AlertType
    types.AlertEntityType:
      type: string
      enum:
        - wallet
        - feature
      x-enum-varnames:
        - AlertEntityTypeWallet
        - AlertEntityTypeFeature
      x-speakeasy-name-override: AlertEntityType
    types.FilterCondition:
      type: object
      properties:
        data_type:
          $ref: '#/components/schemas/types.DataType'
        field:
          type: string
        operator:
          $ref: '#/components/schemas/types.FilterOperatorType'
        value:
          $ref: '#/components/schemas/types.Value'
      x-speakeasy-name-override: FilterCondition
    types.SortCondition:
      type: object
      properties:
        direction:
          $ref: '#/components/schemas/types.SortDirection'
        field:
          type: string
      x-speakeasy-name-override: SortCondition
    types.Status:
      type: string
      enum:
        - published
        - deleted
        - archived
      x-enum-varnames:
        - StatusPublished
        - StatusDeleted
        - StatusArchived
      x-speakeasy-name-override: Status
    AlertLogResponse:
      type: object
      properties:
        alert_info:
          $ref: '#/components/schemas/types.AlertInfo'
        alert_status:
          $ref: '#/components/schemas/types.AlertState'
        alert_type:
          $ref: '#/components/schemas/types.AlertType'
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        customer:
          $ref: '#/components/schemas/CustomerResponse'
        customer_id:
          type: string
        entity_id:
          type: string
        entity_type:
          $ref: '#/components/schemas/types.AlertEntityType'
        environment_id:
          type: string
        feature:
          $ref: '#/components/schemas/FeatureResponse'
        id:
          type: string
        parent_entity_id:
          type: string
        parent_entity_type:
          type: string
        status:
          type: string
        tenant_id:
          type: string
        updated_at:
          type: string
          format: date-time
        updated_by:
          type: string
        wallet:
          $ref: '#/components/schemas/WalletResponse'
    types.PaginationResponse:
      type: object
      properties:
        limit:
          type: integer
        offset:
          type: integer
        total:
          type: integer
      x-speakeasy-name-override: PaginationResponse
    types.DataType:
      type: string
      enum:
        - string
        - number
        - date
        - array
      x-enum-varnames:
        - DataTypeString
        - DataTypeNumber
        - DataTypeDate
        - DataTypeArray
      x-speakeasy-name-override: DataType
    types.FilterOperatorType:
      type: string
      enum:
        - eq
        - contains
        - not_contains
        - gt
        - lt
        - in
        - not_in
        - before
        - after
      x-enum-varnames:
        - EQUAL
        - CONTAINS
        - NOT_CONTAINS
        - GREATER_THAN
        - LESS_THAN
        - IN
        - NOT_IN
        - BEFORE
        - AFTER
      x-speakeasy-name-override: FilterOperatorType
    types.Value:
      type: object
      properties:
        array:
          type: array
          items:
            type: string
        boolean:
          type: boolean
        date:
          type: string
        number:
          type: number
        string:
          type: string
      x-speakeasy-name-override: Value
    types.SortDirection:
      type: string
      enum:
        - asc
        - desc
      x-enum-varnames:
        - SortDirectionAsc
        - SortDirectionDesc
      x-speakeasy-name-override: SortDirection
    types.AlertInfo:
      type: object
      properties:
        alert_settings:
          $ref: '#/components/schemas/types.AlertSettings'
        timestamp:
          type: string
        value_at_time:
          type: number
      x-speakeasy-name-override: AlertInfo
    CustomerResponse:
      type: object
      properties:
        address_city:
          type: string
          description: AddressCity is the city of the customer's address
        address_country:
          type: string
          description: >-
            AddressCountry is the country of the customer's address (ISO 3166-1
            alpha-2)
        address_line1:
          type: string
          description: AddressLine1 is the first line of the customer's address
        address_line2:
          type: string
          description: AddressLine2 is the second line of the customer's address
        address_postal_code:
          type: string
          description: AddressPostalCode is the postal code of the customer's address
        address_state:
          type: string
          description: AddressState is the state of the customer's address
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        email:
          type: string
          description: Email is the email of the customer
        environment_id:
          type: string
          description: EnvironmentID is the environment identifier for the customer
        external_id:
          type: string
          description: ExternalID is the external identifier for the customer
        id:
          type: string
          description: ID is the unique identifier for the customer
        integrations:
          type: array
          items:
            $ref: '#/components/schemas/EntityIntegrationMappingResponse'
        metadata:
          type: object
          additionalProperties:
            type: string
          description: Metadata
        name:
          type: string
          description: Name is the name of the customer
        status:
          $ref: '#/components/schemas/types.Status'
        tenant_id:
          type: string
        updated_at:
          type: string
          format: date-time
        updated_by:
          type: string
      description: Customer response object containing all customer information
    FeatureResponse:
      type: object
      properties:
        alert_settings:
          $ref: '#/components/schemas/types.AlertSettings'
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        description:
          type: string
        environment_id:
          type: string
        group:
          $ref: '#/components/schemas/GroupResponse'
        group_id:
          type: string
        id:
          type: string
        lookup_key:
          type: string
        metadata:
          $ref: '#/components/schemas/types.Metadata'
        meter:
          $ref: '#/components/schemas/MeterResponse'
        meter_id:
          type: string
        name:
          type: string
        reporting_unit:
          $ref: '#/components/schemas/types.ReportingUnit'
        status:
          $ref: '#/components/schemas/types.Status'
        tenant_id:
          type: string
        type:
          $ref: '#/components/schemas/types.FeatureType'
        unit_plural:
          type: string
        unit_singular:
          type: string
        updated_at:
          type: string
          format: date-time
        updated_by:
          type: string
    WalletResponse:
      type: object
      properties:
        alert_settings:
          $ref: '#/components/schemas/types.AlertSettings'
        alert_state:
          $ref: '#/components/schemas/types.AlertState'
        auto_topup:
          $ref: '#/components/schemas/types.AutoTopup'
        balance:
          type: string
        config:
          $ref: '#/components/schemas/types.WalletConfig'
        conversion_rate:
          type: string
          description: |-
            amount in the currency =  number of credits * conversion_rate
            ex if conversion_rate is 1, then 1 USD = 1 credit
            ex if conversion_rate is 2, then 1 USD = 0.5 credits
            ex if conversion_rate is 0.5, then 1 USD = 2 credits
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        credit_balance:
          type: string
        credits_available_breakdown:
          $ref: '#/components/schemas/types.CreditBreakdown'
        currency:
          type: string
        customer_id:
          type: string
        description:
          type: string
        environment_id:
          type: string
        id:
          type: string
        metadata:
          $ref: '#/components/schemas/types.Metadata'
        name:
          type: string
        status:
          $ref: '#/components/schemas/types.Status'
        tenant_id:
          type: string
        topup_conversion_rate:
          type: string
          description: >-
            topup_conversion_rate is the conversion rate for the topup to the
            currency

            ex if topup_conversion_rate is 1, then 1 USD = 1 credit

            ex if topup_conversion_rate is 2, then 1 USD = 0.5 credits

            ex if topup_conversion_rate is 0.5, then 1 USD = 2 credits
        updated_at:
          type: string
          format: date-time
        updated_by:
          type: string
        wallet_status:
          $ref: '#/components/schemas/types.WalletStatus'
        wallet_type:
          $ref: '#/components/schemas/types.WalletType'
    types.AlertSettings:
      type: object
      properties:
        alert_enabled:
          type: boolean
        critical:
          $ref: '#/components/schemas/types.AlertThreshold'
        info:
          $ref: '#/components/schemas/types.AlertThreshold'
        warning:
          $ref: '#/components/schemas/types.AlertThreshold'
      x-speakeasy-name-override: AlertSettings
    EntityIntegrationMappingResponse:
      type: object
      properties:
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        entity_id:
          type: string
        entity_type:
          $ref: '#/components/schemas/types.IntegrationEntityType'
        environment_id:
          type: string
        id:
          type: string
        provider_entity_id:
          type: string
        provider_type:
          type: string
        status:
          $ref: '#/components/schemas/types.Status'
        tenant_id:
          type: string
        updated_at:
          type: string
          format: date-time
        updated_by:
          type: string
    GroupResponse:
      type: object
      properties:
        created_at:
          type: string
          format: date-time
        entity_ids:
          type: array
          items:
            type: string
        entity_type:
          type: string
        id:
          type: string
        lookup_key:
          type: string
        metadata:
          type: object
          additionalProperties:
            type: string
        name:
          type: string
        status:
          type: string
        updated_at:
          type: string
          format: date-time
    types.Metadata:
      type: object
      additionalProperties:
        type: string
      x-speakeasy-name-override: Metadata
    MeterResponse:
      type: object
      properties:
        aggregation:
          $ref: '#/components/schemas/meter.Aggregation'
        created_at:
          type: string
          example: '2024-03-20T15:04:05Z'
          format: date-time
        event_name:
          type: string
          example: api_request
        filters:
          type: array
          items:
            $ref: '#/components/schemas/meter.Filter'
        id:
          type: string
          example: 550e8400-e29b-41d4-a716-446655440000
        name:
          type: string
          example: API Usage Meter
        reset_usage:
          $ref: '#/components/schemas/types.ResetUsage'
        status:
          type: string
          example: published
        tenant_id:
          type: string
          example: tenant123
        updated_at:
          type: string
          example: '2024-03-20T15:04:05Z'
          format: date-time
    types.ReportingUnit:
      type: object
      properties:
        conversion_rate:
          type: number
          description: >-
            Multiplier: reporting_unit_value = unit_value * conversion_rate;
            must be > 0
        unit_plural:
          type: string
          description: Display unit label, plural (e.g. "seconds")
        unit_singular:
          type: string
          description: Display unit label, singular (e.g. "second")
      x-speakeasy-name-override: ReportingUnit
    types.FeatureType:
      type: string
      enum:
        - metered
        - boolean
        - static
      x-enum-varnames:
        - FeatureTypeMetered
        - FeatureTypeBoolean
        - FeatureTypeStatic
      x-speakeasy-name-override: FeatureType
    types.AutoTopup:
      type: object
      properties:
        amount:
          type: number
        enabled:
          type: boolean
        invoicing:
          type: boolean
        threshold:
          type: number
      x-speakeasy-name-override: AutoTopup
    types.WalletConfig:
      type: object
      properties:
        allowed_price_types:
          type: array
          description: >-
            AllowedPriceTypes is a list of price types that are allowed for the
            wallet

            nil means all price types are allowed
          items:
            $ref: '#/components/schemas/types.WalletConfigPriceType'
      x-speakeasy-name-override: WalletConfig
    types.CreditBreakdown:
      type: object
      properties:
        free:
          type: string
        purchased:
          type: string
      x-speakeasy-name-override: CreditBreakdown
    types.WalletStatus:
      type: string
      enum:
        - active
        - frozen
        - closed
      x-enum-varnames:
        - WalletStatusActive
        - WalletStatusFrozen
        - WalletStatusClosed
      x-speakeasy-name-override: WalletStatus
    types.WalletType:
      type: string
      enum:
        - PRE_PAID
        - POST_PAID
      x-enum-varnames:
        - WalletTypePrePaid
        - WalletTypePostPaid
      x-speakeasy-name-override: WalletType
    types.AlertThreshold:
      type: object
      properties:
        condition:
          $ref: '#/components/schemas/types.AlertCondition'
        threshold:
          type: number
      x-speakeasy-name-override: AlertThreshold
    types.IntegrationEntityType:
      type: string
      enum:
        - customer
        - plan
        - invoice
        - subscription
        - payment
        - credit_note
        - addon
        - item
        - item_price
        - price
      x-enum-varnames:
        - IntegrationEntityTypeCustomer
        - IntegrationEntityTypePlan
        - IntegrationEntityTypeInvoice
        - IntegrationEntityTypeSubscription
        - IntegrationEntityTypePayment
        - IntegrationEntityTypeCreditNote
        - IntegrationEntityTypeAddon
        - IntegrationEntityTypeItem
        - IntegrationEntityTypeItemPrice
        - IntegrationEntityTypePrice
      x-speakeasy-name-override: IntegrationEntityType
    meter.Aggregation:
      type: object
      properties:
        bucket_size:
          $ref: '#/components/schemas/types.WindowSize'
        expression:
          type: string
          description: >-
            Expression is an optional CEL expression to compute per-event
            quantity from event.properties.

            When set, it replaces Field-based extraction. Property names are
            used directly (e.g., token * duration * pixel).
        field:
          type: string
          description: >-
            Field is the key in $event.properties on which the aggregation is to
            be applied

            For ex if the aggregation type is sum for API usage, the field could
            be "duration_ms"

            Ignored when Expression is set.
        group_by:
          type: string
          description: >-
            GroupBy is the property name in event.properties to group by before
            aggregating.

            Currently only supported for MAX aggregation with bucket_size.

            When set, aggregation is applied per unique value of this property
            within each bucket,

            then the per-group results are summed to produce the bucket total.
        multiplier:
          type: string
          description: >-
            Multiplier is the multiplier for the aggregation

            For ex if the aggregation type is sum_with_multiplier for API usage,
            the multiplier could be 1000

            to scale up by a factor of 1000. If not provided, it will be null.
        type:
          $ref: '#/components/schemas/types.AggregationType'
    meter.Filter:
      type: object
      properties:
        key:
          type: string
          description: >-
            Key is the key for the filter from $event.properties

            Currently we support only first level keys in the properties and not
            nested keys
        values:
          type: array
          description: >-
            Values are the possible values for the filter to be considered for
            the meter

            For ex "model_name" could have values "o1-mini", "gpt-4o" etc
          items:
            type: string
    types.ResetUsage:
      type: string
      enum:
        - BILLING_PERIOD
        - NEVER
      x-enum-varnames:
        - ResetUsageBillingPeriod
        - ResetUsageNever
      x-speakeasy-name-override: ResetUsage
    types.WalletConfigPriceType:
      type: string
      enum:
        - ALL
        - USAGE
        - FIXED
      x-enum-varnames:
        - WalletConfigPriceTypeAll
        - WalletConfigPriceTypeUsage
        - WalletConfigPriceTypeFixed
      x-speakeasy-name-override: WalletConfigPriceType
    types.AlertCondition:
      type: string
      enum:
        - above
        - below
      x-enum-varnames:
        - AlertConditionAbove
        - AlertConditionBelow
      x-speakeasy-name-override: AlertCondition
    types.WindowSize:
      type: string
      enum:
        - MINUTE
        - 15MIN
        - 30MIN
        - HOUR
        - 3HOUR
        - 6HOUR
        - 12HOUR
        - DAY
        - WEEK
        - MONTH
        - MONTH
      x-enum-varnames:
        - WindowSizeMinute
        - WindowSize15Min
        - WindowSize30Min
        - WindowSizeHour
        - WindowSize3Hour
        - WindowSize6Hour
        - WindowSize12Hour
        - WindowSizeDay
        - WindowSizeWeek
        - WindowSizeMonth
        - DefaultWindowSize
      x-speakeasy-name-override: WindowSize
    types.AggregationType:
      type: string
      enum:
        - COUNT
        - SUM
        - AVG
        - COUNT_UNIQUE
        - LATEST
        - SUM_WITH_MULTIPLIER
        - MAX
        - WEIGHTED_SUM
      x-enum-comments:
        AggregationSumWithMultiplier: Sum with a multiplier - [sum(value) * multiplier]
      x-enum-varnames:
        - AggregationCount
        - AggregationSum
        - AggregationAvg
        - AggregationCountUnique
        - AggregationLatest
        - AggregationSumWithMultiplier
        - AggregationMax
        - AggregationWeightedSum
      x-speakeasy-name-override: AggregationType
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Enter your API key in the format *x-api-key &lt;api-key&gt;**
      name: x-api-key
      in: header

````