Skip to main content
POST
/
api
/
rate-limits
/
tiers
Create Tier
curl --request POST \
  --url https://api.example.com/api/rate-limits/tiers \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "tier": "<string>",
  "allowed_limit": 123,
  "window_seconds": 123,
  "is_active": true
}
'

Authentication

Authorization
string
required
Bearer token: Bearer <admin_token>

Request Body

tier
string
required
Tier name (e.g., “client”, “server”, “premium”)
allowed_limit
integer
required
Maximum requests allowed per window
window_seconds
integer
required
Time window in seconds
is_active
boolean
default:"false"
Whether this tier is active

Example Request

curl -X POST https://api.sari-platform.com/api/rate-limits/tiers \
  -H "Authorization: Bearer <admin_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "tier": "premium",
    "allowed_limit": 5000,
    "window_seconds": 3600,
    "is_active": true
  }'

Response

{
  "tier": "premium",
  "allowed_limit": 5000,
  "window_seconds": 3600,
  "is_active": true,
  "created_at": "2024-01-15T10:00:00Z"
}
Only one tier of each name can be active at a time. Activating a new tier may deactivate existing ones.

Errors

StatusDescription
400Invalid request body
401Invalid or expired token
403Admin access required
409Tier already exists