# Links API

Every links call: what to send, what comes back, and copy-ready examples.

## List campaigns

`GET /campaigns` (scope: links:read)

```bash
curl "https://api.usetotems.com/v1/campaigns" \
  -H "Authorization: Bearer $TOTEMS_KEY"
```

```json
{
  "data": [
    {
      "id": "6f1e80df-3b47-4c0e-9a55-1f2e3d4c5b6a",
      "name": "Autumn launch",
      "created_at": "2026-12-03T22:57:17.879Z"
    }
  ],
  "request_id": "req_..."
}
```

## Make a campaign

`POST /campaigns` (scope: links:write)

```bash
curl -X POST "https://api.usetotems.com/v1/campaigns" \
  -H "Authorization: Bearer $TOTEMS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Spring launch"
  }'
```

```json
{
  "data": {
    "id": "2a72e8e7-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "name": "Spring launch",
    "created_at": "2026-12-03T23:43:09.406Z"
  },
  "request_id": "req_..."
}
```

## List links

`GET /links` (scope: links:read)

```bash
curl "https://api.usetotems.com/v1/links?limit=50" \
  -H "Authorization: Bearer $TOTEMS_KEY"
```

```json
{
  "data": [
    {
      "id": "6f1ebebd-3b47-4c0e-9a55-1f2e3d4c5b6a",
      "slug": "demo-client-notes",
      "host": "go.usetotems.com",
      "domain_id": "00000000-0000-4000-8000-000000000001",
      "destination": "https://customer.com/apply",
      "content_id": "6f1eddac-3b47-4c0e-9a55-1f2e3d4c5b6a",
      "content_title": "Client notes letter",
      "campaign_id": "6f1e80df-3b47-4c0e-9a55-1f2e3d4c5b6a",
      "campaign_name": "Autumn launch",
      "person_id": null,
      "channel": "email",
      "place": "email",
      "utm": {},
      "og": {},
      "open_in_app": true,
      "expires_at": null,
      "disabled_at": null,
      "created_at": "2026-11-14T22:00:00.000Z",
      "owner_id": null,
      "clicks": 51,
      "short_url": "https://go.usetotems.com/demo-client-notes"
    }
  ],
  "next_cursor": "WyIyMDI2LTExLTA5IDIyOjAwOjAwKzAwIiwiNjEwYzQ2ZDAtMWI4MC00YmNhLWFhNjItNWZjYjQ4NWU3MTlmIl0",
  "request_id": "req_..."
}
```

## Make a link

`POST /links` (scope: links:write)

```bash
curl -X POST "https://api.usetotems.com/v1/links" \
  -H "Authorization: Bearer $TOTEMS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "destination": "https://example.com/apply",
    "slug": "client-video",
    "channel": "youtube",
    "place": "description"
  }'
```

```json
{
  "data": {
    "id": "2a761b19-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "slug": "client-video",
    "host": "go.usetotems.com",
    "domain_id": "00000000-0000-4000-8000-000000000001",
    "destination": "https://example.com/apply",
    "content_id": "2a6e1d9c-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "content_title": "How I plan my week (new cut)",
    "campaign_id": null,
    "campaign_name": null,
    "person_id": null,
    "channel": "youtube",
    "place": "description",
    "utm": {},
    "og": {},
    "open_in_app": true,
    "expires_at": null,
    "disabled_at": null,
    "created_at": "2026-12-03T23:43:09.578Z",
    "owner_id": "2a77b432-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "clicks": 0,
    "short_url": "https://go.usetotems.com/client-video"
  },
  "request_id": "req_..."
}
```

## Make up to 100 links

`POST /links/batch` (scope: links:write)

```bash
curl -X POST "https://api.usetotems.com/v1/links/batch" \
  -H "Authorization: Bearer $TOTEMS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "links": [
      {
        "destination": "https://example.com/apply",
        "slug": "video-1",
        "place": "description"
      },
      {
        "destination": "https://example.com/apply",
        "slug": "video-2",
        "place": "description"
      }
    ]
  }'
```

```json
{
  "data": [
    {
      "index": 0,
      "ok": true,
      "link": {
        "id": "2a7ae664-7c15-4e2b-8d44-5b6a7c8d9e0f",
        "slug": "5vydczc",
        "host": "go.usetotems.com",
        "domain_id": "00000000-0000-4000-8000-000000000001",
        "destination": "https://example.com/apply",
        "content_id": null,
        "content_title": null,
        "campaign_id": null,
        "campaign_name": null,
        "person_id": null,
        "channel": "other",
        "place": "description",
        "utm": {},
        "og": {},
        "open_in_app": true,
        "expires_at": null,
        "disabled_at": null,
        "created_at": "2026-12-03T23:43:10.140Z",
        "owner_id": "2a77b432-7c15-4e2b-8d44-5b6a7c8d9e0f",
        "clicks": 0,
        "short_url": "https://go.usetotems.com/5vydczc"
      }
    },
    {
      "index": 1,
      "ok": false,
      "error": {
        "code": "unsafe_destination",
        "message": "That address isn't allowed.",
        "field": "destination"
      }
    }
  ],
  "request_id": "req_..."
}
```

## One link

