Errors
One shape for every error, and a code you can branch on.
Shape
{
"detail": {
"code": "upload_link_not_found",
"message": "This upload link isn't valid. Make a new one in the portal."
}
}code is stable: branch on it. message is written for a person and may be reworded: show it, do not parse it.
Status codes
| Status | Meaning | Retry? |
|---|---|---|
| 200, 201 | It worked. | - |
| 400 | Something in the request is wrong. The code says what. | No, fix it |
| 401 | Missing or wrong credentials. | No |
| 403 | Not allowed, for example an account not yet approved. | No |
| 404 | Not found, or not yours. | No |
| 409 | The state changed, for example a sale already declined. | Read it again first |
| 413 | The file is over 10 MB. | No, split it |
| 429 | Too many requests. | Yes, after a pause |
| 500, 502, 503 | Our side. | Yes, with backoff |
Retries
Sending the same file twice is harmless: the second does nothing new. Confirm and decline are safe to retry with the same answer. Retry 429 and 5xx with exponential backoff starting at one second.