A AuthMS API Wiki API Reference iam.tianv.com →

POST /billing/alerts

创建一条用量告警规则(如:当月API调用量超过 80% 时通过指定渠道发送通知)。支持按资源类型设定阈值百分比和多渠道通知。

计费服务 `bearerAuth` application/json

Request Body

Schema: dto.CreateUsageAlertRequest

FieldTypeRequiredExampleConstraintsDescription
name string Yes API调用量告警
notification_channels string Yes email,in_app
resource_type string Yes api_calls
threshold_percent integer Yes 80
app_id string No app_001

Responses

StatusDescriptionSchema
201用量告警创建成功dto.UsageAlertDetailResponse
400请求参数错误object
401未授权object
500服务器内部错误object

Referenced Schemas

dto.UsageAlertDetailResponse

FieldTypeRequiredExampleConstraintsDescription
code integer No
data dto.UsageAlertResponse No
message string No
timestamp string No

dto.UsageAlertResponse

FieldTypeRequiredExampleConstraintsDescription
app_id string No app_001
created_at string No 2026-05-01T00:00:00Z
id string No ua_001
last_triggered_at string No 2026-05-10T08:00:00Z
name string No API调用量告警
notification_channels string No email,in_app
resource_type string No api_calls
status string No active
tenant_id string No tnt_xyz789
threshold_percent integer No 80
updated_at string No 2026-05-05T10:00:00Z