Skip to navigation

Create Blocklist Rule

Create a rule that blocks or pins models and providers for customers, or for everyone. An organization can have up to 100 rules; changes apply to new requests within seconds.

Authentication

AuthorizationBearer

A management key (mgmt_...), sent as Authorization: Bearer <key>. Reading /v1/routing-policies also accepts the organization’s gateway API keys; writing there needs a management key.

Request

This endpoint expects an object.
customer_idslist of stringsOptional

Values of the X-Customer-ID request header the rule applies to. Empty matches every customer. Empty strings are dropped. A block rule needs at least one non-empty list.

modelslist of stringsOptional

Full model ids, like openai/gpt-5.5. Empty strings are dropped. A block rule needs at least one non-empty list.

providerslist of stringsOptional

Model providers, the prefix of a model id, like anthropic. With models empty too, matches every model. Empty strings are dropped. A block rule needs at least one non-empty list.

reasonstringOptional<=500 charactersDefaults to
Why the rule exists, such as a ticket or contract clause.
rule_typeenumOptionalDefaults to block

block denies a request when its customer matches and its model or provider matches. pin lets the listed customers use only the listed providers and models, and needs customer_ids plus providers or models. A block always wins over a pin.

Allowed values:

Response

The created blocklist rule
created_atdatetimeRead-only
When the rule was created.
customer_idslist of strings

Values of the X-Customer-ID request header the rule applies to. Empty matches every customer.

idstringRead-onlyformat: "uuid"
The rule's id.
modelslist of strings

Full model ids, like openai/gpt-5.5.

providerslist of strings

Model providers, the prefix of a model id, like anthropic. With models empty too, matches every model.

reasonstring
Why the rule exists, such as a ticket or contract clause.
rule_typeenum

block denies a request when its customer matches and its model or provider matches. pin lets the listed customers use only the listed providers and models, and needs customer_ids plus providers or models. A block always wins over a pin.

Allowed values:
updated_atdatetimeRead-only
When the rule last changed.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
422
Unprocessable Entity Error