This document provides curl examples for the MongoDB Atlas Rate Limit Inspection API endpoints with example response bodies.
The Rate Limit Inspection API provides visibility into rate limiting bucket states for debugging and monitoring purposes. These endpoints are available for different scopes: organization, group, and user.
All endpoints require authentication using a Bearer token:
Authorization: Bearer <your-token>
All endpoints use the 2025-03-12 API version:
Accept: application/vnd.atlas.2025-03-12+json
Retrieve rate limiting bucket state for a specific organization.
Request:
curl -X GET \
"http://localhost:8080/api/atlas/v2/orgs/{orgId}/ratelimit" \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Authorization: Bearer <your-token>"Example Response:
{
"scope": "ORGANIZATION",
"scopeId": "507f1f77bcf86cd799439011",
"limits": [
{
"name": "Rate Limits Inspection",
"capacity": 100,
"remaining": 73
}
]
}Retrieve rate limiting bucket state for a specific group.
Request:
curl -X GET \
"http://localhost:8080/api/atlas/v2/groups/{groupId}/ratelimit" \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Authorization: Bearer <your-token>"Example Response:
{
"scope": "GROUP",
"scopeId": "507f1f77bcf86cd799439012",
"limits": [
{
"name": "Rate Limits Inspection",
"capacity": 100,
"remaining": 85
}
]
}Retrieve rate limiting bucket state for the current user.
Request:
curl -X GET \
"http://localhost:8080/api/atlas/v2/ratelimit" \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Authorization: Bearer <your-token>"Example Response:
{
"scope": "USER",
"scopeId": null,
"limits": [
{
"name": "Rate Limits Inspection",
"capacity": 100,
"remaining": 92
}
]
}| Field | Type | Description |
|---|---|---|
scope |
string | The rate limit scope being inspected (ORGANIZATION, GROUP, USER, or IP) |
scopeId |
string or null | The identifier for the scope (organization ID, group ID, user ID, or IP address). Can be null for user scope |
limits |
array | Array of active rate limit bucket configurations and their current states |
| Field | Type | Description | Example |
|---|---|---|---|
name |
string | Name/identifier of the rate limit rule | "Rate Limits Inspection" |
capacity |
number | Maximum capacity of the token bucket | 100 |
remaining |
number | Current number of tokens remaining in the bucket | 73 |
When rate limiting is disabled in the system, all endpoints return a simple string response:
"Rate limiting is disabled"If an error occurs during rate limit state retrieval:
{
"error": "Internal server error"
}- These endpoints are marked as
@Hiddenin the OpenAPI specification and are intended for debugging and monitoring purposes - The actual values for
capacityandremainingdepend on the rate limit configuration and current API usage - Rate limit scopes follow a hierarchy: GROUP > ORGANIZATION > USER > IP
- The
scopeIdfield will benullfor user scope requests as they don't require a specific identifier - All endpoints require appropriate role permissions (e.g.,
ORG_OWNER,ORG_READ_ONLYfor organization endpoints)
The system uses the following priority order for determining rate limit scope:
- GROUP - Takes precedence when a group context is available
- ORGANIZATION - Used when organization context is available but no group context
- USER - Applied when user is authenticated but no group/organization context
- IP - Fallback scope for unauthenticated requests or when no other scope is available
# Check rate limit status for organization
curl -X GET \
"http://localhost:8080/api/atlas/v2/orgs/507f1f77bcf86cd799439011/ratelimit" \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."# Check rate limit status for a specific group
curl -X GET \
"http://localhost:8080/api/atlas/v2/groups/507f1f77bcf86cd799439012/ratelimit" \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."# Check current user's rate limit status
curl -X GET \
"http://localhost:8080/api/atlas/v2/ratelimit" \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."