> ## 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.

# SDK overview

> JavaScript/TypeScript client for the Alphscan API

The **@alphscan/sdk** package is the core JavaScript/TypeScript client for the [Alphscan API](https://api.alphscan.io). It provides a typed, promise-based interface for all public and authenticated endpoints.

## Repository & package

|            | Link                                                                           |
| ---------- | ------------------------------------------------------------------------------ |
| **GitHub** | [github.com/AlphScan/sdk](https://github.com/AlphScan/sdk)                     |
| **npm**    | [npmjs.com/package/@alphscan/sdk](https://www.npmjs.com/package/@alphscan/sdk) |

Repositories are under the [AlphScan organization](https://github.com/AlphScan/). Packages are private on npm for now and will be public at release.

## Features

* **Typed APIs** for tokens, transactions, plans, keys, and payments
* **Settings from env or code** — use `ALPHSCAN_API_URL`, `ALPHSCAN_API_KEY`, etc., or pass options to `alphscan()`
* **Raw request** — call any API path with `client.request(method, path, body?)`
* **ESM** — ships as ES modules with TypeScript types

## Package

```bash theme={null}
npm install @alphscan/sdk
# or
pnpm add @alphscan/sdk
```

## Quick example

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

const client = alphscan({
  apiUrl: "https://api.alphscan.io",
  apiKey: "your-api-key", // optional for public endpoints
});

// List tokens (public)
const { tokens, total } = await client.token.list({ page: 1, pageSize: 20 });

// List plans (public)
const { plans } = await client.plan.list();

// Normalized events for a transaction (requires apiKey for user-level access)
const events = await client.tx("ba076401862824ef18b7fe436fcf99de9dea4066e91671473205df2ee34619d3").normalizedEvents();
```

## Client surface

| API                                   | Description                                      | Auth            |
| ------------------------------------- | ------------------------------------------------ | --------------- |
| `client.token`                        | List tokens (`GET /token/all`)                   | Public          |
| `client.plan`                         | List API plans (`GET /system/plans`)             | Public          |
| `client.tx(id)`                       | Transaction-scoped API (normalized events)       | User            |
| `client.keys`                         | List/create API keys                             | Admin           |
| `client.payment`                      | Payment flow (request, verify, pending, history) | Admin           |
| `client.request(method, path, body?)` | Raw request for any path                         | Depends on path |

## Next steps

<CardGroup cols={2}>
  <Card title="Installation" icon="box" href="/sdk/installation">
    Install and configure the SDK.
  </Card>

  <Card title="Client & settings" icon="gear" href="/sdk/client-and-settings">
    Create the client and configure API URL, key, and env.
  </Card>

  <Card title="Token API" icon="coins" href="/sdk/token-api">
    List tokens with pagination.
  </Card>

  <Card title="Transaction API" icon="file-lines" href="/sdk/transaction-api">
    Fetch normalized events for a transaction.
  </Card>

  <Card title="System API" icon="key" href="/sdk/system-api">
    Plans, keys, and payments.
  </Card>

  <Card title="Raw request" icon="code" href="/sdk/raw-request">
    Call any endpoint with request().
  </Card>
</CardGroup>
