API Reference
Create a guardrail
Create a reusable model, provider, and budget policy.
Create a reusable model, provider, and budget policy.
Endpoint
- Base URL
https://runapi.ai- API version
v1- Authentication
Authorization: Bearer YOUR_MANAGEMENT_API_KEY- Authorization
- Requires an account-admin Management API key.
03
JSON bodyRequest
Send values only in the listed request location.
JSON body10 fields
allowed_modelsarray | null
Optional
Model allowlist.
allowed_providersarray | null
Optional
Provider-name allowlist.
blocked_modelsarray | null
Optional
Model blocklist, which takes precedence over the allowlist.
blocked_providersarray | null
Optional
Provider-name blocklist.
credit_limit_centsinteger | null
Optional
Total spending cap in USD cents.
credit_limit_reset_intervalstring | null
Optional
Reset cadence for the total spending cap.
Allowed values:daily, weekly, monthly
descriptionstring
Optional
Optional free-form description.
enabledboolean
Optional
Whether the guardrail is enforced.
Default:true
model_budgetsarray | null
Optional
Per-model budget rules.
namestring
Required
Guardrail name unique within the account.
03
HTTP 201Success response
POST /api/v1/guardrails
JSON
{
"allowed_models": [
"gpt-5.4"
],
"allowed_providers": [],
"assignment_count": 1,
"blocked_models": [],
"blocked_providers": [],
"created_at": "2026-07-27T10:00:00.000Z",
"credit_limit_cents": 50000,
"credit_limit_reset_interval": "monthly",
"description": "Production policy",
"enabled": true,
"id": "guardrail_123",
"model_budgets": [
{
"credit_limit_cents": 10000,
"credit_limit_reset_interval": "monthly",
"match_mode": "include",
"models": [
"gpt-5.4"
]
}
],
"name": "Production budget"
}
04
HTTP 401Error response (401)
JSON
{
"error": "Authentication required"
}
05
HTTP 403Error response (403)
JSON
{
"error": "Management API key required"
}
06
HTTP 403Error response (403)
JSON
{
"error": "Account admin required"
}
07
HTTP 400Error response (400)
JSON
{
"error": "page must be an integer"
}
08
HTTP 422Error response (422)
JSON
{
"errors": {
"base": [
"Validation failed"
]
}
}
09
cURL example
CURL
curl -X POST https://runapi.ai/api/v1/guardrails \
-H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"name":"Production budget","description":"Production policy","enabled":true,"credit_limit_cents":50000,"credit_limit_reset_interval":"monthly","allowed_models":["gpt-5.4"],"model_budgets":[{"match_mode":"include","models":["gpt-5.4"],"credit_limit_cents":10000,"credit_limit_reset_interval":"monthly"}]}'
10