Skip to navigation

Spyglass quickstart

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

1

Open API keys

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.

2

Set the key as an environment variable

export 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.

Building with the APIs? Pick where to start:

Start withUse it for
Search brandsResolve a brand by name, handle, or a short brief
Search creatorsResolve a creator, or match an audience profile
Search mediaFind creatives for a brand, or across the index
AccountRead an account you already have an id for, plus insights, campaigns, and landing pages

3. Install an SDK

pip install spyglass-sdk

Both clients take SPYGLASS_API_KEY. Pass it as token in Python and as token on new Spyglass() in Node. Guides: Python, Node.

4. Make your first request

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

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)

Take the returned id and pass it as accountId to search media. If the brand is not in the index yet, send its website to index account and poll index status until it is ready.

Next steps

Before you build:

  • Page with offset. count is the number of rows in this response, not a total. See Conventions.
  • Calls come from your backend. There is no CORS, so a browser cannot call the API directly.