Platform
Rate Limits
Which endpoints are rate limited, the exact limits and scopes, the 429 response format, and how to handle throttled requests.
Overview
PaymentHooks applies rate limits to security-sensitive and resource-intensive endpoints: authentication, MFA, OAuth, the webhook simulator, card tokenization, and custom-domain management. Each limit uses a fixed counting window scoped to a client IP, a session, or a merchant, as listed below. When a limit is exceeded the API responds with HTTP 429 Too Many Requests and the error code RATE_LIMITED.
Every request made with an API key also counts against your plan's API limits: a per-second rate and a monthly quota, described in the next section. Treat any 429 as retryable, as described in the best practices below.
Plan API limits
Requests authenticated with an API key (secret or publishable) count toward two limits of your plan, per account across all its keys. Requests from the dashboard are not counted. Your current limits and this month's usage are in Settings > Plans & Usage; your account may have custom limits.
- Requests per second. Over it, the request is refused with
429 RATE_LIMITEDandRetry-After: 1. Refused requests do not count toward the monthly quota. - Requests per calendar month (UTC). Every successful response carries
X-RateLimit-Limit,X-RateLimit-RemainingandX-RateLimit-Reset(Unix seconds, the start of next month). On plans that block at the quota, further requests return429 API_QUOTA_EXCEEDEDwithRetry-Afteruntil the quota resets or you upgrade. On plans that alert only, requests continue and you are emailed. - Usage emails. You are emailed once per month as you reach 75% and 90% of the quota (unless your plan sets other levels), and at 100%.
| Plan | Requests / second | Requests / month | At the monthly quota |
|---|---|---|---|
| Free | 5 | 10,000 | Refused (429 API_QUOTA_EXCEEDED) |
| Starter | 25 | 100,000 | Continues; you are emailed |
| Growth | 50 | 1,000,000 | Continues; you are emailed |
| Business | 100 | 5,000,000 | Continues; you are emailed |
| Enterprise | Unlimited | Unlimited | Not applicable |
Default limits of each plan. The limits that apply to your account are on Settings > Plans & Usage.
Rate-limited endpoints
All paths are relative to https://paymenthooks.com/api/v1. Sign-in counts only failed attempts, so a shared office IP is not locked out by one person's typos; its 429 carries Retry-After and a message saying when sign-in reopens. Sign-up and account-recovery endpoints share one counter per IP, so five combined requests within 15 minutes exhaust it.
| Endpoint | Routes | Limit | Window | Scope |
|---|---|---|---|---|
| Sign-in | POST /auth/session | 5 failed sign-ins per account from one IP; 20 per account; 50 per IP | 15 minutes | Only failures count; a successful sign-in clears the account's counter for that client |
| Sign-up and account recovery | POST /auth/signup, /auth/forgot-password, /auth/reset-password, /auth/magic-link, /newsletter, team invite acceptance | 5 requests (shared) | 15 minutes | Per client IP |
| Test email | POST /communications/test-email | 10 requests | 1 hour | Per merchant |
| OAuth sign-in | /auth/oauth/:provider/start, /callback, /auth/oauth/link/:provider/start | 20 requests | 15 minutes | Per client IP, provider and step |
| MFA verification | POST /auth/mfa | 5 attempts | 5 minutes | Per client IP |
| Webhook simulate | POST /webhooks/simulate | 20 requests | 1 minute | Per dashboard session |
| Client log submission | POST /logs | 60 requests | 1 minute | Per client IP |
| Payment Element tokenize | POST /payment-element/tokenize | 20 requests | 1 minute | Per Payment Element token |
| Custom domain create / update / delete | POST /custom-domains, PATCH and DELETE /custom-domains/:id | 20 requests | 1 minute | Per merchant |
| Custom domain verify / SSL retry | POST /custom-domains/:id/verify, /custom-domains/:id/ssl/retry | 10 requests | 1 minute | Per merchant |
| Custom domain DNS check | POST /custom-domains/:id/dns-check | 30 requests | 1 minute | Per merchant and domain |
429 response format
A throttled request returns HTTP 429 with the standard response envelope. The message varies by endpoint; branch on error.code, never on the message text.
{"data": null,"error": {"code": "RATE_LIMITED","message": "Too many requests. Please try again later."}}
Retry-After header
Plan API limits and the custom-domain endpoints include a Retry-After header (in seconds) on their 429 responses. The other rate-limited endpoints do not send Retry-After; for those, wait for the window listed in the table above or back off exponentially.
Best practices
Follow these recommendations to stay within limits and recover cleanly from throttling.
- Implement exponential backoff. When retrying after a 429, increase the delay exponentially (for example 1s, 2s, 4s, 8s) and add jitter so concurrent workers do not retry in lockstep.
- Use Retry-After when it is sent. If the response carries a Retry-After header, wait at least that many seconds before the next attempt.
- Use webhooks instead of polling. Subscribe to webhook events for payment and subscription state changes rather than repeatedly fetching the same resources.
- Keep credential flows interactive. Login, signup, password reset and MFA limits are deliberately strict and shared per IP. Do not script these endpoints from servers that sit behind a shared egress IP.
- Retry safely with Idempotency-Key. When retrying a POST that creates a refund, capture, subscription, checkout session or webhook endpoint, reuse the same Idempotency-Key header; for POST /payments, reuse the same idempotencyKey body field. A retried request then cannot create a duplicate.
SDK rate limit handling
The Node.js SDK (@paymenthooks/sdk 2.0.0 or later) does not retry automatically. A 429 throws a RateLimitError whose retryAfter holds the Retry-After seconds, or null when the header is absent. Decide on retries in your own code, and reuse the same idempotency key when you retry a write.
import { PaymentHooks, RateLimitError } from '@paymenthooks/sdk';const ph = new PaymentHooks({ apiKey: process.env.PAYMENTHOOKS_SECRET_KEY });try {const { data, meta } = await ph.customers.list({ pageSize: 25 });} catch (err) {if (err instanceof RateLimitError) {// Not retried by the SDK: wait err.retryAfter seconds (or back off), then retry}throw err;}