curl --request POST \
--url https://api.portkey.ai/v1/policies/usage-limits \
--header 'Content-Type: application/json' \
--header 'x-portkey-api-key: <api-key>' \
--data '
{
"name": "Monthly Cost Limit per API Key",
"conditions": [
{
"key": "workspace_id",
"value": "workspace-123"
}
],
"group_by": [
{
"key": "api_key"
}
],
"type": "cost",
"credit_limit": 1000,
"alert_threshold": 800,
"periodic_reset": "monthly"
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"object": "policy_usage_limits"
}Create Usage Limits Policy
POST
https://api.portkey.ai/v1
/
policies
/
usage-limits
curl --request POST \
--url https://api.portkey.ai/v1/policies/usage-limits \
--header 'Content-Type: application/json' \
--header 'x-portkey-api-key: <api-key>' \
--data '
{
"name": "Monthly Cost Limit per API Key",
"conditions": [
{
"key": "workspace_id",
"value": "workspace-123"
}
],
"group_by": [
{
"key": "api_key"
}
],
"type": "cost",
"credit_limit": 1000,
"alert_threshold": 800,
"periodic_reset": "monthly"
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"object": "policy_usage_limits"
}Portkey is now PRISMA AIRS AI Gateway. See it in action.
Contact Us
Body
application/json
Last modified on August 6, 2026
Was this page helpful?

