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

# Transaction API

> Fetch normalized events for a transaction via client.tx(id)

The **Transaction API** is scoped to a single transaction. It provides normalized events from the indexer (`GET /transaction/:id/normalized/events`). **User-level** access (API key) is typically required.

## client.tx(transactionId)

```typescript theme={null}
const client = alphscan({ apiUrl: "https://api.alphscan.io", apiKey: "sk_..." });
const txApi = client.tx("ba076401862824ef18b7fe436fcf99de9dea4066e91671473205df2ee34619d3");
const result = await txApi.normalizedEvents();
```

## TxApi

| Method               | Returns                               | Description                             |
| -------------------- | ------------------------------------- | --------------------------------------- |
| `normalizedEvents()` | `Promise<TxNormalizedEventsResponse>` | Normalized events for this transaction. |

## TxNormalizedEventsResponse

| Field            | Type                | Description                                                      |
| ---------------- | ------------------- | ---------------------------------------------------------------- |
| `transaction_id` | `string`            | Transaction hash.                                                |
| `events`         | `NormalizedEvent[]` | Array of normalized events (from `@alphscan/normalized-events`). |

## Example

```typescript theme={null}
import { alphscan } from "@alphscan/sdk";

const client = alphscan({
  apiUrl: "https://api.alphscan.io",
  apiKey: process.env.ALPHSCAN_API_KEY,
});

const txId = "ba076401862824ef18b7fe436fcf99de9dea4066e91671473205df2ee34619d3";
const { transaction_id, events } = await client.tx(txId).normalizedEvents();

console.log(`Transaction ${transaction_id}: ${events.length} events`);
events.forEach((e) => console.log(e.category, e.sub_kind, e.from, e.to));
```
