Create a guardrail
POST
https://novapai.ai/api/v1/guardrails
POST
/api/v1/guardrails
cURL
$curl -X POST https://novapai.ai/api/v1/guardrails \
>-H "Authorization: Bearer <token>" \
>-H "Content-Type: application/json" \
>-d '\{
>"name": "My New Guardrail",
>"description": "A guardrail for limiting API usage",
>"limit_usd": 50,
>"reset_interval": "monthly",
>"allowed_providers": [
>"openai",
>"anthropic",
>"deepseek"
>],
>"enforce_zdr": false
>\}'201 Created
reference-guardrails-create-guardrail-01.json
{
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "My New Guardrail",
"created_at": "2025-08-24T10:30:00Z",
"description": "A guardrail for limiting API usage",
"limit_usd": 50,
"reset_interval": "monthly",
"allowed_providers": ["openai", "anthropic", "google"],
"enforce_zdr": false
}
}Create a new guardrail for the authenticated user. Management key required.
Authentication
Authorization Bearer
API key as bearer token in Authorization header
Request
This endpoint expects an object.
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 1-200 characters Name for the new guardrail |
| description | string or null | 否 | <=1000 characters Description of the guardrail |
| limit_usd | double or null | 否 | >=0 Spending limit in USD |
| reset_interval | enum or null | 否 | Interval at which the limit resets (daily, weekly, monthly) Allowed values:daily weekly monthly |
| allowed_providers | list of strings or null | 否 | List of allowed provider IDs |
| ignored_providers | list of strings or null | 否 | List of provider IDs to exclude from routing |
| allowed_models | list of strings or null | 否 | Array of model identifiers (slug or canonical_slug accepted) |
| enforce_zdr | boolean or null | 否 | Whether to enforce zero data retention |
Response
Guardrail created successfully
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| data | object | - | The created guardrail |
Errors
| 状态码 | 说明 |
|---|---|
| 400 | Bad Request Error |
| 401 | Unauthorized Error |
| 500 | Internal Server Error |