Update a guardrail
Replace supplied guardrail fields for every assignment using this shared policy. Omitted fields remain unchanged.
Replace supplied guardrail fields for every assignment using this shared policy. Omitted fields remain unchanged.
Endpoint
- Base URL
https://runapi.ai- API version
v1- Authentication
Authorization: Bearer YOUR_MANAGEMENT_API_KEY
Request
Send values only in the listed request location.
JSON body12 fields
alert_threshold_percentintegerBudget alert threshold percentage.
Default:80
Range: 1 - 100
allowed_modelsarray | nullReplacement model allowlist.
allowed_providersarray | nullReplacement provider-name allowlist.
blocked_modelsarray | nullReplacement model blocklist.
blocked_providersarray | nullReplacement provider-name blocklist.
credit_limit_behaviorstringBudget enforcement mode. Tag assignments require block.
Allowed values:block, alert_only
Default: block
credit_limit_centsinteger | nullTotal spending cap in USD cents.
credit_limit_reset_intervalstring | nullReset cadence for the total spending cap. Null means lifetime when an amount is set.
Allowed values:daily, weekly, monthly
descriptionstringReplacement free-form description.
enabledbooleanWhether the guardrail is enforced.
model_budgetsarray | nullReplacement per-model budget rules.
namestringReplacement guardrail name.
Path parameters1 field
idstringGuardrail prefix ID, for example guardrail_abc123.
Success response
PATCH /api/v1/guardrails/:id
{
"alert_threshold_percent": 80,
"allowed_models": [
"gpt-5.4"
],
"allowed_providers": [],
"assignment_count": 1,
"blocked_models": [],
"blocked_providers": [],
"created_at": "2026-07-27T10:00:00.000Z",
"credit_limit_behavior": "block",
"credit_limit_cents": 50000,
"credit_limit_reset_interval": "monthly",
"description": "Production policy",
"enabled": false,
"id": "guardrail_123",
"model_budgets": [
{
"credit_limit_cents": 10000,
"credit_limit_reset_interval": "monthly",
"match_mode": "include",
"models": [
"gpt-5.4"
]
}
],
"name": "Production budget"
}
Error response (401)
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Authentication required"
}
Error response (403)
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Management API key required"
}
Error response (403)
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Account admin required"
}
Error response (400)
Response schema
{
"oneOf": [
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
},
{
"properties": {
"error": {
"description": "Human-readable validation summary.",
"type": "string"
},
"errors": {
"additionalProperties": {
"items": {
"type": "string"
},
"type": "array"
},
"description": "Validation messages keyed by public request field, with an array of human-readable strings for each field.",
"type": "object"
}
},
"required": [
"error",
"errors"
],
"type": "object",
"unevaluatedProperties": false
}
]
}
Response example
{
"error": "page must be an integer"
}
Error response (404)
Response schema
{
"properties": {
"error": {
"description": "Human-readable error message.",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Resource not found"
}
Error response (422)
Response schema
{
"properties": {
"error": {
"description": "Human-readable validation summary.",
"type": "string"
},
"errors": {
"additionalProperties": {
"items": {
"type": "string"
},
"type": "array"
},
"description": "Validation messages keyed by public request field, with an array of human-readable strings for each field.",
"type": "object"
}
},
"required": [
"error",
"errors"
],
"type": "object",
"unevaluatedProperties": false
}
Response example
{
"error": "Validation failed",
"errors": {
"base": [
"Validation failed"
]
}
}
cURL example
curl -X PATCH https://runapi.ai/api/v1/guardrails/guardrail_123 \
-H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"enabled":false}'