Skip to main content
POST
Create GenAI Alert Rule

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
project_id
string<uuid>
required

UUID of the project

application_id
string<uuid>
required

UUID of the application

name
string
required

Name of the alert rule

metric_source
enum<string>
required

Source of the metric data

Available options:
raw_data,
attribute,
evaluator,
custom
metric_name
string
required

Name of the metric (e.g., "traffic", "token_count", "attribute", "latency", or an evaluator type)

interval
enum<integer>
required

Interval in seconds (3600 = 1 hour, 86400 = 1 day)

Available options:
3600,
86400
aggregation
enum<string>
required

Supported aggregation types for GenAI metrics

Available options:
sum,
average,
p50,
p75,
p90,
p95,
p99,
count
threshold_type
enum<string>
required

Type of threshold

Available options:
ABSOLUTE
threshold_condition
enum<string>
required

Condition for threshold comparison

Available options:
ABOVE,
BELOW
critical_threshold
number<float>
required

Threshold value for triggering a critical alert

notification_settings
object[]
required

List of notification settings for the alert rule

query_scope
enum<string>
required

Scope of query processing

Available options:
SPAN,
SESSION
metric_unit
enum<string>

Unit for metric values.

Available options:
milliseconds
warning_threshold
number<float> | null

Threshold value for triggering a warning alert (optional)

token_type_id
string | null

Token type identifier (required for token_count metrics). In V1, a Postgres UUID; in V2, a bare OTel attribute name (e.g. gen_ai.usage.input_tokens).

attribute_id
string | null

Attribute identifier (required for attribute metrics). In V1, a Postgres UUID; in V2, a bare OTel attribute name (e.g. gen_ai.usage.total_tokens).

attribute_value
string | null

Attribute value for the metric attribute (only for attribute metrics with count aggregation)

semantic_name
enum<string> | null

Semantic concept name (e.g. input_tokens, model_name). When set, the alert queries by semantic concept rather than a specific attribute key, making it SDK-agnostic. Mutually exclusive with token_type_id and attribute_id.

Available options:
input_tokens,
output_tokens,
total_tokens,
total_cost,
input_cost,
output_cost,
model_name,
provider_name,
agent_name,
agent_id,
agent_description,
tool_name,
tool_id,
tool_type,
tool_definitions,
session_id,
user_id,
input,
output,
system_instructions,
retrieval_context,
tool_input,
tool_output,
latency,
ttft,
span_name,
span_type,
received_time,
request_id,
response_id,
cache_read_input_tokens,
cache_creation_input_tokens,
reasoning_tokens,
finish_reason
evaluator_rule_id
string<uuid> | null

Evaluator rule ID (required for evaluator metrics)

evaluator_output_name
string | null

Name of the evaluator output to monitor (required for evaluator metrics)

evaluator_output_value
string | null

Value of the evaluator output to filter on (only for evaluator metrics with count aggregation)

Response

GenAI Alert Rule created successfully

Response object for standard API responses.

api_version
enum<string>
default:3.0

API version.

Available options:
2.0,
3.0
kind
enum<string>
default:NORMAL

Type of response, indicating a normal response.

Available options:
NORMAL
data
object