Errors

Errors use standard HTTP status codes and a single, predictable JSON shape.

Error shape
{
  "error": {
    "code": "not_found",
    "message": "Material not found.",
    "status": 404
  }
}

Status codes

StatusCodeMeaning
400invalid_requestMalformed parameters or body.
401missing_api_key / invalid_api_keyAuthentication failed.
404not_foundThe resource does not exist.
429rate_limitedToo many requests — back off and retry.
500internal_errorSomething went wrong on our end.

Handling errors

Always branch on response.ok (or the status code) before parsing data. The error.code field is stable and safe to switch on; error.message is human-readable and may change.