Skip to Content
APIQuickstart

Quickstart

This walks through creating a key and pulling your first data. It takes about five minutes.

Create an API key

In Asky, go to Settings → API keys and select Create API key.

You will be asked for:

FieldWhat to enter
NameWhat the key is for, for example Data warehouse sync. This is what you will see in the key list and in usage reports, so make it specific.
WorkspaceOnly shown if you administer more than one. The key can read data for that workspace only.
Expiration90 days, 1 year (default), no expiration, or a date you choose. See manage API keys.
Brand accessAll brands in the workspace, or specific ones. Restricting is worth doing for a development, CI, or client-specific key. See API keys.

You need to be an owner or admin of the workspace to create a key.

Copy the key

The key is shown once, immediately after creation, and looks like this:

asky_sk_TFqPk3nZ8vN2mR7wL4xB9cD1eF6gH0jK5sT8uV3yA2b

Store it wherever your application reads secrets from: an environment variable, your deploy platform’s secret store, or your secrets manager. You cannot retrieve it again. If you lose it, roll the key.

Never commit an API key to source control, paste it into a browser console, or include it in a client-side bundle. A key grants read access to your whole workspace’s data. See manage API keys.

Verify the key works

curl https://api.askylabs.com/v1/me \ -H "Authorization: Bearer $ASKY_API_KEY"

A 200 confirms the key is valid and shows exactly what it can reach:

{ "data": { "key_name": "Data warehouse sync", "workspace": { "id": "8f14e45f...", "name": "Acme Corp" }, "scopes": ["read:basic", "read:visibility", "..."], "brand_access": "all" }, "request_id": "req_01J8Z3K9QW" }

If you get a 401, check for a stray newline or quote in the copied value. The error codes page lists what each response means.

Find your brands

Most data is brand-scoped, so start by listing the brands the key can reach.

curl https://api.askylabs.com/v1/brands \ -H "Authorization: Bearer $ASKY_API_KEY"
{ "data": [ { "id": "b_7a3f...", "name": "Acme", "domain": "acme.com" }, { "id": "b_9c2e...", "name": "Acme Europe", "domain": "acme.eu" } ], "pagination": { "limit": 20, "has_more": false, "next_cursor": null }, "request_id": "req_01J8Z3KA12" }

Pull visibility data

Use a brand id from the previous step.

curl -G https://api.askylabs.com/v1/brands/b_7a3f.../visibility \ -H "Authorization: Bearer $ASKY_API_KEY" \ -d start_date=2026-07-01 \ -d end_date=2026-07-31

That returns the same visibility and mention-rate figures your dashboard shows for that period. From here, filtering narrows by topic, engine, or country, and pagination walks larger result sets.

A complete example

Fetching every tracked prompt for a brand, following pagination to the end:

const KEY = process.env.ASKY_API_KEY const BASE = 'https://api.askylabs.com/v1' async function fetchAll(path) { const results = [] let cursor = null do { const url = new URL(BASE + path) url.searchParams.set('limit', '100') if (cursor) url.searchParams.set('cursor', cursor) const res = await fetch(url, { headers: { Authorization: `Bearer ${KEY}` } }) if (!res.ok) { const { error } = await res.json() throw new Error(`${error.code}: ${error.message} (${error.request_id})`) } const body = await res.json() results.push(...body.data) cursor = body.pagination.next_cursor } while (cursor) return results } const prompts = await fetchAll('/brands/b_7a3f.../prompts') console.log(`${prompts.length} prompts`)

For production use, add retry handling for 429 and 5xx responses as described in error handling.

Next steps

Last updated on