Guardrail Policies

Change a member policy assignment

Changed on

Assign or unassign one policy for a member. Fails with 409 when expected_assignment no longer matches the stored state. Management key required.

put/guardrails/policies/assignments/members/{member_id}

Request

  • Base URL
    https://openrouter.ai/api/v1
  • Auth
    HTTP bearer

Path parameters

member_id, string required

Organization member user ID

Example:user_2abcDEFghiJKLmnoPQRstu

Request body

ChangeGuardrailPolicyAssignmentRequest required
assigned, boolean required

true assigns the policy to the subject, false removes it

expected_assignment, intersection required

The assignment state last read for the subject. The request fails with 409 if it changed since.

policy_id, string uuid required

Policy ID

policy_type, 'budget' | 'model_availability' | 'moderation' | 'rate_limit' required

Policy type the assignment is read or changed for

workspace_id, string uuid

Workspace the policy belongs to. Required for an organization management key; a workspace-scoped key defaults to its own workspace and gets 403 for any other.

Example request

{
  "assigned": true,
  "expected_assignment": {
    "policy_ids": [],
    "workspace_default_policy_ids": [
      "2c6f1a4e-0b7d-4e59-9a61-3f8d2e7c1b90"
    ]
  },
  "policy_id": "550e8400-e29b-41d4-a716-446655440000",
  "policy_type": "budget",
  "workspace_id": "0df9e665-d932-5740-b2c7-b52af166bc11"
}

Response

Assignment changed

ChangeGuardrailPolicyAssignmentResponse required
data, boolean required

Whether the assignment changed

Example response

{
  "data": true
}

Changes