generated from mintlify/starter
-
Notifications
You must be signed in to change notification settings - Fork 5
add docs for rate limiting #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ieraso-bigc
wants to merge
1
commit into
main
Choose a base branch
from
ivan/red-2451-update-docs-to-talk-about-rate-limit-errors
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| The Makeswift REST API implements rate limiting to ensure fair usage and protect service stability. Rate limits are applied per authentication token across all endpoints. | ||
|
|
||
| --- | ||
|
|
||
| ## Rate Limit Configuration | ||
|
|
||
| ### Limits | ||
|
|
||
| - **Rate**: 100 requests per second | ||
| - **Time Window (TTL)**: 1 second | ||
| - **Scope**: Per authentication token (API key or Bearer token) | ||
|
|
||
| ### What This Means | ||
|
|
||
| Each unique API key or Bearer token is allowed to make up to 100 requests per second. The limit resets every second, providing a rolling window of allowed requests. | ||
|
|
||
| --- | ||
|
|
||
| ## Response Headers | ||
|
|
||
| <Note> | ||
| While both API Key and Bearer Token authentication methods are supported, you | ||
| must use **only one** authentication method per request. Requests that include | ||
| both an API Key and Bearer Token will be rejected. | ||
| </Note> | ||
|
|
||
| ### Rate Limit Headers | ||
|
|
||
| Every API response includes headers showing your current rate limit status: | ||
|
|
||
| ```http | ||
| x-ratelimit-limit: 100 | ||
| x-ratelimit-remaining: 95 | ||
| x-ratelimit-reset: 1 | ||
| ``` | ||
|
|
||
| #### Header Descriptions | ||
|
|
||
| | Header | Description | Example | | ||
| | ----------------------- | -------------------------------------------------- | ------- | | ||
| | `x-ratelimit-limit` | Maximum requests allowed in the current window | `100` | | ||
| | `x-ratelimit-remaining` | Number of requests remaining in the current window | `95` | | ||
| | `x-ratelimit-reset` | Time in seconds until the limit resets | `1` | | ||
|
|
||
| --- | ||
|
|
||
| ## Rate Limit Exceeded | ||
|
|
||
| ### 429 Response | ||
|
|
||
| When you exceed the rate limit, the API returns a `429 Too Many Requests` response: | ||
|
|
||
| **Example Response:** | ||
|
|
||
| ```http | ||
| HTTP/1.1 429 Too Many Requests | ||
| x-ratelimit-limit: 100 | ||
| x-ratelimit-remaining: 0 | ||
| x-ratelimit-reset: 1 | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "statusCode": 429, | ||
| "message": "ThrottlerException: Too Many Requests", | ||
| "error": "Too Many Requests" | ||
| } | ||
| ``` | ||
|
|
||
| ### What to Do | ||
|
|
||
| 1. **Wait**: Wait for the time specified in `x-ratelimit-reset` header (typically 1 second) | ||
| 2. **Retry**: Implement exponential backoff for retries | ||
| 3. **Monitor**: Track the `x-ratelimit-remaining` header to avoid hitting limits | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -326,6 +326,10 @@ | |
| ] | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "group": "Rate limits", | ||
| "pages": ["developer/reference/rate-limits/overview"] | ||
| } | ||
| ] | ||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doc may be too specific. Some of our existing behavior was decided on haphazardly, like having 100 requests per second or the particular way that we do throttling. I think we need to be a lot more generic here in this doc and just say that we implement rate limiting and reserve the right to change it in the future.
I think this can be a comment. I don't think it needs to be an entire document. Sorry if you feel like you're getting whiplash on this.