Skip to main content
Every NAWA API error returns a consistent JSON envelope with machine-readable codes and human-friendly guidance.

Error response format

Error object fields

Always include the request_id from error responses when contacting support. It helps us trace exactly what happened.

Error taxonomy

invalid_request_error (400)

The request was malformed or missing required parameters.
Cause: A required parameter is missing from the request body.Common triggers:
  • Missing text field in /v1/classify
  • Missing comment_id in /v1/comments/:id/reply
Fix: Check the API reference for required parameters and include them all.
Cause: A parameter has an invalid value or type.Common triggers:
  • platform not one of: youtube, instagram, twitter, facebook
  • text is empty or not a string
Fix: Verify parameter values match the expected types and allowed values.
Cause: The text parameter exceeds the maximum allowed length of 5,000 characters.Fix: Truncate or split long texts before sending.

authentication_error (401)

The API key is missing, invalid, expired, or revoked.
Cause: No Authorization header was provided.Fix: Include the header: Authorization: Bearer nawa_live_sk_xxx
Cause: The API key is not recognized. It may be malformed or from a different environment.Fix: Verify the key is correct and matches the environment (free/live).
Cause: The free API key has exceeded its 14-day expiry.Fix: Create a new free key from the dashboard. Live keys don’t expire.
Cause: The API key has been manually revoked.Fix: Use a different active key or create a new one.

insufficient_credits (402)

Your account balance is insufficient for the requested operation.
Cause: Your credit balance has reached $0. There is no grace period — paid endpoints stop immediately.Fix: Purchase a credit pack from the dashboard to restore access instantly.

rate_limit_error (429)

You’ve exceeded the rate limit for your current tier.
Cause: Too many requests in the current time window.Fix: Wait until the X-RateLimit-Reset time, then retry. Consider upgrading your tier.
The X-NAWA-RateLimit-Reason response header provides additional context (minute_limit or sandbox_exhausted).
Cause: You’ve used all 100 lifetime requests on your free key.Fix: Buy credits to unlock a live key.

api_error (500)

An unexpected error occurred on the NAWA side.
Cause: An unexpected internal failure.Fix: Retry the request. If the issue persists, contact support with the request_id.
Cause: The upstream AI provider (ALLaM) experienced a failure.Fix: Retry after a brief delay. Check status.trynawa.com for incidents.

Handling errors in code