Default Rate Limits
By default, Zipline enforces rate limits on most API endpoints. The exact limits depend on your instance configuration.Global Rate Limit Configuration
From the source code (src/server/index.ts:139-172), the rate limit plugin is configured as follows:- Max Requests: 10 per time window
- Time Window: Configurable (typically 60 seconds)
- Key: Based on user ID or IP + endpoint + method
- Admin Bypass: Administrators can bypass rate limits if enabled
Rate Limit Key Generation
Rate limits are tracked per unique key, which is generated based on:clx1y2z3a0000-/api/upload-POST(authenticated user)192.168.1.100-/api/upload-POST(unauthenticated request)
- Each endpoint has its own rate limit counter
- GET and POST to the same endpoint count separately
- Rate limits are per-user when authenticated
- Rate limits are per-IP when unauthenticated
Endpoint-Specific Rate Limits
Some sensitive endpoints have stricter rate limits configured usingsecondlyRatelimit():
Login Endpoint
From src/server/routes/api/auth/login.ts:36:POST /api/auth/login- 1 request per 2 seconds
User Profile Updates
From src/server/routes/api/user/index.ts:52:PATCH /api/user- 1 request per 1 second
Rate Limit Helper
From src/lib/ratelimits.ts:Admin Bypass
Administrators can be configured to bypass rate limits:ADMINSUPERADMIN
ZIPLINE_RATELIMIT_ADMIN_BYPASS=true to enable this feature.
Allow List
Specific keys can be added to an allow list to bypass rate limits:Partial Upload Exemption
Chunked file uploads (partial uploads) bypass standard rate limits when thex-zipline-p-filename header is present:
Rate Limit Headers
When a request is rate limited, Zipline uses the@fastify/rate-limit plugin which typically includes these headers:
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests allowed in the time window |
X-RateLimit-Remaining | Remaining requests in the current window |
X-RateLimit-Reset | Unix timestamp when the rate limit resets |
Retry-After | Seconds until you can retry (when limited) |
Rate Limit Response
When you exceed the rate limit, you’ll receive a 429 status code:Handling Rate Limits
Exponential Backoff
Implement exponential backoff in your client code:Respect Retry-After Header
Always check and respect theRetry-After header:
Configuration Options
Configure rate limiting via environment variables:Monitoring Rate Limits
When rate limits are exceeded, Zipline logs warnings:- Users hitting rate limits frequently
- Potential abuse or bot activity
- Endpoints that may need higher limits
Best Practices
Batch operations when possible
Batch operations when possible
Instead of uploading files one by one, use multi-file upload to reduce the number of API calls.
Cache responses when appropriate
Cache responses when appropriate
For data that doesn’t change frequently (like user stats), cache the response on your client side.
Use appropriate retry logic
Use appropriate retry logic
Always implement exponential backoff and respect the Retry-After header. Never retry immediately in a tight loop.
Monitor your usage
Monitor your usage
Keep track of your API usage patterns and adjust your application logic to stay within limits.
Contact your instance admin
Contact your instance admin
If you consistently hit rate limits during legitimate use, contact your Zipline instance administrator to discuss increasing limits.
Exempt Endpoints
Some endpoints may not have rate limiting applied:- Health check:
/api/healthcheck - Version info:
/api/version - Static file serving
- Public file access (viewing/downloading)
Next Steps
Error Handling
Learn how to handle all API errors
Upload Files
Start uploading files