Skip to content
API Reference
API Reference

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

PATCH /api/v1/guardrails/:id
Base URL
https://runapi.ai
API version
v1
Authentication
Authorization: Bearer YOUR_MANAGEMENT_API_KEY
Authorization
Requires an account-admin Management API key.
02

Request

JSON body

Send values only in the listed request location.

JSON body12 fields
alert_threshold_percentinteger
Optional

Budget alert threshold percentage.

Default: 80 Range: 1 - 100
allowed_modelsarray | null
Optional

Replacement model allowlist.

allowed_providersarray | null
Optional

Replacement provider-name allowlist.

blocked_modelsarray | null
Optional

Replacement model blocklist.

blocked_providersarray | null
Optional

Replacement provider-name blocklist.

credit_limit_behaviorstring
Optional

Budget enforcement mode. Tag assignments require block.

Allowed values: block, alert_only Default: block
credit_limit_centsinteger | null
Optional

Total spending cap in USD cents.

credit_limit_reset_intervalstring | null
Optional

Reset cadence for the total spending cap. Null means lifetime when an amount is set.

Allowed values: daily, weekly, monthly
descriptionstring
Optional

Replacement free-form description.

enabledboolean
Optional

Whether the guardrail is enforced.

model_budgetsarray | null
Optional

Replacement per-model budget rules.

namestring
Optional

Replacement guardrail name.

Path parameters1 field
idstring
Required

Guardrail prefix ID, for example guardrail_abc123.

03

Success response

HTTP 200

PATCH /api/v1/guardrails/:id

JSON
{
  "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"
}
04

Error response (401)

HTTP 401
Response schema
JSON
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Response example

JSON
{
  "error": "Authentication required"
}
05

Error response (403)

HTTP 403
Response schema
JSON
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Response example

JSON
{
  "error": "Management API key required"
}
06

Error response (403)

HTTP 403
Response schema
JSON
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Response example

JSON
{
  "error": "Account admin required"
}
07

Error response (400)

HTTP 400
Response schema
JSON
{
  "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

JSON
{
  "error": "page must be an integer"
}
08

Error response (404)

HTTP 404
Response schema
JSON
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

Response example

JSON
{
  "error": "Resource not found"
}
09

Error response (422)

HTTP 422
Response schema
JSON
{
  "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

JSON
{
  "error": "Validation failed",
  "errors": {
    "base": [
      "Validation failed"
    ]
  }
}
10

cURL example

CURL
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}'