Skip to main content
Triqai API responses follow a consistent structure. This guide explains how to handle different response scenarios effectively.

Response Structure

All responses share a common structure:

Success Responses

Full Success

When all enrichment modules succeed, the entities array contains all identified entities:
Processing:

Partial Success

When some enrichment modules succeed and others fail:
Processing:

Working with the Entities Array

The entities array only contains identified entities. To check for a specific entity type, use find:

Error Responses

When a request fails entirely:

Error Response Handling

Errors are thrown as typed exceptions you can catch directly:

Working with Enrichment Data

Merchant Data

Location Data

Category Data

Complete Processing Example

Best Practices

Before accessing data, verify success === true.
Don’t fail if some entities are missing. Use what’s available in the entities array.
Always use entities.find(e => e.type === 'merchant') and check for null before accessing .data.
Show confidence indicators to users or flag low-confidence results. Use reason tags for smarter decisions.
Keep the meta.requestId for debugging and issue reports.

Next Steps

Error Handling

Handle errors and edge cases

Confidence Scores

Interpret confidence values and reason tags