> ## Documentation Index
> Fetch the complete documentation index at: https://docs.visorfinance.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Changes and webhooks

> Read only what changed, and let Visor tell your server when something changed.

Two features keep a copy of your transactions up to date without reading the whole history again:

* The **change feed** lists the transactions of a space that were created, changed, or removed after a cursor.
* A **webhook** posts a small event to your server when a space has new changes. The event carries no financial data; your server then reads the change feed.

Both cover every source of change: bank sync through Open Finance, rules, edits in the app, the API, deletions, moves to another space, and hidden accounts. A transaction that a bank sends with an old date appears in the feed when it arrives, not on its old date.

## Read the change feed

[`GET /v1/spaces/{space_id}/transactions/changes`](https://docs.visorfinance.app/api-reference/transactions/list-transaction-changes) needs the `pfm:read` scope.

| Parameter | Effect |
| - | - |
| `after` | The `next_cursor` of your previous read, or the `data.after` of a webhook event. Omit it to start at the oldest change that Visor keeps. |
| `limit` | Changes per page, 1 to 100. The default is 100. |

Each item names one transaction once per page:

| `change` | Meaning |
| - | - |
| `upserted` | The space shows the transaction. `transaction` has its current fields. Insert it, or replace your copy. |
| `removed` | The space no longer shows the transaction: it was deleted, moved to another space, or its account was hidden. `transaction` is `null`. Delete your copy. |

```json theme={null}
{
  "data": [
    {"transaction_id": "9c1e4b2a-7d3f-4e8a-b6c5-1a2b3c4d5e6f", "change": "upserted", "transaction": {"id": "9c1e4b2a-7d3f-4e8a-b6c5-1a2b3c4d5e6f", "amount": "42.90", "type": "debit"}},
    {"transaction_id": "1f2e3d4c-5b6a-4978-8695-a4b3c2d1e0f9", "change": "removed", "transaction": null}
  ],
  "next_cursor": "YzE6OTg3NjU0OjEyMzQ1OjE3OTM4OTI4MDA",
  "has_more": false
}
```

Store `next_cursor` after every read, even when `data` is empty, and pass it as `after` the next time. While `has_more` is `true`, read again at once. The cursor is opaque: do not build or change it.

To start a copy:

1. Read the change feed without `after` until `has_more` is `false`, and store `next_cursor`.
2. Export the history with [`GET /v1/spaces/{space_id}/transactions`](https://docs.visorfinance.app/transactions#list-and-export-your-history).
3. From then on, read the change feed with the stored cursor. A change that happened during the export comes again; apply it again.

> [!WARNING]
>
> Visor keeps changes for 30 days. A cursor older than that receives `410 CURSOR_EXPIRED`. Start the copy again from step 1.

## Receive webhooks

Webhooks are in beta for Pro and Premium accounts. When your account has them, Settings > Connected apps shows a **Webhooks** card.

1. Choose the space and enter an `https` URL that your server answers on. Visor does not call private, loopback, or reserved addresses, and does not follow redirects.
2. Copy the signing secret (`whsec_...`). Visor shows it only once. To change it, delete the webhook and add it again.
3. Select **Send test**. Your server receives a `webhook.test` event.

Each account can have 5 webhooks. A webhook belongs to one space; add one per space you follow.

### Events

| Type | When |
| - | - |
| `transactions.changed` | The space has changes after the previous event. Visor checks every minute and sends at most one event at a time per webhook. |
| `webhook.test` | You selected **Send test** in Settings. |

```json theme={null}
{
  "id": "evt_3f6c1a2e-8b7d-4c9e-a1f0-5d2b6e8c9a7f",
  "type": "transactions.changed",
  "created_at": "2026-11-05T12:00:00Z",
  "space_id": "5d3a9c1e-2b4f-4e6a-8c7d-1f0e9b2a3c45",
  "data": {"after": "YzE6OTg3NjU0OjEyMzQ1OjE3OTM4OTI4MDA"}
}
```

`data.after` is a change feed cursor that starts after the previous event. If your server stores its own cursor, read from the stored cursor instead: it never skips a change.

The request is a `POST` with `Content-Type: application/json` and these headers:

| Header | Value |
| - | - |
| `Visor-Signature` | `t=<unix seconds>,v1=<hex HMAC-SHA256>` |
| `Visor-Event-Id` | The `id` of the event |
| `Visor-Event-Type` | The `type` of the event |

### Verify the signature

Compute HMAC-SHA256 with the whole secret as the key, over the text `<t>.<raw body>`. Compare the hex result with `v1` in constant time, and reject a `t` older than 5 minutes. Use the raw body as received; do not parse and serialize it again.

```javascript theme={null}
import crypto from "node:crypto";

export function verify(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(",").map((part) => part.split("=")));
  const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;

  return fresh && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1 ?? ""));
}
```

### Answer, duplicates, and retries

* Answer with any `2xx` status within 10 seconds. Read the change feed after you answer, not before.
* A retry sends the same `id`. Store the IDs you processed and skip one you already have.
* Any other status, a timeout, or a connection error is a failure. Visor retries for about 24 hours, with a delay that doubles from 30 seconds up to 2 hours.
* When the last retry fails, Visor disables the webhook. Settings shows it as disabled; select **Reactivate** when your server is back, then read the change feed from your stored cursor to catch up.
* An account that loses its Pro or Premium plan, or its access to the space, stops receiving events. The webhook stays and events start again when access returns.

> [!TIP]
>
> To test safely, point a webhook at a request inspector that you control, select **Send test**, and check the signature with your code before you point it at production.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.