Skip to main content
POST
Create a rate limit

Authorizations

Authorization
string
header
required

An access token from Barndoor's identity provider, sent as Authorization: Bearer <token>. Use a service-account token from the OAuth 2.0 client-credentials grant for scripts and CI, or a signed-in user's token. The caller needs the admin role in the organization. Gateway API keys (bd-...) are not accepted here.

Body

application/json
name
string
required
scope_type
string
required

Who the policy applies to: org (everyone), or one of team, user, project, api_key, mcp_server, agent, role, group. Select the entity with scope_id (UUID-keyed types) or scope_value (name-keyed types such as role and group).

change_note
string | null

Optional note explaining why this was created. Shown with the record and in the audit log.

member_of_group
string | null

Give each member of this IdP group their own allowance from this one policy. Only valid with scope_type: user and no scope_id or scope_value. A group-scoped policy, by contrast, shares one allowance across all members.

requests_per_minute
integer<int32> | null

Requests allowed per rolling 60-second window.

scope_id
string<uuid> | null

UUID of the scoped entity, for UUID-keyed scope types such as user, team, or api_key.

scope_value
string | null

Name of the scoped entity, for name-keyed scope types, such as a role or IdP group name.

target_mcp_server_id
string<uuid> | null

Only apply to requests to this MCP server. Requires traffic_type mcp or all, and cannot be combined with the LLM target fields.

target_model_alias
string | null

Only apply to requests whose model is this alias. Cannot be combined with the other target fields.

target_provider_id
string<uuid> | null

Only apply to requests routed to this provider. Can be combined with target_upstream_model; cannot be combined with target_model_alias or target_mcp_server_id.

target_upstream_model
string | null

Only apply to requests routed to this upstream model. Requires target_provider_id.

tokens_per_minute
integer<int32> | null

Tokens allowed per rolling 60-second window.

traffic_type
string

Traffic the policy applies to: all, llm (model traffic), or mcp (MCP tool traffic). Defaults to all.

Response

Created

A rate limit.

enabled
boolean
required
id
string<uuid>
required
name
string
required
org_id
string<uuid>
required
scope_type
enum<string>
required

Who a policy applies to. llm_provider and model remain for compatibility only; to limit a budget or rate limit to a provider or model, use its target_* fields.

Available options:
org,
team,
user,
project,
api_key,
mcp_server,
llm_provider,
model,
agent,
role,
group
traffic_type
enum<string>
required
Available options:
all,
llm,
mcp
member_of_group
string | null

Give each member of this IdP group their own allowance from this one policy. Only valid with scope_type: user and no scope_id or scope_value. A group-scoped policy, by contrast, shares one allowance across all members.

requests_per_minute
integer<int32> | null
scope_id
string<uuid> | null
scope_value
string | null
target_mcp_server_id
string<uuid> | null

Only apply to requests to this MCP server. Requires traffic_type mcp or all, and cannot be combined with the LLM target fields.

target_model_alias
string | null

Only apply to requests whose model is this alias. Cannot be combined with the other target fields.

target_provider_id
string<uuid> | null

Only apply to requests routed to this provider. Can be combined with target_upstream_model; cannot be combined with target_model_alias or target_mcp_server_id.

target_upstream_model
string | null

Only apply to requests routed to this upstream model. Requires target_provider_id.

tokens_per_minute
integer<int32> | null
created_by_email
string | null
created_by_name
string | null
created_by_user_id
string<uuid> | null
last_change_note
string | null

Note explaining the last change.

last_modified_at
string<date-time> | null

When the last attributed change was made.

last_modified_by_email
string | null
last_modified_by_name
string | null
last_modified_by_user_id
string<uuid> | null