- Docs
- Platform
Rate limits
How rate limits work, and what to do when you hit one.
Myela limits how many requests reach the API from one place in a minute. Past the limit you get a 429. Wait, then send the request again.
How limits work
Section titled “How limits work”- Limits are per client IP address, per minute. They aren’t tied to your key, and they’re checked before your key is.
- The card-capture routes that Myela Elements calls (
POST /v1/checkout_sessionsandPOST /v1/tokens) allow 60 requests a minute from one client IP address. - The rest of
/v1, invoices and bulk jobs included, allows 300 requests a minute from one client IP address. Treat that as the most you should send, not a ceiling you can rely on hitting exactly. - The response headers
RateLimitandRateLimit-Policycarry the limit that applies to you. Read it from there rather than hard-coding a number. The olderX-RateLimit-*headers aren’t sent.
When you’re limited
Section titled “When you’re limited”A limited request is refused with 429 and code: rate_limited. The body also carries a legacy type field; branch on code.
{
"error": {
"code": "rate_limited",
"type": "RATE_LIMITED",
"message": "Too many requests. Slow down and try again shortly."
}
}A 429 can also come from further upstream, when a payment network asks Myela to slow down. That one arrives without the RateLimit headers. Treat both the same way.
Backing off
Section titled “Backing off”Wait before you retry, and wait longer each time it happens again. Add some randomness to the wait so a batch of clients doesn’t retry in step. The Node SDK does this for you: by default it retries a 429 twice, after a random wait of up to 8 seconds that grows with each attempt.
If you see 429s often, spread your requests out instead of sending them in bursts.
Retrying payments after a 429
Section titled “Retrying payments after a 429”Whether a retry reuses the Idempotency-Key depends on the operation:
- A payment create refused with
429can be retried under the same key. The retry is a new attempt. - A capture refused with
429is final under its key. Retry it with a new key.
More in Idempotency and retries.