Skip to main content
All errors follow the same format:
{
  "error": {
    "code": "not_found",
    "message": "Note not found"
  }
}

Error codes

HTTP statusCodeDescription
400validation_errorInvalid request body or query parameters. Check the message for details.
401invalid_api_keyMissing, malformed, expired, or revoked API key.
403forbiddenYour API key doesn’t have the required scope for this endpoint.
404not_foundThe resource doesn’t exist or belongs to another user.
405method_not_allowedWrong HTTP method. Check the endpoint documentation.
409conflictDuplicate resource — for example, a folder with the same name already exists.
429rate_limitedRate limit exceeded. Check the Retry-After header.
500internal_errorSomething went wrong on our end. Retry after a short delay.

Handling errors

const res = await fetch(url, { headers: { Authorization: `Bearer ${KEY}` } });

if (!res.ok) {
  const { error } = await res.json();
  if (error.code === "rate_limited") {
    const retryAfter = res.headers.get("Retry-After");
    await new Promise((r) => setTimeout(r, retryAfter * 1000));
    // retry the request
  }
  throw new Error(`${error.code}: ${error.message}`);
}