# TypeScript SDK

> Install, verify, and use the framework-independent Agsemble client in Node, browsers, Workers, Expo, and React Native.

Human-readable version: https://agsemble.com/docs/guides/sdk

## Current distribution

The versioned HTTPS archive is a normal npm install source and is not inherently less safe than the registry. Agsemble publishes a matching SHA-256 checksum and sdk.json release manifest. The package name stays @agsemble/sdk so imports will not change after registry publication.

A public npm package is the preferred production distribution because registry ownership, familiar resolution, version discovery, lockfile metadata, and—when built from a public repository—npm provenance are easier to verify. Registry publication remains owner-controlled and is not yet claimed.

```shell
npm install https://api.agsemble.com/downloads/agsemble-sdk-0.9.0.tgz
curl -fsS https://api.agsemble.com/downloads/agsemble-sdk-0.9.0.tgz.sha256
```

## Use an existing key

```ts
import { Agsemble } from "@agsemble/sdk";

const agsemble = new Agsemble({ apiKey: process.env.AGSEMBLE_API_KEY! });
const fields = await agsemble.fields.list();
const summary = await agsemble.fields.summary(fields.data[0].id);
```

## Diagnose failures

Catch AgsembleApiError to read status, code, parameter, and requestId. Use agsemble.activity.list() to correlate recent requests without storing query strings, bodies, keys, or response payloads.
