Skip to main content

Error Handling

The iNwealth API returns errors in two ways depending on when they occur:
  • Before streaming starts — standard HTTP JSON errors
  • During streaming — SSE error events

HTTP errors

These are returned as standard JSON responses before any streaming begins.

401 — Authentication failed

Causes:
  • Missing Authorization header
  • Invalid or revoked API key
  • Malformed Bearer token

400 — Invalid parameters

Returned when a parameter has an invalid value (e.g. unsupported effort level).

422 — Missing required fields

Returned when required fields (messages, session_id) are missing or have the wrong type.

SSE error events

Some errors occur after the stream has started (HTTP 200 already sent). These are delivered as SSE events:

429 — Rate limit exceeded

Your organization’s daily token quota has been exhausted. The error message includes the time until reset (midnight UTC).

500 — Internal error

An unexpected server-side error occurred during response generation. If this persists, contact your account manager.

Handling errors in code

JavaScript

Python

Summary