`GET /links/{id}` (scope: links:read)

```bash
curl "https://api.usetotems.com/v1/links/6f1d2c9a-3b47-4c0e-9a55-1f2e3d4c5b6a" \
  -H "Authorization: Bearer $TOTEMS_KEY"
```

```json
{
  "data": {
    "id": "6f1ebebd-3b47-4c0e-9a55-1f2e3d4c5b6a",
    "slug": "demo-client-notes",
    "host": "go.usetotems.com",
    "domain_id": "00000000-0000-4000-8000-000000000001",
    "destination": "https://customer.com/apply",
    "content_id": "6f1eddac-3b47-4c0e-9a55-1f2e3d4c5b6a",
    "content_title": "Client notes letter",
    "campaign_id": "6f1e80df-3b47-4c0e-9a55-1f2e3d4c5b6a",
    "campaign_name": "Autumn launch",
    "person_id": null,
    "channel": "email",
    "place": "email",
    "utm": {},
    "og": {},
    "open_in_app": true,
    "expires_at": null,
    "disabled_at": null,
    "created_at": "2026-11-14T22:00:00.000Z",
    "owner_id": null,
    "clicks": 51,
    "short_url": "https://go.usetotems.com/demo-client-notes"
  },
  "request_id": "req_..."
}
```

## Edit a link

`PATCH /links/{id}` (scope: links:write)

```bash
curl -X PATCH "https://api.usetotems.com/v1/links/6f1d2c9a-3b47-4c0e-9a55-1f2e3d4c5b6a" \
  -H "Authorization: Bearer $TOTEMS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "destination": "https://example.com/book"
  }'
```

```json
{
  "data": {
    "id": "2a761b19-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "slug": "client-video",
    "host": "go.usetotems.com",
    "domain_id": "00000000-0000-4000-8000-000000000001",
    "destination": "https://example.com/apply",
    "content_id": "2a6e1d9c-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "content_title": "How I plan my week (new cut)",
    "campaign_id": null,
    "campaign_name": null,
    "person_id": null,
    "channel": "youtube",
    "place": "bio",
    "utm": {},
    "og": {},
    "open_in_app": true,
    "expires_at": null,
    "disabled_at": null,
    "created_at": "2026-12-03T23:43:09.578Z",
    "owner_id": "2a77b432-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "clicks": 0,
    "short_url": "https://go.usetotems.com/client-video"
  },
  "request_id": "req_..."
}
```

## Turn a link off

`DELETE /links/{id}` (scope: links:write)

```bash
curl -X DELETE "https://api.usetotems.com/v1/links/6f1d2c9a-3b47-4c0e-9a55-1f2e3d4c5b6a" \
  -H "Authorization: Bearer $TOTEMS_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

```json
{
  "data": {
    "id": "2a761b19-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "slug": "client-video",
    "host": "go.usetotems.com",
    "domain_id": "00000000-0000-4000-8000-000000000001",
    "destination": "https://example.com/apply",
    "content_id": "2a6e1d9c-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "content_title": "How I plan my week (new cut)",
    "campaign_id": null,
    "campaign_name": null,
    "person_id": null,
    "channel": "youtube",
    "place": "bio",
    "utm": {},
    "og": {},
    "open_in_app": true,
    "expires_at": null,
    "disabled_at": "2026-12-03T23:43:10.741Z",
    "created_at": "2026-12-03T23:43:09.578Z",
    "owner_id": "2a77b432-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "clicks": 0,
    "short_url": "https://go.usetotems.com/client-video"
  },
  "request_id": "req_..."
}
```

## Clicks on one link

`GET /links/{id}/clicks` (scope: links:read)

```bash
curl "https://api.usetotems.com/v1/links/6f1d2c9a-3b47-4c0e-9a55-1f2e3d4c5b6a/clicks?limit=50" \
  -H "Authorization: Bearer $TOTEMS_KEY"
```

```json
{
  "data": [
    {
      "id": "6f1f3a79-3b47-4c0e-9a55-1f2e3d4c5b6a",
      "occurred_at": "2026-12-03T10:19:31.446Z",
      "country": "GB",
      "device": "phone",
      "referrer_host": null
    }
  ],
  "next_cursor": "WyIyMDI2LTEyLTAzIDEwOjA2OjA3LjExODg3MiswMCIsImJjMzQ3ZTQ1LWQyNjAtYjVmZi0yNjIyLTVmMjE2MThkM2RlZSJd",
  "request_id": "req_..."
}
```

## QR code picture

`GET /links/{id}/qr` (scope: links:read)

```bash
curl "https://api.usetotems.com/v1/links/6f1d2c9a-3b47-4c0e-9a55-1f2e3d4c5b6a/qr?format=svg" \
  -H "Authorization: Bearer $TOTEMS_KEY"
```

## Link domains

`GET /domains` (scope: links:read)

```bash
curl "https://api.usetotems.com/v1/domains" \
  -H "Authorization: Bearer $TOTEMS_KEY"
```

```json
{
  "data": [
    {
      "id": "00000000-0000-4000-8000-000000000001",
      "host": "go.usetotems.com",
      "shared": true,
      "status": "ok"
    }
  ],
  "request_id": "req_..."
}
```
