API Reference
Create a guardrail assignment
Attach one guardrail to a Standard API key or an account member.
Attach one guardrail to a Standard API key or an account member.
Endpoint
- Base URL
https://runapi.ai- API version
v1- Authentication
Authorization: Bearer YOUR_MANAGEMENT_API_KEY- Authorization
- Account admins can assign any eligible target. Non-admin users can assign only their own Standard API keys.
03
JSON bodyRequest
Send values only in the listed request location.
JSON body3 fields
account_user_idstring
Optional
Account-member prefix ID. This target requires an account admin.
api_token_idstring
Optional
Standard API key prefix ID. Provide exactly one target ID.
guardrail_idstring
Required
Guardrail prefix ID.
03
HTTP 201Success response
POST /api/v1/guardrail_assignments
JSON
{
"account_user_id": null,
"api_token_id": "token_123",
"created_at": "2026-07-27T10:00:00.000Z",
"guardrail_id": "guardrail_123",
"id": "guardrail_assignment_123"
}
04
HTTP 401Error response (401)
JSON
{
"error": "Authentication required"
}
05
HTTP 403Error response (403)
JSON
{
"error": "Management API key required"
}
06
HTTP 400Error response (400)
JSON
{
"error": "page must be an integer"
}
07
HTTP 403Error response (403)
JSON
{
"error": "Forbidden"
}
08
HTTP 404Error response (404)
JSON
{
"error": "Resource not found"
}
09
HTTP 422Error response (422)
JSON
{
"errors": {
"base": [
"Validation failed"
]
}
}
10
cURL example
CURL
curl -X POST https://runapi.ai/api/v1/guardrail_assignments \
-H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"guardrail_id":"guardrail_123","api_token_id":"token_123"}'
11