Renvo
API docs
Concepts

Errors

All errors return the same JSON envelope. Use error.type for branching, not the HTTP status alone.

Error envelope

Standard error responsejson
{
  "error": {
    "type": "invalid_request_error",
    "message": "Field \"customer_id\" is required.",
    "param": "customer_id"
  }
}

Error types

HTTPtypeWhen
400invalid_request_errorMissing required field, malformed body, unknown parameter.
401authentication_errorNo API key, malformed key, revoked key, expired key.
403permission_errorOrg not on Pro plan, or read-only key attempting a write.
404not_foundResource doesn't exist or doesn't belong to your org.
409conflictDuplicate value or invalid state transition.
429rate_limit_errorToo many requests in a short window.
500api_errorSomething on our end. Retryable.

Handling errors

A typical fetch wrapper:

async function renvoFetch(path, init) {
  const res = await fetch(`https://userenvo.com/api/v1${path}`, {
    ...init,
    headers: {
      'Authorization': `Bearer ${process.env.RENVO_API_KEY}`,
      ...init?.headers,
    },
  })
  if (!res.ok) {
    const { error } = await res.json()
    throw new RenvoError(error.type, error.message, res.status)
  }
  return res.json()
}