Skip to content
OnCharge.io
View as Markdown
Developer docs

Limits & errors

Rate limits, sizes and every error the email API returns, with what to do about each.

Rate limit#

Each account can make 20 requests per second across the email API by default. Every response carries the current state:

HeaderMeaning
ratelimit-limitRequests allowed per second.
ratelimit-remainingRequests left in the current second.
ratelimit-resetSeconds until the window resets.
retry-afterOn a 429, how many seconds to wait before retrying.

Over the limit, requests get 429 with rate_limit_exceeded. Wait for retry-after, then retry with the same Idempotency-Key. To send many emails at once, use a batch of up to 1,000 rather than one request per email. If you need more, ask support.

Sizes and counts#

LimitValue
Recipients per email50 in total across to, cc and bcc
Email size40 MB, attachments included, after encoding
Emails per batch1,000 (no attachments, no scheduled_at)
SchedulingUp to 30 days ahead
Idempotency-KeyUp to 256 characters, kept 24 hours
Tag names and valuesASCII letters, numbers, _ and -, up to 256 characters
List page size1 to 100 (default 20)
Email log90 days
Free allowance3,000 emails a month, with no daily cap. Prices: Email & SMS pricing.

Errors#

Every error has the same shape:

JSON
{
  "error": {
    "type": "validation_error",
    "message": "to: at most 50 recipients in total across to, cc and bcc.",
    "param": "to"
  }
}
  • type is one of the values below. Branch on it rather than on the HTTP status.
  • message is meant for people: log it, but don't parse it.
  • param names the field at fault, when there is one.

Error types#

typeUsual statusWhat happenedWhat to do
validation_error400 or 422A field is missing, malformed or over a limit.Fix the request; param says which field. Don't retry unchanged.
authentication_error401The API key is missing, wrong or revoked, or a signed request's signature failed.Check the Authorization header and the key.
permission_error403The key can't do this: a sending key calling another endpoint, or a key limited to another domain.Use a key with the right scope.
not_found404No such email, domain, template or other object in your account.Check the id.
idempotency_conflict409The Idempotency-Key was used in the last 24 hours with a different body.Use a new key for a different email.
domain_not_verified403 or 422The from domain is not verified, or not yet.Verify the domain.
recipient_suppressed422The address is on your suppression list after a bounce, complaint or unsubscribe.Don't retry. See Suppressions.
content_blocked422OnCharge's compliance check refused the content for your store's category. The message says which rule.Change the content. If you think the check is wrong, contact support.
rate_limit_exceeded429Too many requests per second.Wait for retry-after, then retry.
daily_quota_exceeded429The account has reached its sending quota for the day.Retry later, or ask support about your quota.
internal_error500Something failed on OnCharge's side.Retry with the same Idempotency-Key after a short wait.

Retry only rate_limit_exceeded, internal_error and network failures, with a growing wait between tries and the same Idempotency-Key each time, so a retry never sends twice.

The compliance check#

Every email, from the API, SMTP or a marketing flow, is checked before it is sent: against the rules for your store's category, and for claims no store may make, such as promises to cure or treat. Transactional and marketing mail each have their own rules, and the check also looks for promotional wording slipped into transactional mail. When an email is refused, content_blocked tells you which rule applied.