Errors
Every error comes back as JSON with amessage in plain words. Some errors also carry a machine-readable error code, and validation errors can name the field in parameter:
We’re moving every error to one shape,
{ "error": "<code>", "message": "…" }, with the usual statuses: 401 for a bad key, 403 for a missing permission, 402 for a missing subscription. This page will be updated the day that ships. Until then, act on the HTTP status, use error when it’s there, and don’t parse message.Status codes
Rough edges
A few errors don’t look the way they should yet. Until the next API update:- Adding a participant without
programanswers500. - An invalid email address, or a first and last name longer than 24 characters together, answers
400with a message that doesn’t say which. Check both before you send them. - On some older plans, running out of invitations answers
500with a message that starts “Not enough remaining invitations”. - A
500can carry internal error text. Log it, but don’t show it to your users. - The per-address rate limit answers in plain text, not JSON (see Rate limits).
Retrying safely
- Retry
429,503and5xxresponses with exponential backoff (for example 1, 2, 4, 8 seconds, up to a minute), and wait at leastRetry-Afterwhen it’s there. Don’t retry other4xxresponses unchanged. - When you add participants, always send an
Idempotency-Key. Generate a UUID for each add and reuse it on every retry of that add. Hoppier then adds the person once, however many times the request arrives. How the key works. - Adding someone who’s already in the program normally returns their existing record instead of adding them twice, but only an
Idempotency-Keyguarantees that a retry is safe.
Rate limits
Two limits apply to every request:
Reads are the
GET requests and writes are the POST requests. All the keys in a company share the account limit, and Hoppier’s Zapier app counts towards it too.
If Hoppier can’t check the account limit, reads go through and writes answer 503 with error: rate_limit_unavailable and Retry-After: 5. Nothing was written, so retry.