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

# Get an API Key

> Create a free CabalSpy account, get your API key from the dashboard, and authenticate REST and WebSocket requests in seconds.

Every request to the CabalSpy API needs an API key. Getting one is free and takes a minute, the free tier gives you 10,000 credits every month with no credit card.

## Get your key

Create an account and copy your key from the dashboard.

<Steps>
  <Step title="Create a free account">
    Sign up at [apidashboard.cabalspy.xyz/register](https://apidashboard.cabalspy.xyz/register). No credit card is required for the free tier.
  </Step>

  <Step title="Open the API Dashboard">
    After signing in, go to the [API Dashboard](https://apidashboard.cabalspy.xyz). Your API key is shown there.
  </Step>

  <Step title="Copy your key">
    Copy the key and keep it somewhere safe. Treat it like a password, anyone with your key can spend your credits.
  </Step>
</Steps>

Depending on your plan you can hold more than one key. Free and Starter include one key, Pro up to three, and Business up to five. Multiple keys let you separate environments or projects and revoke one without affecting the others.

## Use your key

You can authenticate two ways. Pick whichever fits your setup, they are equivalent.

### REST requests

Pass the key as the api\_key query parameter, or as an Authorization Bearer header.

<CodeGroup>
  ```bash Query parameter theme={null}
  curl "https://api.cabalspy.xyz/v1/wallets?blockchain=solana&type=kol&api_key=YOUR_KEY"
  ```

  ```bash Bearer header theme={null}
  curl "https://api.cabalspy.xyz/v1/wallets?blockchain=solana&type=kol" \
    -H "Authorization: Bearer YOUR_KEY"
  ```
</CodeGroup>

### WebSocket connections

Pass the key when you open the connection, either as the apiKey query parameter or as a Bearer header. A connection without a valid key is closed immediately.

<CodeGroup>
  ```javascript Query parameter theme={null}
  const ws = new WebSocket("wss://stream.cabalspy.xyz?apiKey=YOUR_KEY");
  ```

  ```javascript Bearer header theme={null}
  const ws = new WebSocket("wss://stream.cabalspy.xyz", {
    headers: { Authorization: "Bearer YOUR_KEY" },
  });
  ```
</CodeGroup>

## Keeping your key safe

Your key is a secret. A few good habits keep it that way.

Do not commit it to source control or paste it into client side code that ships to users. Load it from an environment variable or a secrets manager instead. If a key is ever exposed, create a new one in the dashboard and stop using the old one. When you need to separate projects or environments, use separate keys on a plan that allows several rather than sharing one everywhere.

## Managing usage and billing

Your plan, current credit usage, and keys all live in the [API Dashboard](https://apidashboard.cabalspy.xyz). You can upgrade or downgrade at any time, upgrades take effect immediately and are pro-rated, downgrades apply on your next billing date. See [Pricing](/pricing) for what each plan includes and how credits work.
