---
title: "Quickstart"
description: "From an API key to your campaigns, a campaign's summary, its posts, its audience and its sentiment."
url: https://docs.sonderlabs.co.uk/quickstart
---

# Quickstart

From an API key to your campaigns, a campaign's summary, its posts, its audience and its sentiment.

## 1. Create a key

1. In Sonder, open **Connect to AI & API** (in the sidebar, or the ⋯ menu in Trend Lab).
2. Under **API**, give the key a name you'll recognise, such as the tool it's for, and choose **Create key**.
3. Copy the key. It is shown once: Sonder keeps only a fingerprint of it, so it can't show it again. Lost it? Revoke it and create another.

Workspace owners and admins can create and revoke keys. A key reads every campaign in its workspace and nothing else, and it can only read. Keep it server-side; the examples read it from `SONDER_API_KEY`.

Shell:

```bash
export SONDER_API_KEY=sk_live_…
```

Every request goes to your workspace's own address, `https://{workspace}.sonderlabs.co.uk`: the address you open Sonder at. The examples use `yourteam`.

## 2. List your campaigns

`GET /v1/campaigns` (live):

cURL:

```bash
curl https://yourteam.sonderlabs.co.uk/v1/campaigns \
  -H "Authorization: Bearer $SONDER_API_KEY"
```

JavaScript:

```js
const res = await fetch("https://yourteam.sonderlabs.co.uk/v1/campaigns", {
  headers: {
    Authorization: `Bearer ${process.env.SONDER_API_KEY}`,
  },
});
const data = await res.json();
```

Python:

```python
import os, requests

res = requests.get(
    "https://yourteam.sonderlabs.co.uk/v1/campaigns",
    headers={"Authorization": f"Bearer {os.environ['SONDER_API_KEY']}"},
)
data = res.json()
```

Response:

```json
{
  "campaigns": [
    {
      "id": "red-bull-rampage-2026",
      "name": "Red Bull Rampage 2026",
      "status": "active",
      "startDate": "2026-10-01",
      "lastRefreshedAt": "2026-11-03T00:06:37Z",
      "platforms": [
        "tiktok",
        "instagram",
        "youtube",
        "facebook",
        "x",
        "threads",
        "reddit",
        "snapchat"
      ],
      "totals": {
        "views": 170259629,
        "earnedViews": 115301871,
        "ownedViews": 54957758,
        "posts": 598,
        "creators": 324
      }
    }
  ]
}
```

## 3. Read a campaign's summary

Take a campaign's `id`: views, posts and creators, earned against owned, by platform and by group of accounts.

`GET /v1/campaigns/{id}` (live):

cURL:

```bash
curl https://yourteam.sonderlabs.co.uk/v1/campaigns/red-bull-rampage-2026 \
  -H "Authorization: Bearer $SONDER_API_KEY"
```

JavaScript:

```js
const res = await fetch("https://yourteam.sonderlabs.co.uk/v1/campaigns/red-bull-rampage-2026", {
  headers: {
    Authorization: `Bearer ${process.env.SONDER_API_KEY}`,
  },
});
const data = await res.json();
```

Python:

```python
import os, requests

res = requests.get(
    "https://yourteam.sonderlabs.co.uk/v1/campaigns/red-bull-rampage-2026",
    headers={"Authorization": f"Bearer {os.environ['SONDER_API_KEY']}"},
)
data = res.json()
```

Response:

```json
{
  "campaign": {
    "id": "red-bull-rampage-2026",
    "name": "Red Bull Rampage 2026",
    "status": "active",
    "startDate": "2026-10-01",
    "lastRefreshedAt": "2026-11-03T00:06:37Z",
    "platforms": [
      "tiktok",
      "instagram",
      "youtube",
      "facebook",
      "x",
      "threads",
      "reddit",
      "snapchat"
    ],
    "totals": {
      "views": 170259629,
      "earnedViews": 115301871,
      "ownedViews": 54957758,
      "posts": 598,
      "creators": 324
    }
  },
  "labels": {
    "owned": "Owned",
    "earned": "Earned",
    "talent": "Talent & affiliates",
    "clipper": "Clip channels",
    "ugc": "Everyone else"
  },
  "totals": {
    "views": 170259629,
    "viewsEstimated": false,
    "posts": 598,
    "creators": 324,
    "likes": 9184220,
    "comments": 61342,
    "shares": 120554,
    "avgViews": 284715.1,
    "engagementRate": 0.055
  },
  "byOwnership": [
    {
      "key": "owned",
      "label": "Owned",
      "views": 54957758,
      "posts": 41
    },
    {
      "key": "earned",
      "label": "Earned",
      "views": 115301871,
      "posts": 557
    }
  ],
  "byPlatform": [
    {
      "platform": "youtube",
      "views": 98120455,
      "posts": 380
    },
    {
      "platform": "instagram",
      "views": 64019302,
      "posts": 132
    },
    {
      "platform": "tiktok",
      "views": 6210448,
      "posts": 25
    }
  ],
  "byGroup": []
}
```

## 4. Page through its posts

Newest first. Pass `next` back as `cursor` for the following page; it is `null` on the last. Filter by `platform` or `group`.

`GET /v1/campaigns/{id}/posts` (live):

cURL:

```bash
curl -G https://yourteam.sonderlabs.co.uk/v1/campaigns/red-bull-rampage-2026/posts \
  -H "Authorization: Bearer $SONDER_API_KEY" \
  -d platform=instagram \
  -d limit=1
```

