> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.spyglass.so/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.spyglass.so/_mcp/server.

# Spyglass quickstart

> The API layer for the social internet. Search brands, creators, and the ads they run.

Spyglass is the API layer for the social internet. Search brands, creators, and
the ads they run, then pull the creatives, hooks, landing pages, and public
comments behind them.

The API is served at `https://api.spyglass.so/v2`. Authenticate with `Authorization: Bearer $SPYGLASS_API_KEY`.

## 1. Get an API key

#### Open API keys

#### [Create a Spyglass API key](https://app.spyglass.so/api-keys)

Create a key in the dashboard. It starts with `sg_live_`. You can view it again later from the same page.

Keys are private to the person who created them, and scoped to the team they were created for. If you leave that team, the key stops working.

#### Set the key as an environment variable

#### macOS / Linux

```bash
export SPYGLASS_API_KEY="sg_live_..."
```

#### Windows

```powershell
setx SPYGLASS_API_KEY "sg_live_..."
```

## 2. Choose how you'll use Spyglass

Call the API from your own code, or connect an agent you already use.

#### [Call the APIs](#3-install-an-sdk)

Resolve brands and creators, then pull creatives, insights, landing pages, and comments. Install an SDK below and make your first request.

#### [Connect your agent](/documentation/get-started/mcp)

Connect ChatGPT, Claude, Codex, or Cursor to Spyglass. No API key is required.

Building with the APIs? Pick where to start:

| Start with                                                              | Use it for                                                                              |
| ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| [Search brands](/api-reference/spyglass-api/search/search-brands)       | Resolve a brand by name, handle, or a short brief                                       |
| [Search creators](/api-reference/spyglass-api/search/search-creators)   | Resolve a creator, or match an audience profile                                         |
| [Search media](/api-reference/spyglass-api/search/search-media)         | Find creatives for a brand, or across the index                                         |
| [Account](/api-reference/spyglass-api/social-media-account/get-account) | Read an account you already have an id for, plus insights, campaigns, and landing pages |

## 3. Install an SDK

**`Python`**

```bash Python
pip install spyglass-sdk
```

**`JavaScript`**

```bash JavaScript
npm install @spyglasshq/sdk
```

Both clients take `SPYGLASS_API_KEY`. Pass it as `token` in Python and as `token` on `new Spyglass()` in Node. Guides: [Python](/sdks/python), [Node](/sdks/node).

## 4. Make your first request

Most endpoints take an account id, so start by resolving a brand.

**`Python`**

```python Python
import os
from spyglass import Spyglass

client = Spyglass(token=os.environ["SPYGLASS_API_KEY"])

result = client.search_brands(names=["Nike"], limit=1)

for brand in result.brands:
    print(brand.name, brand.id)
```

**`JavaScript`**

```javascript JavaScript
import { Spyglass } from "@spyglasshq/sdk";

const client = new Spyglass({
  token: process.env.SPYGLASS_API_KEY!,
});

const { brands } = await client.searchBrands({
  names: ["Nike"],
  limit: 1,
});

for (const brand of brands) {
  console.log(brand.name, brand.id);
}
```

**`cURL`**

```bash cURL
curl -X POST https://api.spyglass.so/v2/brands \
  -H "Authorization: Bearer $SPYGLASS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"names": ["Nike"], "limit": 1}'
```

Take the returned `id` and pass it as `accountId` to [search media](/api-reference/spyglass-api/search/search-media). If the brand is not in the index yet, send its website to [index account](/api-reference/spyglass-api/social-media-account/index-account) and poll index status until it is ready.

## Next steps

#### [Search media](/api-reference/spyglass-api/search/search-media)

Find the creatives a brand is running, or search the index by theme.

#### [Insights](/api-reference/spyglass-api/social-media-account/get-account-insights)

See the hooks, personas, angles, and formats an account leans on.

#### [Billing](/documentation/get-started/billing)

Calls cost credits per row returned. Bound every call with `limit`.

#### [MCP](/documentation/get-started/mcp)

Connect an MCP client to Spyglass search. No API key is required.

Before you build:

* **Page with `offset`.** `count` is the number of rows in this response, not a total. See [Conventions](/documentation/conventions/conventions).
* **Calls come from your backend.** There is no CORS, so a browser cannot call the API directly.