> ## Documentation Index
> Fetch the complete documentation index at: https://docs.triqai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Transactions

> Enrich, list, retrieve, and delete transactions using the Triqai SDK

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:

```typescript theme={null}
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:

```typescript theme={null}
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",
    },
  },
});
```

<Note>
  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.
</Note>

## Idempotent Enrichment

Pass an `idempotencyKey` to safely retry enrichment requests without consuming extra credits:

```typescript theme={null}
const result = await triqai.transactions.enrich(
  { title: "STARBUCKS", country: "US", type: "expense" },
  { idempotencyKey: "my-unique-key-123" },
);
```

## List Transactions

Retrieve paginated lists of previously enriched transactions:

```typescript theme={null}
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:

```typescript theme={null}
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:

```typescript theme={null}
const tx = await triqai.transactions.get(
  "550e8400-e29b-41d4-a716-446655440000"
);
```

## Delete a Transaction

Remove a transaction record:

```typescript theme={null}
const { deleted, transactionId } = await triqai.transactions.delete(
  "550e8400-e29b-41d4-a716-446655440000"
);
```
