Skip to main content
This guide covers how to handle errors from the Triqai API, including common error codes, troubleshooting tips, and best practices.

Error Response Format

All error responses follow a consistent structure:

Error Codes

Authentication Errors (401)

Payment Errors (402)

Not Found Errors (404)

Validation Errors (422)

Rate Limit Errors (429)

Requests with a missing or malformed API key, and repeated API key lookups from one IP address, have their own limits. Those 429 responses send only Retry-After. See Rate Limits.
Rate-limited requests are automatically retried with exponential backoff, so you typically don’t need to handle 429 errors manually.

Server Errors (500)

Service Unavailable (503)

Any authenticated endpoint can return 503 when authentication or the rate-limit and credit check can’t complete for a moment. The SDK retries 503 responses automatically.

Automatic Retries

Retries are handled automatically with exponential backoff. You can customize the retry behavior:
Retry behavior:
  • GET and DELETE requests are always retried on transient errors
  • Enrichment requests reuse their generated or supplied idempotencyKey across automatic retries
  • The Retry-After header from 429 responses is respected automatically
  • Retried status codes: 429, 500, 503, 504, and network errors, plus 409 for the same enrichment while it is still in progress
To disable retries entirely:

Complete Error Handling Pattern

Here’s a complete error handling example using typed error classes:
See the error handling reference for the full list of error classes.

Logging and Monitoring

Request Logging

Use built-in debug hooks for observability:
Or wrap calls for custom logging:

Error Tracking

Best Practices

The meta.requestId helps with debugging and support requests.
If errors persist, temporarily stop requests to prevent cascading failures.
Partial results (partial: true) are successes with some failures handle them differently from full failures.
Catch validation errors client-side when possible to reduce failed API calls.
Create error classes that make it easy to check error types and extract details.

Next Steps

API Reference

Complete API documentation with error codes

Rate Limits

Understand and manage rate limits