# The timeline

> Read what happened with each client, person, deal and agreement, and log a note, an email, a call, a meeting or a LinkedIn message, through the CRM API.

The timeline is what happened with each record: the notes your team wrote, the emails, calls, meetings and LinkedIn messages logged, and the moves the CRM wrote down itself, such as a deal reaching a new stage. It is what a record's page shows under its details. Each entry is an `activity`, at `/activities`.

| Call | Does | Key needs |
|---|---|---|
| `GET /activities` | The timeline, a page at a time, filtered | `crm:read` |
| `POST /activities` | Log something that happened | `crm:write` |
| `GET /activities/{id}` | One entry | `crm:read` |
| `PATCH /activities/{id}` | Change an entry | `crm:write` |
| `DELETE /activities/{id}` | Remove an entry | `crm:write` |

## An entry

```json
{
  "activity": {
    "id": "0c55...",
    "object": "activity",
    "kind": "call",
    "direction": "out",
    "occurred_at": "2026-12-02T23:00:00.000Z",
    "body": "Called Sam about the March figures. Sending them Friday.",
    "logged_by": { "id": "7a90...", "name": "Priya Shah" },
    "via": "api",
    "company": { "id": "5f0c...", "name": "Acme Services" },
    "person": { "id": "1d2e...", "name": "Sam Lee" },
    "deal": null,
    "agreement": null,
    "custom_fields": {},
    "created_at": "2026-12-03T04:15:00.000Z",
    "updated_at": "2026-12-03T04:15:00.000Z"
  }
}
```

`kind` is `note`, `email`, `linkedin`, `call` or `meeting` for what somebody logged, or `stage_change` for a move the CRM wrote down. `via` says how it came in, as a record's [history](https://docs.sanda-os.com.au/crm-api/records#history) does.

## Read the timeline

`GET /activities` lists entries newest first by when they happened, 50 at a time. Filter it to one record's:

```bash
curl "https://crm.sanda-os.com.au/api/crm/v1/activities?company_id=5f0c...&kind=call,meeting" -H "Authorization: Bearer bck_..."
```


| Parameter | What it does |
| --- | --- |
| `company_id` | What happened with this company, its people and its deals, as its timeline shows. |
| `person_id` | Only entries with this person. |
| `deal_id` | Only entries about this deal. |
| `agreement_id` | Only entries about this agreement. |
| `kind` | Only these kinds, with commas: note,call. |
| `since` | Only entries that happened at or after this time. |
| `updated_since` | Only entries added or changed at or after this time. |


`company_id` gives a client's timeline as its page shows it: its own entries and those of its people and deals. `order=oldest` lists the first first, and `order=updated` lists them by when they were logged or last changed, the way to keep another system in step (see [keep another system in step](https://docs.sanda-os.com.au/crm-api/records#keep-another-system-in-step)).

The timeline is not on the [change feed](https://docs.sanda-os.com.au/crm-api/changes), which is changes to records. To hear about new entries, read `GET /activities?order=updated&updated_since=` the time you last read.

## Log something

```bash
curl https://crm.sanda-os.com.au/api/crm/v1/activities \
  -H "Authorization: Bearer bck_..." \
  -H "Content-Type: application/json" \
  -d '{"kind": "call", "direction": "out", "person_id": "1d2e...", "body": "Called Sam about the March figures."}'
```

The answer is **201** with the entry. It is logged by the key's person, through the API, and the record's timeline shows it as theirs through the key, such as **Jo Tran through API key “Xero sync”**.


| Field | Type | Sent when | What it takes |
| --- | --- | --- | --- |
| `kind` | string | Adding only | What happened: note, email, linkedin, call, meeting. Needed to log one. |
| `direction` | string | Adding and changing | in or out, for email, linkedin, call. Left out, out. |
| `body` | string | Adding and changing | What was said or done. A note needs one. |
| `occurred_at` | string | Adding and changing | When it happened. Left out, now. |
| `company_id` | string | Adding only | The company it is about. |
| `person_id` | string | Adding only | The person it is with. Their company is linked too. |
| `deal_id` | string | Adding only | The deal it is about. Its company and person are linked too. |
| `agreement_id` | string | Adding only | The agreement it is about. |
| `confirm_do_not_contact` | boolean | Adding only | true logs an email to somebody marked do not contact or unsubscribed, which is otherwise refused. |
| `custom_fields` | object | Adding and changing | Your CRM’s own fields, by key (GET /fields). On a change, only the keys you send are changed; null clears one. |


Log it against at least one of a company, a person, a deal or an agreement. A person brings their company with them, and a deal its client and person.

An email to somebody marked do not contact or unsubscribed is refused with 409 and the code `do_not_contact`, as the CRM's own page refuses it. Send `"confirm_do_not_contact": true` to log it anyway, for an email they sent you, say. See [do not contact](https://docs.sanda-os.com.au/crm/work#do-not-contact-and-unsubscribed).

## Change or remove an entry

`PATCH /activities/{id}` changes an entry's `body`, `direction`, `occurred_at` or `custom_fields`, and `DELETE /activities/{id}` removes it. Only whoever logged it, or an owner or admin, may do either. A stage change is the record of a move, so it is never changed, and only an owner or admin removes one.

:::links
- [Records](https://docs.sanda-os.com.au/crm-api/records): The clients, people, deals and agreements an entry is about.
- [Your work in the CRM](https://docs.sanda-os.com.au/crm/work): The timeline on a record's page.
:::
