curl --request POST \
--url https://api.portkey.ai/v1/policies/rate-limits \
--header 'Content-Type: application/json' \
--header 'x-portkey-api-key: <api-key>' \
--data '
{
"name": "100 RPM per API Key",
"conditions": [
{
"key": "workspace_id",
"value": "workspace-123"
}
],
"group_by": [
{
"key": "api_key"
}
],
"type": "requests",
"unit": "rpm",
"value": 100
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"object": "policy_usage_limits"
}Create Rate Limits Policy
POST
https://api.portkey.ai/v1
/
policies
/
rate-limits
curl --request POST \
--url https://api.portkey.ai/v1/policies/rate-limits \
--header 'Content-Type: application/json' \
--header 'x-portkey-api-key: <api-key>' \
--data '
{
"name": "100 RPM per API Key",
"conditions": [
{
"key": "workspace_id",
"value": "workspace-123"
}
],
"group_by": [
{
"key": "api_key"
}
],
"type": "requests",
"unit": "rpm",
"value": 100
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"object": "policy_usage_limits"
}Portkey is now PRISMA AIRS AI Gateway. See it in action.
Contact Us
Authorizations
Body
application/json
Array of conditions that define which requests the policy applies to
Minimum array length:
1Show child attributes
Show child attributes
Array of group by fields that define how usage is aggregated
Minimum array length:
1Show child attributes
Show child attributes
Policy type
Available options:
requests, tokens Rate unit:
rpm- Requests/Tokens per minuterph- Requests/Tokens per hourrpd- Requests/Tokens per dayrpw- Requests/Tokens per week
Available options:
rpm, rph, rpd, rpw Rate limit value
Policy name
Maximum string length:
255Example:
"100 Requests per Minute"
The target resource for rate limiting:
llm- Apply rate limit to LLM requests (default)mcp_tools- Apply rate limit to MCP tool calls
Available options:
llm, mcp_tools Workspace ID or slug. Required if not using API key authentication.
Organization ID. Required if not using API key authentication.
Was this page helpful?

