Skip to content

Commit a0643cb

Browse files
committed
docs(api-server): update rate-limiting documentation
- Clarify the identification strategies for different endpoint types - Refine explanations of rate-limiting configurations - Improve consistency and clarity in documentation
1 parent 14833f3 commit a0643cb

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/content/docs/api-server/features/rate-limiting.mdx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@ This is crucial for preventing abuse, such as brute-force attacks on the authent
1111

1212
### How It Works
1313

14-
The rate-limiting mechanism is implemented as a middleware that runs on specific routes. It uses the client's IP address to identify unauthenticated requests and the user's ID for authenticated requests.
14+
The rate-limiting mechanism is implemented as a middleware that runs on specific routes. It uses a different strategy for identifying clients depending on the endpoint's sensitivity and authentication requirements.
1515

1616
There are two distinct rate-limiting configurations applied to different parts of the API:
1717

18-
1. **Sensitive Endpoint Limiting:**
18+
1. **IP-Based Limiting for Sensitive Unauthenticated Endpoints:**
1919
- **Target:** The `/api/v1/auth/request-code` endpoint.
20-
- **Purpose:** This endpoint is more sensitive as it triggers an email to be sent. The rate limit here is intentionally strict to prevent spamming users with verification codes.
21-
- **Default Limit:** 3 requests per 24 hours.
20+
- **Identification:** Requests are tracked by the client's **IP address**.
21+
- **Purpose:** This endpoint is unauthenticated and triggers a costly action (sending an email). The rate limit is strict to prevent anonymous users from spamming the service.
22+
- **Default Limit:** 3 requests per IP address per 24 hours.
2223

23-
2. **General Data API Limiting:**
24+
2. **User-Based Limiting for Authenticated Endpoints:**
2425
- **Target:** All endpoints under `/api/v1/data`.
25-
- **Purpose:** This provides a generous limit for general application usage while still protecting the server from excessively frequent requests from a single client.
26-
- **Default Limit:** 1000 requests per 60 minutes.
26+
- **Identification:** Requests are tracked by the authenticated **user's ID**.
27+
- **Purpose:** This provides a generous limit for general application usage while still protecting the server from excessively frequent requests from a single authenticated user.
28+
- **Default Limit:** 1000 requests per user per 60 minutes.
2729

2830
<Aside type="note" title="Bypassing Limits">
2931
Users with the `admin` or `publisher` role automatically bypass all rate limits, ensuring that administrative tasks are never blocked.

0 commit comments

Comments
 (0)