Skip to content
myela

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.

  • 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_sessions and POST /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 RateLimit and RateLimit-Policy carry the limit that applies to you. Read it from there rather than hard-coding a number. The older X-RateLimit-* headers aren’t sent.

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.

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.

Whether a retry reuses the Idempotency-Key depends on the operation:

  • A payment create refused with 429 can be retried under the same key. The retry is a new attempt.
  • A capture refused with 429 is final under its key. Retry it with a new key.

More in Idempotency and retries.