Working with the API
API error codes and retries
A Hypermake API error gives your code a machine-readable reason and a message to show the user. Match the HTTP status to the appropriate fix before retrying.
What does an API error response contain?
{
"code": "invalid",
"message": "Some fields need attention.",
"fields": { "name": ["Give the space a name."] },
"requestId": "a86ca482-…"
}Read code to select the next action. For a validation error, fields identifies the inputs to correct. Keep requestId when asking about a specific request.
HTTP status codes and fixes
| Status | Code | What to do |
|---|---|---|
| 401 | unauthenticated | The key is missing, wrong or ended. Send a live key. |
| 403 | forbidden, out_of_reach, restricted | The key’s level or its person’s permissions do not reach this. Use a key that does. |
| 404 | not_found | There is no such thing in this organization. |
| 409 | conflict and others | It does not fit how things stand now. Read the message, then read the thing again. |
| 422 | invalid | Some fields need attention. fields names each with why. |
| 429 | too_many_requests | The key asked too often. Wait as many seconds as Retry-After says. |
| 503 | ends in _unavailable | A part of the service cannot answer just now. Try again in a moment. |
When is it safe to retry a request?
A request that reads is always safe to send again. A request that takes an ID you make, such as starting a run, does its work once however often it arrives. For the others, read the thing first to see whether the first try went through.