Skip to main content
The transactions resource provides methods for enriching raw transaction strings and managing enriched transaction records.

Enrich a Transaction

Transform a raw bank transaction string into structured data:
const result = await triqai.transactions.enrich({
  title: "AMAZON MKTPLACE PMTS AMZN.COM/BILL WA",
  country: "US",
  type: "expense",
});

console.log(result.data.transaction.category.primary.name);
console.log(result.data.entities);

Enrichment Options

Use the options field to control extraction behavior. You can skip entity types you don’t need or pre-fill known data to improve accuracy:
const result = await triqai.transactions.enrich({
  title: "AMAZON MKTPLACE PMTS AMZN.COM/BILL WA",
  country: "US",
  type: "expense",
  options: {
    filters: {
      noLocation: true,
      noIntermediary: true,
    },
    merchant: {
      name: "Amazon",
    },
  },
});
You cannot combine a filter (e.g. noMerchant) with pre-filled data for the same entity type — the request will return a 422 validation error.

Idempotent Enrichment

Pass an idempotencyKey to safely retry enrichment requests without consuming extra credits:
const result = await triqai.transactions.enrich(
  { title: "STARBUCKS", country: "US", type: "expense" },
  { idempotencyKey: "my-unique-key-123", force: false },
);

List Transactions

Retrieve paginated lists of previously enriched transactions:
const page = await triqai.transactions.list({
  page: 1,
  size: 50,
  startDate: "2026-01-01T00:00:00Z",
  endDate: "2026-03-01T00:00:00Z",
});

console.log(page.data);     // EnrichedTransaction[]
console.log(page.pageInfo); // { page, size, total, totalPages }

if (page.hasNextPage) {
  const nextPage = await page.nextPage();
}

Auto-Paginate

Use for await...of to iterate through all pages automatically:
const page = await triqai.transactions.list();

for await (const tx of page) {
  console.log(tx.id, tx.raw, tx.status);
}

Get a Transaction

Retrieve a single enriched transaction by ID:
const tx = await triqai.transactions.get(
  "550e8400-e29b-41d4-a716-446655440000"
);

Delete a Transaction

Remove a transaction record:
const { deleted, transactionId } = await triqai.transactions.delete(
  "550e8400-e29b-41d4-a716-446655440000"
);