Create an alert rule
The condition is checked when saved: its dataset and filter, its contact points, and a cost check (422 rule_too_expensive with readRows, readBytes and budget in the error's details, the only 422). 400 invalid_request with issues[] for every validation problem, each at its field's dotted path. 403 access_denied naming the missing action when the caller can't read what the condition reads (obs.metrics.query on the project for PromQL; obs.logs.search or obs.traces.search on the dataset). 409 quota_exceeded: obs.alertRules.perProject. 409 organization_deletion_pending. The answer's warnings: sampledData, noContactPoints. 404 while alerting isn't offered (the console hides Alerting then).
https://obs.ezghcloud.com/v1/organizations/{orgId}/projects/{projectId}/obs/alert-rulesAuthorization
Path parameters
Header parameters
Request bodyJSONrequired
Returns
201
The alert rule.
400
invalid_request (with issues), invalid_cursor, or the endpoint's own 400 codes.
403
access_denied: the caller's policies don't allow the action; forbidden_origin: a cookie-authenticated write from an origin that isn't allowed; spend_limit_reached.
404
not_found: unknown, malformed, or in an organization the caller isn't in.
409
quota_exceeded (an allocation quota, with quota), idempotency_conflict, idempotency_in_progress (with Retry-After), organization_deletion_pending, operation_in_progress, or the endpoint's own 409 codes.
413
payload_too_large: the body is over the endpoint's limit (1 MiB unless it says otherwise).
429
too_many_requests, with Retry-After; or quota_exceeded (a rate, usage or concurrency quota, with quota), never with Retry-After.
500
internal_error: a bug; the details are in the logs, under the request ID.