🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Update API key rate limits and documentation
Bill Yang3c7b4002fedd
diff --git a/client/src/app/subscribe/components/utils.ts b/client/src/app/subscribe/components/utils.tsindex 2a382c73a..a616e9988 100644--- a/client/src/app/subscribe/components/utils.ts+++ b/client/src/app/subscribe/components/utils.ts@@ -38,6 +38,7 @@ export const PRO_FEATURES = ["Unlimited team members","Session replays","5 year data retention",+ "10x higher API rate limit","Priority support",];diff --git a/docs/content/docs/api/getting-started.mdx b/docs/content/docs/api/getting-started.mdxindex a0816fc6e..ee10faba3 100644--- a/docs/content/docs/api/getting-started.mdx+++ b/docs/content/docs/api/getting-started.mdx@@ -53,10 +53,19 @@ API keys are user-scoped and grant organization-level access:4. Click **Create**5. Copy the key immediately (it won't be shown again)-### Rate Limits+### Rate Limits (Cloud Only)-- **500 requests per 10 minutes** per API key-- Keys are tied to your user account and grant access to all sites in your organization(s)+API key rate limits depend on your plan:++| Plan | Limit |+|------|-------|+| **Free / Basic** | API keys not available |+| **Standard** | 20 requests per minute |+| **Pro** | 200 requests per minute |++Self-hosted instances have no rate limits.++Keys are tied to your user account and grant access to all sites in your organization(s).---@@ -466,28 +475,3 @@ All endpoints return standard HTTP status codes:"error": "Error message describing what went wrong"}```-------## Best Practices--1. **Cache responses** - Analytics data doesn't change frequently. Cache for at least 5-10 minutes.-2. **Use date ranges** - For recent data, use `past_minutes_start/end`. For historical data, use `start_date/end_date`.-3. **Filter strategically** - Apply filters to reduce data transfer and improve performance.-4. **Paginate results** - Use the `limit` and `page` parameters for large datasets.-5. **Monitor rate limits** - Implement exponential backoff if you receive 429 responses.-------## Rate Limiting--When you exceed the rate limit, you'll receive a `429 Too Many Requests` response:--```json-{- "success": false,- "error": "Rate limit exceeded. Maximum 500 requests per 10 minutes per API key."-}-```--Wait for the rate limit window to reset before making additional requests.diff --git a/docs/messages/de.json b/docs/messages/de.jsonindex 7ce6ea6df..953685a9e 100644--- a/docs/messages/de.json+++ b/docs/messages/de.json@@ -351,6 +351,7 @@"nWzeQr": "Unbegrenzte Websites","yuDloY": "Unbegrenzte Teammitglieder","4kI/Um": "5 Jahre Datenspeicherung",+ "uHjOjD": "","3sSrKz": "Prioritätssupport","EQO1QO": "Alles aus Pro","6UyKes": "Unbegrenzte Datenspeicherung",diff --git a/docs/messages/en.json b/docs/messages/en.jsonindex 593a773a1..521cdec29 100644--- a/docs/messages/en.json+++ b/docs/messages/en.json@@ -351,6 +351,7 @@"nWzeQr": "Unlimited websites","yuDloY": "Unlimited team members","4kI/Um": "5 year data retention",+ "uHjOjD": "10x higher API rate limit","3sSrKz": "Priority support","EQO1QO": "Everything in Pro","6UyKes": "Infinite data retention",diff --git a/docs/messages/es.json b/docs/messages/es.jsonindex b4781be14..7e5674263 100644--- a/docs/messages/es.json+++ b/docs/messages/es.json@@ -351,6 +351,7 @@"nWzeQr": "Sitios web ilimitados","yuDloY": "Miembros del equipo ilimitados","4kI/Um": "Retención de datos de 5 años",+ "uHjOjD": "","3sSrKz": "Soporte prioritario","EQO1QO": "Todo lo incluido en Pro","6UyKes": "Retención de datos infinita",diff --git a/docs/messages/fr.json b/docs/messages/fr.jsonindex 02a3bfad5..a3636d41c 100644--- a/docs/messages/fr.json+++ b/docs/messages/fr.json@@ -351,6 +351,7 @@"nWzeQr": "Sites web illimités","yuDloY": "Membres de l'équipe illimités","4kI/Um": "Conservation des données 5 ans",+ "uHjOjD": "","3sSrKz": "Support prioritaire","EQO1QO": "Tout inclus dans Pro","6UyKes": "Conservation des données illimitée",diff --git a/docs/messages/it.json b/docs/messages/it.jsonindex db55b1b8b..ae896428a 100644--- a/docs/messages/it.json+++ b/docs/messages/it.json@@ -351,6 +351,7 @@"nWzeQr": "Siti web illimitati","yuDloY": "Membri del team illimitati","4kI/Um": "Conservazione dati 5 anni",+ "uHjOjD": "","3sSrKz": "Supporto prioritario","EQO1QO": "Tutto incluso nel piano Pro","6UyKes": "Conservazione dati infinita",diff --git a/docs/messages/ja.json b/docs/messages/ja.jsonindex c2ee3660b..ed5d211b7 100644--- a/docs/messages/ja.json+++ b/docs/messages/ja.json@@ -351,6 +351,7 @@"nWzeQr": "無制限のサイト","yuDloY": "無制限のチームメンバー","4kI/Um": "5年間データ保持",+ "uHjOjD": "","3sSrKz": "優先サポート","EQO1QO": "プロのすべてを含む","6UyKes": "無期限データ保持",diff --git a/docs/messages/ko.json b/docs/messages/ko.jsonindex 94b04c3e7..41a47b2d9 100644--- a/docs/messages/ko.json+++ b/docs/messages/ko.json@@ -351,6 +351,7 @@"nWzeQr": "무제한 웹사이트","yuDloY": "무제한 팀 멤버","4kI/Um": "5년 데이터 보관",+ "uHjOjD": "","3sSrKz": "우선 지원","EQO1QO": "Pro의 모든 기능 포함","6UyKes": "무기한 데이터 보관",diff --git a/docs/messages/pl.json b/docs/messages/pl.jsonindex 0bc884bf3..5af757cdd 100644--- a/docs/messages/pl.json+++ b/docs/messages/pl.json@@ -351,6 +351,7 @@"nWzeQr": "Nieograniczone witryny","yuDloY": "Nieograniczona liczba członków zespołu","4kI/Um": "Przechowywanie danych przez 5 lat",+ "uHjOjD": "","3sSrKz": "Wsparcie priorytetowe","EQO1QO": "Wszystko z planu Pro","6UyKes": "Nieskończone przechowywanie danych",diff --git a/docs/messages/pt.json b/docs/messages/pt.jsonindex 2f910a2da..3f0df71a4 100644--- a/docs/messages/pt.json+++ b/docs/messages/pt.json@@ -351,6 +351,7 @@"nWzeQr": "Sites ilimitados","yuDloY": "Membros de equipe ilimitados","4kI/Um": "Retenção de dados por 5 anos",+ "uHjOjD": "","3sSrKz": "Suporte prioritário","EQO1QO": "Tudo do plano Pro","6UyKes": "Retenção de dados infinita",diff --git a/docs/messages/zh.json b/docs/messages/zh.jsonindex 038cf4ef3..c86b1e37a 100644--- a/docs/messages/zh.json+++ b/docs/messages/zh.json@@ -351,6 +351,7 @@"nWzeQr": "无限网站","yuDloY": "无限团队成员","4kI/Um": "5 年数据保留期",+ "uHjOjD": "","3sSrKz": "优先支持","EQO1QO": "专业版全部功能","6UyKes": "永久数据保留",diff --git a/docs/src/components/PricingSection.tsx b/docs/src/components/PricingSection.tsxindex 5e8969414..b29b1a1e5 100644--- a/docs/src/components/PricingSection.tsx+++ b/docs/src/components/PricingSection.tsx@@ -91,6 +91,7 @@ export function PricingSection({ isAnnual, setIsAnnual }: { isAnnual: boolean, st("Sessions"),t("Email reports"),t("2 year data retention"),+ t("API access"),t("Email support"),];@@ -100,6 +101,7 @@ export function PricingSection({ isAnnual, setIsAnnual }: { isAnnual: boolean, st("Unlimited team members"),t("Session replays"),t("5 year data retention"),+ t("10x higher API rate limit"),t("Priority support"),];diff --git a/server/src/api/user/createApiKey.ts b/server/src/api/user/createApiKey.tsindex bd9a24102..13b0cadf8 100644--- a/server/src/api/user/createApiKey.ts+++ b/server/src/api/user/createApiKey.ts@@ -28,7 +28,9 @@ export async function createUserApiKey(return reply.status(400).send({ error: "Name is required" });}- let rateLimitMax = STANDARD_API_RATE_LIMIT;+ let rateLimitEnabled = false;+ let rateLimitMax: number | undefined;+ let rateLimitTimeWindow: number | undefined;if (IS_CLOUD) {const activeOrgId = (session.session as any).activeOrganizationId;@@ -45,9 +47,12 @@ export async function createUserApiKey(});}- if (planName.includes("pro") || planName === "custom") {- rateLimitMax = PRO_API_RATE_LIMIT;- }+ rateLimitEnabled = true;+ rateLimitTimeWindow = API_RATE_LIMIT_WINDOW;+ rateLimitMax =+ planName.includes("pro") || planName === "custom"+ ? PRO_API_RATE_LIMIT+ : STANDARD_API_RATE_LIMIT;}try {@@ -55,8 +60,8 @@ export async function createUserApiKey(body: {name,expiresIn: expiresIn ?? undefined,- rateLimitEnabled: true,- rateLimitTimeWindow: API_RATE_LIMIT_WINDOW,+ rateLimitEnabled,+ rateLimitTimeWindow,rateLimitMax,userId: session.user.id,},diff --git a/server/src/lib/auth.ts b/server/src/lib/auth.tsindex 597dc1672..e57e7ae75 100644--- a/server/src/lib/auth.ts+++ b/server/src/lib/auth.ts@@ -19,11 +19,15 @@ dotenv.config();const pluginList = [admin(),apiKey({- rateLimit: {- enabled: true,- timeWindow: API_RATE_LIMIT_WINDOW,- maxRequests: STANDARD_API_RATE_LIMIT,- },+ ...(IS_CLOUD+ ? {+ rateLimit: {+ enabled: true,+ timeWindow: API_RATE_LIMIT_WINDOW,+ maxRequests: STANDARD_API_RATE_LIMIT,+ },+ }+ : {}),}),dash(),organization({