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?

An error
{ "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

StatusCodeWhat to do
401unauthenticatedThe key is missing, wrong or ended. Send a live key.
403forbidden, out_of_reach, restrictedThe key’s level or its person’s permissions do not reach this. Use a key that does.
404not_foundThere is no such thing in this organization.
409conflict and othersIt does not fit how things stand now. Read the message, then read the thing again.
422invalidSome fields need attention. fields names each with why.
429too_many_requestsThe key asked too often. Wait as many seconds as Retry-After says.
503ends in _unavailableA 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.