Errors and limits
The error envelope
Section titled “The error envelope”Every error has the same shape, and every response has a Sunny-Trace-Id header. Quote it when you ask us about a call.
{ "error": { "type": "validation_error", "code": "invalid_field", "message": "search_area.radius_miles must be between 1 and 100.", "param": "search_area.radius_miles", "trace_id": "trc_01JD…" }}A 422 reports every invalid field in error.errors[], each with param, code and message; the first is also at the top level. Error messages never repeat what you sent.
Statuses
Section titled “Statuses”| Status | type |
code |
What to do |
|---|---|---|---|
400 |
invalid_request |
malformed_json, unsupported_content_type |
Fix the request. |
401 |
authentication_error |
missing_key, invalid_key |
Check the key. |
403 |
permission_error |
missing_permission, live_key_required, sandbox_key_required, unknown_partner |
The key may not do this. |
404 |
not_found |
request_not_found, route_not_found |
No such request for this key. Also returned for a request of the other mode. |
409 |
conflict |
invalid_state, idempotency_conflict |
Read the request with GET. |
413 |
invalid_request |
body_too_large, file_too_large |
Send less. |
422 |
validation_error |
invalid_field, missing_field, unknown_field, unsupported_file_type, minor_not_supported, unknown_zip |
Fix the fields named. Do not retry unchanged. |
429 |
rate_limit_error |
rate_limited |
Wait for Retry-After seconds. |
500 |
api_error |
internal |
Retry with the same Idempotency-Key, backing off. |
503 |
api_error |
temporarily_unavailable |
The same. |
Idempotency
Section titled “Idempotency”Idempotency-Key is accepted on every POST. Any string up to 255 characters; a UUID is a good choice.
- The key is kept for 24 hours.
- Same key, same path and body: the first response is replayed, with
Idempotent-Replayed: true. For reschedule, cancel and stop the replay answers with the request as it is now. - Same key, different path or body:
409 idempotency_conflict. - A call still in flight with that key:
409 idempotency_conflictwithRetry-After. - No key: a repeated create makes a second request.
Rate limits
Section titled “Rate limits”Per API key:
| Group | Default limit |
|---|---|
Writes (POST) |
60 per minute |
Reads (GET) |
600 per minute |
Every response carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset. A 429 carries Retry-After. If you need higher limits, ask us.
Retrying
Section titled “Retrying”4xxother than429: do not retry the same request.429: wait forRetry-After.5xx, a timeout or a dropped connection: retry with the sameIdempotency-Key, backing off between tries.