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

# Quickstart

> Install the Instantly TypeScript SDK and make your first API request.

Install the SDK, authenticate with an API v2 key, and list campaigns in your workspace.

## Prerequisites

* Node.js 22 or later.
* An Instantly workspace with an [API v2 key](/getting-started/getting-started).

<Note>
  The SDK is currently in beta. Install it with the `beta` tag until the stable `1.0.0` release is available.
</Note>

<Steps>
  <Step title="Install the SDK">
    Add the package to your Node.js project:

    ```bash theme={null}
    npm install @instantlyai/sdk@beta
    ```
  </Step>

  <Step title="Set your API key">
    Store your API key in a server-side environment variable:

    ```bash theme={null}
    export INSTANTLY_API_KEY="your-api-key"
    ```

    <Warning>
      Never expose your API key in client-side code or commit it to source control.
    </Warning>
  </Step>

  <Step title="Create a client">
    Import `Instantly`, create a client, and list up to 10 campaigns:

    ```typescript theme={null}
    import { Instantly } from '@instantlyai/sdk';

    const apiKey = process.env.INSTANTLY_API_KEY;

    if (!apiKey) {
      throw new Error('INSTANTLY_API_KEY is not set');
    }

    const instantly = new Instantly({ apiKey });
    const campaigns = await instantly.campaigns.list({ limit: 10 });

    console.log(campaigns);
    ```
  </Step>
</Steps>

## Handle API errors

The SDK throws `ResponseError` when the API returns a non-successful response. Its `response` property is a standard Fetch API `Response`.

```typescript theme={null}
import { ResponseError } from '@instantlyai/sdk';

try {
  const campaigns = await instantly.campaigns.list({ limit: 10 });
  console.log(campaigns);
} catch (error) {
  if (error instanceof ResponseError) {
    console.error(error.response.status, await error.response.text());
  }

  throw error;
}
```

## Next steps

<CardGroup cols={2}>
  <Card title="API reference" icon="code" href="/api-reference/introduction">
    Browse resources, request fields, and response schemas.
  </Card>

  <Card title="View on npm" icon="box" href="https://www.npmjs.com/package/@instantlyai/sdk">
    Review package details and the latest release notes.
  </Card>
</CardGroup>
