# People API

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

## List people

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

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

```json
{
  "data": [
    {
      "id": "6f1f9746-3b47-4c0e-9a55-1f2e3d4c5b6a",
      "name": "Riley Hotlead",
      "email": "h***@fake.example",
      "phone": null,
      "country": null,
      "stage": "hot",
      "score": 80,
      "score_reasons": [
        {
          "label": "Opened booking page",
          "times": 2,
          "points": 40
        },
        {
          "label": "Sent a form",
          "times": 1,
          "points": 15
        }
      ],
      "first_source": "dm",
      "first_seen_at": "2026-11-27T22:00:00.000Z",
      "last_seen_at": "2026-12-03T22:57:17.879Z",
      "bookings": 0,
      "revenue_cents": 0,
      "owner_id": null,
      "owner_name": null
    }
  ],
  "next_cursor": "MjAyNi0xMi0wMyAyMjo1NzoxNy44Nzk0NzcrMDB8OGQyYWNiMTItOWYxZi00ZDY4LTlmNzAtYWYwYjNkNWI2MjE0",
  "request_id": "req_..."
}
```

## Add or update a person

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

```bash
curl -X POST "https://api.usetotems.com/v1/people" \
  -H "Authorization: Bearer $TOTEMS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "alex@example.com",
    "name": "Alex Example"
  }'
```

```json
{
  "data": {
    "id": "2a814ac8-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "name": "Alex Example",
    "email": "a***@example.com",
    "phone": null,
    "country": null,
    "stage": "new",
    "score": 0,
    "score_reasons": [],
    "first_source": null,
    "first_seen_at": "2026-12-03T23:43:11.771Z",
    "last_seen_at": "2026-12-03T23:43:11.771Z",
    "bookings": 0,
    "revenue_cents": 0,
    "owner_id": null,
    "owner_name": null,
    "merged_into": null,
    "erased_at": null
  },
  "request_id": "req_..."
}
```

## Merge two people

`POST /people/merge` (scope: people:write)

```bash
curl -X POST "https://api.usetotems.com/v1/people/merge" \
  -H "Authorization: Bearer $TOTEMS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "keep_id": "6f1d2c9a-3b47-4c0e-9a55-1f2e3d4c5b6a",
    "merge_id": "0b8a7c65-1d2e-4f30-8a9b-7c6d5e4f3a2b"
  }'
```

```json
{
  "data": {
    "merge_id": "2a8ae15e-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "kept_id": "2a847cfa-7c15-4e2b-8d44-5b6a7c8d9e0f"
  },
  "request_id": "req_..."
}
```

## One person

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

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

```json
{
  "data": {
    "id": "6f1f9746-3b47-4c0e-9a55-1f2e3d4c5b6a",
    "name": "Riley Hotlead",
    "email": "h***@fake.example",
    "phone": null,
    "country": null,
    "stage": "hot",
    "score": 80,
    "score_reasons": [
      {
        "label": "Opened booking page",
        "times": 2,
        "points": 40
      },
      {
        "label": "Sent a form",
        "times": 1,
        "points": 15
      }
    ],
    "first_source": "dm",
    "first_seen_at": "2026-11-27T22:00:00.000Z",
    "last_seen_at": "2026-12-03T22:57:17.879Z",
    "bookings": 0,
    "revenue_cents": 0,
    "owner_id": null,
    "owner_name": null,
    "merged_into": null,
    "erased_at": null
  },
  "request_id": "req_..."
}
```

## Change stage or owner

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

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

```json
{
  "data": {
    "id": "2a847cfa-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "name": "Alex Example",
    "email": "a***@example.com",
    "phone": null,
    "country": null,
    "stage": "booked",
    "score": 0,
    "score_reasons": [],
    "first_source": null,
    "first_seen_at": "2026-12-03T23:43:11.011Z",
    "last_seen_at": "2026-12-03T23:43:11.011Z",
    "bookings": 0,
    "revenue_cents": 0,
    "owner_id": null,
    "owner_name": null,
    "merged_into": null,
    "erased_at": null
  },
  "request_id": "req_..."
}
```

## Timeline

`GET /people/{id}/journey` (scope: people:read)

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

```json
{
  "data": [
    {
      "id": "6f1ff413-3b47-4c0e-9a55-1f2e3d4c5b6a",
      "at": "2026-12-03T17:57:17.879Z",
      "kind": "form",
      "title": "Sent a form",
      "detail": null,
      "channel": null,
      "content_id": null,
      "link_id": null,
      "is_test": false
    }
  ],
  "request_id": "req_..."
}
```

## Score and reasons

`GET /people/{id}/score` (scope: people:read)

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

```json
{
  "data": {
    "score": 80,
    "reasons": [
      {
        "label": "Opened booking page",
        "times": 2,
        "points": 40
      },
      {
        "label": "Sent a form",
        "times": 1,
        "points": 15
      }
    ]
  },
  "request_id": "req_..."
}
```

## Notes

`GET /people/{id}/notes` (scope: people:read)

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

```json
{
  "data": [],
  "request_id": "req_..."
}
```

## Add a note

`POST /people/{id}/notes` (scope: people:write)

```bash
curl -X POST "https://api.usetotems.com/v1/people/6f1d2c9a-3b47-4c0e-9a55-1f2e3d4c5b6a/notes" \
  -H "Authorization: Bearer $TOTEMS_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "body": "Wants to start in January."
  }'
```

```json
{
  "data": {
    "id": "2a87af2c-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "body": "Wants to start in January.",
    "created_at": "2026-12-03T23:43:13.479Z"
  },
  "request_id": "req_..."
}
```

## Erase a person

`POST /people/{id}/erase` (scope: people:write)

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

```json
{
  "data": {
    "id": "2a847cfa-7c15-4e2b-8d44-5b6a7c8d9e0f",
    "erased": true,
    "left": 0
  },
  "request_id": "req_..."
}
```

## Undo a merge

`POST /people/{id}/split` (scope: people:write)

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

```json
{
  "data": {
    "undone": true
  },
  "request_id": "req_..."
}
```

## Hot list

`GET /hot-leads` (scope: people:read)

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

```json
{
  "data": [
    {
      "id": "6f206fcf-3b47-4c0e-9a55-1f2e3d4c5b6a",
      "name": "Casey Hotlead",
      "email": "h***@fake.example",
      "phone": null,
      "country": null,
      "stage": "hot",
      "score": 90,
      "score_reasons": [
        {
          "label": "Opened booking page",
          "times": 2,
          "points": 40
        },
        {
          "label": "Sent a form",
          "times": 1,
          "points": 15
        }
      ],
      "first_source": "dm",
      "first_seen_at": "2026-11-27T22:00:00.000Z",
      "last_seen_at": "2026-12-03T22:57:17.879Z",
      "bookings": 0,
      "revenue_cents": 0,
      "owner_id": null,
      "owner_name": null,
      "reason": "Opened booking page twice today.",
      "last_action": "Opened booking page",
      "last_action_at": "2026-12-03T22:27:17.879Z"
    }
  ],
  "request_id": "req_..."
}
```
