Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: correct Auth rate limit details (#49772)

ŁUKASZ KORBASIEWICZ8121df5b0a18
diff --git a/apps/docs/content/_partials/auth_rate_limits.mdx b/apps/docs/content/_partials/auth_rate_limits.mdx
index e4b7d7e5319..07d32e0a3d4 100644
--- a/apps/docs/content/_partials/auth_rate_limits.mdx
+++ b/apps/docs/content/_partials/auth_rate_limits.mdx
@@ -1,11 +1,13 @@
-| Operation | Path | Limited By | Customizable | Limit |
-| ---------------------------------- | -------------------------------------------------------------- | ------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| Endpoints that trigger email sends | `/auth/v1/signup` `/auth/v1/recover` `/auth/v1/user` | Sum of combined requests project-wide | Custom SMTP Only | <SharedData data="config">auth.rate_limits.email.inbuilt_smtp_per_hour</SharedData> emails per hour with the built-in email provider. You can only change this with a custom SMTP setup. The rate limit is only applied on `/auth/v1/user` if this endpoint is called to update the user's email address. |
-| Send One-Time-Passwords (OTP) | `/auth/v1/otp` | Sum of combined requests project-wide | Yes | Defaults to <SharedData data="config">auth.rate_limits.otp.requests_per_hour</SharedData> OTPs per hour. |
-| Send OTPs or magic links | `/auth/v1/otp` | Last request of the user | Yes | Defaults to <SharedData data="config">auth.rate_limits.otp.period</SharedData> window before a new request is allowed to the same user. |
-| Signup confirmation request | `/auth/v1/signup` | Last request of the user | Yes | Defaults to <SharedData data="config">auth.rate_limits.signup_confirmation.period</SharedData> window before a new request is allowed to the same user. |
-| Password Reset Request | `/auth/v1/recover` | Last request of the user | Yes | Defaults to <SharedData data="config">auth.rate_limits.password_reset.period</SharedData> window before a new request is allowed to the same user. |
-| Verification requests | `/auth/v1/verify` | IP Address | No | <SharedData data="config">auth.rate_limits.verification.requests_per_hour</SharedData> requests per hour (with bursts up to <SharedData data="config">auth.rate_limits.verification.requests_burst</SharedData> requests) |
-| Token refresh requests | `/auth/v1/token` | IP Address | No | <SharedData data="config">auth.rate_limits.token_refresh.requests_per_hour</SharedData> requests per hour (with bursts up to <SharedData data="config">auth.rate_limits.token_refresh.requests_burst</SharedData> requests) |
-| Create or Verify an MFA challenge | `/auth/v1/factors/:id/challenge` `/auth/v1/factors/:id/verify` | IP Address | No | <SharedData data="config">auth.rate_limits.mfa.requests_per_hour</SharedData> requests per hour (with bursts up to <SharedData data="config">auth.rate_limits.verification.mfa</SharedData> requests) |
-| Anonymous sign-ins | `/auth/v1/signup` | IP Address | No | <SharedData data="config">auth.rate_limits.anonymous_signin.requests_per_hour</SharedData> requests per hour (with bursts up to <SharedData data="config">auth.rate_limits.anonymous_signin.requests_burst</SharedData> requests). Rate limit only applies if this endpoint is called without passing in an email or phone number in the request body. |
+| Operation | Path | Limited By | Customizable | Limit |
+| ---------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Emails sent by Supabase Auth | All email-sending Auth endpoints | Project | Custom SMTP or Send Email hook | <SharedData data="config">auth.rate_limits.email.inbuilt_smtp_per_hour</SharedData> emails per hour with the built-in email provider. You can configure this limit when you use custom SMTP or the Send Email hook. |
+| SMS messages sent by Supabase Auth | All SMS-sending Auth endpoints | Project | Yes | Defaults to <SharedData data="config">auth.rate_limits.sms.requests_per_hour</SharedData> SMS messages per hour. |
+| Sign-ups and sign-ins | `/auth/v1/signup` `/auth/v1/recover` `/auth/v1/resend` `/auth/v1/magiclink` `/auth/v1/otp` `/auth/v1/user` | IP Address | Yes | Defaults to <SharedData data="config">auth.rate_limits.sign_in_sign_ups.requests_per_five_minutes</SharedData> requests per 5 minutes, with bursts up to <SharedData data="config">auth.rate_limits.sign_in_sign_ups.requests_burst</SharedData> requests. This limit excludes anonymous sign-ins. |
+| Send OTPs or magic links | `/auth/v1/otp` | User | Yes | Defaults to a <SharedData data="config">auth.rate_limits.otp.period</SharedData> window before a new request is allowed for the same user. |
+| Signup confirmation request | `/auth/v1/signup` | User | Yes | Defaults to a <SharedData data="config">auth.rate_limits.signup_confirmation.period</SharedData> window before a new request is allowed for the same user. |
+| Password reset request | `/auth/v1/recover` | User | Yes | Defaults to a <SharedData data="config">auth.rate_limits.password_reset.period</SharedData> window before a new request is allowed for the same user. |
+| Verification requests | `/auth/v1/verify` | IP Address | Yes | Defaults to <SharedData data="config">auth.rate_limits.verification.requests_per_five_minutes</SharedData> requests per 5 minutes, with bursts up to <SharedData data="config">auth.rate_limits.verification.requests_burst</SharedData> requests. |
+| Token endpoint requests | `/auth/v1/token` | IP Address | Yes | Defaults to <SharedData data="config">auth.rate_limits.token_refresh.requests_per_five_minutes</SharedData> requests per 5 minutes, with bursts up to <SharedData data="config">auth.rate_limits.token_refresh.requests_burst</SharedData> requests. This covers password, refresh token, ID token, and PKCE grants. |
+| Create or verify an MFA challenge | `/auth/v1/factors/:id/challenge` `/auth/v1/factors/:id/verify` | IP Address | No | <SharedData data="config">auth.rate_limits.mfa.requests_per_minute</SharedData> requests per minute, with bursts up to <SharedData data="config">auth.rate_limits.mfa.requests_burst</SharedData> requests. |
+| Anonymous sign-ins | `/auth/v1/signup` | IP Address | Yes | Defaults to <SharedData data="config">auth.rate_limits.anonymous_signin.requests_per_hour</SharedData> requests per hour, with a burst capacity equal to the configured limit. This limit only applies if the endpoint is called without an email or phone number in the request body. |
+| Web3 sign-ups and sign-ins | `/auth/v1/token` | IP Address | Yes | Defaults to <SharedData data="config">auth.rate_limits.web3.requests_per_five_minutes</SharedData> requests per 5 minutes, with bursts up to <SharedData data="config">auth.rate_limits.web3.requests_burst</SharedData> requests. |
diff --git a/apps/docs/content/guides/auth/rate-limits.mdx b/apps/docs/content/guides/auth/rate-limits.mdx
index 2d6f7ef0c9e..7b51ee6ec9a 100644
--- a/apps/docs/content/guides/auth/rate-limits.mdx
+++ b/apps/docs/content/guides/auth/rate-limits.mdx
@@ -36,9 +36,9 @@ curl -X PATCH "https://api.supabase.com/v1/projects/$PROJECT_REF/config/auth" \
Supabase Auth uses a token bucket algorithm for endpoint operations that are limited by IP address.
-Each bucket has a maximum capacity of 30 requests. When the bucket is full, brief bursts of up to 30 requests can be allowed in a short period. Once the bucket empties, requests are rate limited until tokens refill. The rate limit defines the rate at which the bucket is refilled.
+Most buckets have a maximum capacity of 30 requests. When a bucket is full, brief bursts of up to 30 requests can be allowed in a short period. Anonymous sign-ins are an exception: the bucket capacity matches the configured number of anonymous sign-ins per hour. Once a bucket empties, requests are rate limited until tokens refill. The rate limit defines the rate at which the bucket is refilled.
-This means a client that has been idle will tolerate a brief spike in traffic, but sustained request above the rate limit are denied. When rate limits are exceeded, a **429 Too Many Requests** error is returned.
+This means a client that has been idle will tolerate a brief spike in traffic, but sustained requests above the rate limit are denied. When rate limits are exceeded, a **429 Too Many Requests** error is returned.
The table below shows the rate limit quotas and additional details for authentication endpoints.
diff --git a/packages/shared-data/config.ts b/packages/shared-data/config.ts
index 01f390522ce..6c21f5b8101 100644
--- a/packages/shared-data/config.ts
+++ b/packages/shared-data/config.ts
@@ -40,13 +40,26 @@ const config = {
value: 1,
unit: 'hour',
},
+ },
+ sms: {
/**
- * How many OTPs can be requested per hour.
+ * The number of SMS messages that can be sent per hour.
*/
requests_per_hour: {
value: 30,
},
},
+ sign_in_sign_ups: {
+ /**
+ * The number of sign-up and sign-in requests allowed per IP address every five minutes.
+ */
+ requests_per_five_minutes: {
+ value: 30,
+ },
+ requests_burst: {
+ value: 30,
+ },
+ },
signup_confirmation: {
/**
* Wait time between requests.
@@ -66,29 +79,40 @@ const config = {
},
},
verification: {
- requests_per_hour: {
- value: 360,
+ requests_per_five_minutes: {
+ value: 30,
},
requests_burst: {
value: 30,
},
},
token_refresh: {
- requests_per_hour: {
- value: 1800,
+ requests_per_five_minutes: {
+ value: 150,
},
requests_burst: {
value: 30,
},
},
mfa: {
- requests_per_hour: {
+ requests_per_minute: {
value: 15,
},
requests_burst: {
value: 30,
},
},
+ web3: {
+ /**
+ * The number of Web3 sign-up and sign-in requests allowed per IP address every five minutes.
+ */
+ requests_per_five_minutes: {
+ value: 30,
+ },
+ requests_burst: {
+ value: 30,
+ },
+ },
anonymous_signin: {
requests_per_hour: {
value: 30,