Errors

One shape for every error, and a code you can branch on.

Shape

Error
{
  "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

StatusMeaningRetry?
200, 201It worked.-
400Something in the request is wrong. The code says what.No, fix it
401Missing or wrong credentials.No
403Not allowed, for example an account not yet approved.No
404Not found, or not yours.No
409The state changed, for example a sale already declined.Read it again first
413The file is over 10 MB.No, split it
429Too many requests.Yes, after a pause
500, 502, 503Our 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.