JavaScript:

```js
const params = new URLSearchParams({
  platform: "instagram",
  limit: "1",
});
const res = await fetch(`https://yourteam.sonderlabs.co.uk/v1/campaigns/red-bull-rampage-2026/posts?${params}`, {
  headers: {
    Authorization: `Bearer ${process.env.SONDER_API_KEY}`,
  },
});
const data = await res.json();
```

Python:

```python
import os, requests

res = requests.get(
    "https://yourteam.sonderlabs.co.uk/v1/campaigns/red-bull-rampage-2026/posts",
    headers={"Authorization": f"Bearer {os.environ['SONDER_API_KEY']}"},
    params={
        "platform": "instagram",
        "limit": 1
    },
)
data = res.json()
```

Response:

```json
{
  "posts": [
    {
      "id": "47dd2af11e2fe0f075d88ad970eb737c",
      "url": "https://www.instagram.com/reel/DewxhTugF2T/",
      "platform": "instagram",
      "account": {
        "handle": "instagram",
        "name": "Instagram",
        "followers": 686358280
      },
      "postedAt": "2026-10-21T17:02:11Z",
      "caption": "Riding the line at Red Bull Rampage.",
      "views": 53652872,
      "viewsEstimated": false,
      "likes": 2140551,
      "comments": 9112,
      "shares": 48210,
      "group": "ugc",
      "ownership": "earned"
    }
  ],
  "next": "eyJ0IjoiMjAyNi0xMC0yMVQxNzowMjoxMVoiLCJpIjoiNDdkZDJhZjExZTJmZTBmMDc1ZDg4YWQ5NzBlYjczN2MifQ",
  "total": 132
}
```

## 5. Audience and sentiment

Who comments, as estimated totals, and how people feel, with the themes they talk about.

`GET /v1/campaigns/{id}/audience` (live):

cURL:

```bash
curl https://yourteam.sonderlabs.co.uk/v1/campaigns/red-bull-rampage-2026/audience \
  -H "Authorization: Bearer $SONDER_API_KEY"
```

JavaScript:

```js
const res = await fetch("https://yourteam.sonderlabs.co.uk/v1/campaigns/red-bull-rampage-2026/audience", {
  headers: {
    Authorization: `Bearer ${process.env.SONDER_API_KEY}`,
  },
});
const data = await res.json();
```

Python:

```python
import os, requests

res = requests.get(
    "https://yourteam.sonderlabs.co.uk/v1/campaigns/red-bull-rampage-2026/audience",
    headers={"Authorization": f"Bearer {os.environ['SONDER_API_KEY']}"},
)
data = res.json()
```

`GET /v1/campaigns/{id}/sentiment` (live):

cURL:

```bash
curl https://yourteam.sonderlabs.co.uk/v1/campaigns/red-bull-rampage-2026/sentiment \
  -H "Authorization: Bearer $SONDER_API_KEY"
```

JavaScript:

```js
const res = await fetch("https://yourteam.sonderlabs.co.uk/v1/campaigns/red-bull-rampage-2026/sentiment", {
  headers: {
    Authorization: `Bearer ${process.env.SONDER_API_KEY}`,
  },
});
const data = await res.json();
```

Python:

```python
import os, requests

res = requests.get(
    "https://yourteam.sonderlabs.co.uk/v1/campaigns/red-bull-rampage-2026/sentiment",
    headers={"Authorization": f"Bearer {os.environ['SONDER_API_KEY']}"},
)
data = res.json()
```

Response:

```json
{
  "campaign": {
    "id": "red-bull-rampage-2026",
    "name": "Red Bull Rampage 2026"
  },
  "enabled": true,
  "comments": {
    "positive": 3120,
    "neutral": 1460,
    "negative": 420,
    "total": 5000,
    "shares": {
      "positive": 0.624,
      "neutral": 0.292,
      "negative": 0.084
    }
  },
  "posts": {
    "positive": 402,
    "neutral": 171,
    "negative": 25,
    "total": 598,
    "shares": {
      "positive": 0.672,
      "neutral": 0.286,
      "negative": 0.042
    }
  },
  "summary": "People loved the riders' lines and the aerial shots; the complaints were about wind holds and judging.",
  "positiveDrivers": [
    "The riders' biggest drops and the aerial footage of them."
  ],
  "negativeDrivers": [
    "Long wind holds on finals day."
  ],
  "themes": [
    {
      "label": "The judging",
      "summary": "Viewers argue over whose run should have won.",
      "comments": 640,
      "mix": {
        "positive": 0.31,
        "neutral": 0.29,
        "negative": 0.4
      },
      "quotes": [
        {
          "text": "That last run deserved the top spot.",
          "postId": "47dd2af11e2fe0f075d88ad970eb737c"
        }
      ]
    }
  ],
  "keywords": [
    {
      "term": "aerial shot",
      "count": 212
    }
  ]
}
```

## Next

- Read [Authentication](https://docs.sonderlabs.co.uk/authentication): keys, rate limits, paging and errors.
- Read [Concepts](https://docs.sonderlabs.co.uk/concepts): earned and owned, checked posts, as-of dates and why missing is not zero.
- Want answers in Claude or ChatGPT rather than code? The [MCP server](https://docs.sonderlabs.co.uk/mcp) is live today.
