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

# Quickstart

> Install the server-side Blank SDK, create a scoped API key, and make your first API v2 call.

# Quickstart

## Prerequisites

* Node.js 20 or newer. The SDK is server-only.
* A Blank account with a username set and a verified wallet.
* A scoped API key for the environment you are calling.

## 1. Install the SDK

<CodeGroup>
  ```bash npm theme={null}
  npm install @blankdotbuild/sdk@^3.0.0
  ```

  ```bash pnpm theme={null}
  pnpm add @blankdotbuild/sdk@^3.0.0
  ```

  ```bash bun theme={null}
  bun add @blankdotbuild/sdk@^3.0.0
  ```
</CodeGroup>

Major version **3** is the client for API v2. Pin it explicitly: earlier majors targeted the removed legacy API and will not work against `/api/v2`.

Version 3 ships typed resource modules, runtime response validation, bounded retries, durable idempotency keys, Problem Details errors, pagination helpers, transaction-intent submission, and webhook signature verification.

## 2. Create an API key

1. Sign in at [blank.build](https://blank.build) and open **Settings**.
2. Set a username if the account does not have one.
3. Create a key: name it, pick an expiry, and select **only** the scopes it needs. Scopes cannot be widened after creation.
4. Copy the secret immediately. It is displayed once and never again.

Production keys start with `blank_live_`. Development and staging keys start with `blank_test_`. See [Authentication](/docs/for-developers/authentication) for the full lifecycle.

## 3. Configure your server environment

```bash theme={null}
BLANK_API_KEY=blank_live_...
```

<Warning>
  Never ship an API key to a browser, a mobile app, or a public repository. The
  SDK throws if you construct a client with an `apiKey` in a browser runtime,
  and the API grants no browser CORS allowance to authenticated requests.
</Warning>

## 4. Create a client

```ts theme={null}
import { BlankClient } from "@blankdotbuild/sdk";

const blank = new BlankClient({
  apiKey: process.env.BLANK_API_KEY,
});
```

The default origin is `https://api.blank.build/api/v2`. Override `baseUrl` only for a trusted staging or local Blank deployment; it must use HTTPS outside `localhost`.

`apiKey` also accepts a function returning a `string` or `Promise<string>`, so you can pull the credential from a secret manager on each request.

## 5. Confirm the key

```ts theme={null}
const identity = await blank.identity.me();

console.log(identity.data.environment); // "production"
console.log(identity.data.walletAddress); // the wallet pinned to this key
console.log(identity.data.scopes); // the scopes this key grants
console.log(identity.data.expiresAt); // when the key stops working
```

`GET /me` works with any valid key and returns nothing beyond the key's own identity. It is the fastest way to check that a credential, environment, and scope set are what you expect.

## 6. Read public data

Token and market reads need no key at all:

```ts theme={null}
const tokens = await blank.tokens.list({ status: "bonding", limit: 20 });

for (const token of tokens.data.data) {
  console.log(token.mintAddress, token.symbol, token.currentPriceInSol);
}

console.log(tokens.data.page.hasMore, tokens.data.page.nextCursor);
```

The same call over raw HTTP:

```bash theme={null}
curl -s "https://api.blank.build/api/v2/tokens?status=bonding&limit=20" \
  -H "Accept: application/json"
```

## 7. Read the response metadata

Every SDK call returns `{ data, metadata, response }`.

```ts theme={null}
const snapshot = await blank.marketData.snapshot(mintAddress);

console.log(snapshot.metadata.requestId); // X-Request-Id — log this
console.log(snapshot.metadata.rateLimit.remaining); // X-RateLimit-Remaining
console.log(snapshot.metadata.apiVersion); // "2"
```

Log `metadata.requestId` alongside every failure. It is the identifier Blank needs to trace a request.

## Next steps

<Columns cols={2}>
  <Card title="Scopes" icon="shield" href="/docs/for-developers/scopes">
    Exactly which scope each operation requires.
  </Card>

  <Card title="Conventions" icon="settings" href="/docs/for-developers/conventions">
    Pagination, rate limits, retries, deadlines, and idempotency.
  </Card>

  <Card title="Price predictions" icon="trophy" href="/docs/for-developers/predictions">
    The main automation surface: eligibility, rounds, and submissions.
  </Card>

  <Card title="Webhooks" icon="webhook" href="/docs/for-developers/webhooks">
    Signed CloudEvents instead of polling.
  </Card>
</Columns>
