Overview
The StellarStack API implements rate limiting using a token bucket algorithm to ensure fair usage and protect against abuse. Different endpoints have different rate limits based on their resource intensity and security requirements.How Rate Limiting Works
Each request consumes one token from your bucket. Tokens are refilled over time based on the configured window. When your bucket is empty, requests are rejected with a429 Too Many Requests status code.
Rate Limit Headers
All API responses include rate limit information:Maximum requests allowed in the current window
Requests remaining in the current window
Unix timestamp (seconds) when the rate limit resets
Seconds to wait before retrying (only present when rate limited)
Rate Limit Tiers
Authentication Endpoints
Strict rate limiting for security-sensitive authentication operations:5 requests per minuteApplies to login attempts to prevent brute force attacks.
5 requests per minuteLimits account creation to prevent spam.
5 requests per minuteProtects password reset functionality.
Rate Limited Response
Sensitive Operations
For password resets and email verification:3 requests per 15 minutesMaximum rate: 3 requests every 900,000ms (15 minutes)
General API Endpoints
Standard rate limit for most API operations:100 requests per minuteApplies to all API endpoints unless a more specific limit is defined.
Server Actions
Rate limiting for server control operations (start, stop, restart):10 requests per minute per serverRate limit is scoped to IP address + server ID combination.
File Operations
Limits for file upload, download, and management:30 requests per minuteApplies to file system operations on servers.
Webhook Testing
Rate limit for testing webhook endpoints:5 requests per minutePrevents abuse of webhook test functionality.
Rate Limit Scope
IP-Based Limiting
Most rate limits are applied per client IP address. The API detects your IP from:X-Forwarded-Forheader (first IP in list)X-Real-IPheaderCF-Connecting-IPheader (Cloudflare)- Direct connection IP (fallback)
Combined Scoping
Server action rate limits use a combination of:- Client IP address
- Server ID
Handling Rate Limits
Best Practices
- Monitor Headers - Check
X-RateLimit-Remainingbefore making requests - Respect Retry-After - Wait the specified time before retrying
- Implement Backoff - Use exponential backoff for retries
- Batch Operations - Combine multiple operations where possible
- Cache Responses - Store frequently accessed data locally
Example: Checking Rate Limits
Example: Exponential Backoff
Production Considerations
Cleanup
Rate limit entries are automatically cleaned up:- Old entries (>1 hour) are removed every 5 minutes
- Helps prevent memory leaks in long-running processes
Bypassing Rate Limits
There is no built-in mechanism to bypass rate limits. All clients, including administrators, are subject to the same limits to ensure system stability. If you need higher limits for specific use cases, consider:- Modifying the rate limit configuration in the source code
- Implementing custom rate limit tiers based on user roles
- Using request batching to reduce total request count