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

# Build an app on the Data API

> Make an app key, sign in on every request, read your customers, page through them and re-read only what changed.

The Data API lets an app with its own server read Beacon's stored values over HTTPS: a dashboard on Vercel, an internal tool, a scheduled script. The app's key reads exactly what one person can see in Beacon.

**Base address:** `https://api.beaconrevenue.io/data/v1`

The API is read only. Every request is a `GET`.

## Step 1: Make an app key

In Beacon, go to **Build → App keys** and select **Make a key**. Name the app, choose who the key acts for (yourself, or anyone if you are an admin), untick any kinds of data the app doesn't need, and copy the key. It starts `bcn_app_` and is shown once. [App keys](https://docs.beaconrevenue.io/app-keys.md) covers every option.

Store it as a secret in your app's settings, such as an environment variable on Vercel, never in code a browser can see.

## Step 2: Sign in on every request

Send the key in the `Authorization` header. The samples read it from an environment variable; the Python one uses the `requests` library.

```bash curl theme={null}
curl https://api.beaconrevenue.io/data/v1/accounts \
  -H "Authorization: Bearer $BEACON_APP_KEY"
```

```python Python theme={null}
import os
import requests

response = requests.get(
    "https://api.beaconrevenue.io/data/v1/accounts",
    headers={"Authorization": f"Bearer {os.environ['BEACON_APP_KEY']}"},
)
response.raise_for_status()
rows = response.json()["data"]
```

```javascript JavaScript theme={null}
const response = await fetch("https://api.beaconrevenue.io/data/v1/accounts", {
  headers: { Authorization: `Bearer ${process.env.BEACON_APP_KEY}` },
});
if (!response.ok) throw new Error(`Beacon answered ${response.status}`);
const { data: rows } = await response.json();
```

| If the key is | Answer |
| - | - |
| Missing | 401, `no_key`: send the key in the `Authorization` header as `Bearer` followed by the key |
| Not a Beacon app key | 401, `not_a_key`: check you copied the whole key |
| Unknown | 401, `unknown_key`: Beacon doesn't recognise it |
| Switched off | 403, `key_switched_off`: ask for a new one |
| An agent key or an outside reader's key | 403, refused by name, saying which key to use here |
| For a person who has left the company | 403, `person_left`: the key reads nothing |
| For a company on the Free plan | 403, `plan_free`: the Free plan doesn't include app keys |

## Step 3: Read your customers

`GET /accounts` returns one row per customer the key's person may see, with Beacon's stored values under their public names:

```json theme={null}
{
  "data": [
    {
      "account_id": "stripe:cus_…",
      "lifecycle_stage": "…",
      "health_score": …,
      "as_of": "2026-10-31T23:59:59.999Z",
      "computed_at": "…",
      "lock_state": "live",
      "lock_label": "Live — may change"
    }
  ],
  "as_of": "…",
  "computed_at": "…",
  "page": { "next": "…" }
}
```

On Beacon Demo on 9 November 2026, a key acting for an admin who sees the whole company got 500 rows on the first page, with `page.next` pointing at the next.

[Customers](https://docs.beaconrevenue.io/api/customers.md) lists every value on a row and what it means, and the [column dictionary](https://docs.beaconrevenue.io/build/column-dictionary.md) has each column's unit and source.

Every row carries three stamps:

| Field | Meaning |
| - | - |
| `as_of` | The moment the row's values describe |
| `computed_at` | When Beacon last worked them out |
| `lock_state`, `lock_label` | `live` and "Live — may change", or `locked` and "Locked — month-end October 2026" once a month is closed |

A value Beacon doesn't hold for a customer comes back as a refusal **in its place**, with the reason and what would make it available. It is never a blank or a zero. A value outside the person's access, such as customer value for anyone but leadership, comes back as `outside_grant`.

### Whose customers

A key reads the customers its person can see on the Customers pages in Beacon. A key for someone who sees the whole company reads every customer; a key for someone who sees chosen teams reads only theirs.

## Step 4: Page through

A page of customers holds up to **500** rows; other tables use other sizes, listed on [Paging](https://docs.beaconrevenue.io/api/paging.md). When there are more, the answer carries `page.next`. Send it back unchanged as `?page=`:

```bash curl theme={null}
curl "https://api.beaconrevenue.io/data/v1/accounts?page=$NEXT" \
  -H "Authorization: Bearer $BEACON_APP_KEY"
```

```python Python theme={null}
import os
import requests

url = "https://api.beaconrevenue.io/data/v1/accounts"
headers = {"Authorization": f"Bearer {os.environ['BEACON_APP_KEY']}"}
rows, params = [], {}

while True:
    response = requests.get(url, headers=headers, params=params)
    response.raise_for_status()
    body = response.json()
    rows.extend(body["data"])
    next_page = (body.get("page") or {}).get("next")
    if not next_page:
        break
    params = {"page": next_page}
```

```javascript JavaScript theme={null}
const url = "https://api.beaconrevenue.io/data/v1/accounts";
const headers = { Authorization: `Bearer ${process.env.BEACON_APP_KEY}` };
const rows = [];
let next;

do {
  const address = next ? `${url}?page=${encodeURIComponent(next)}` : url;
  const response = await fetch(address, { headers });
  if (!response.ok) throw new Error(`Beacon answered ${response.status}`);
  const body = await response.json();
  rows.push(...body.data);
  next = body.page?.next;
} while (next);
```

The cursor is opaque: don't build or change it. The last page has no `page.next`. See [Paging](https://docs.beaconrevenue.io/api/paging.md).

## Step 5: Re-read only what changed

Ask `GET /changes?since=` whether Beacon has re-worked each kind of data since your last read, and read with `?changed_since=` only when it says yes. [Stay current](https://docs.beaconrevenue.io/build/stay-current.md) shows both, with Beacon Demo's answer.

## What is served today

| Address | Answer |
| - | - |
| `/accounts` | Served |
| `/deals` | Served. A key acting for someone who sees only their own or their team's deals gets only those deals |
| `/periods`, `/segments`, `/cohorts`, `/chart-of-accounts` | Served. These describe the whole company, so a key acting for someone who sees only their own customers gets `outside_grant` for the whole table |
| `/invoices`, `/invoice-lines`, `/subscriptions`, `/contracts`, `/contract-lines`, `/product-usage`, `/signals`, `/subscription-months`, `/customer-months` | Served, as preview tables. A key acting for someone who sees only their own customers gets only those customers' rows |
| `/products`, `/prices`, `/signal-rules`, `/people`, `/teams`, `/cash-by-month`, `/revenue-by-group` | Served, as preview tables. Company-wide, like periods. On People and Teams a person's name is sent only to a company admin |
| `/changes` | Served |
| `/ledger-entries` | HTTP 501: "Beacon keeps your ledger as one total per category per month today, not entry by entry. Ledger entries appear here once Beacon keeps each posted entry from your accounting tool." |
| `/files` | The same data as files. See [Data files](https://docs.beaconrevenue.io/build/files.md). |

## Answers that aren't data

| Status | When |
| - | - |
| 400 | A date Beacon can't read. Give it as `2026-11-01T00:00:00Z`. |
| 403 | Outside the key's access: `outside_grant`, saying nothing about what lies beyond |
| 404 | An address the API doesn't have. The answer lists the ones it does. |
| 409 | Beacon hasn't worked the data out yet, or it is too old to serve |
| 429 | A fair-use limit was reached. See [Limits](https://docs.beaconrevenue.io/mcp/limits.md#data-api-keys). |
| 501 | Not served yet, as above |
| 503 | Beacon couldn't record the read, check the key's access or reach its records just now. Nothing was sent. Try again in a minute. |
| 500 | Something went wrong on Beacon's side. Nothing was sent. |

## Every read is recorded

Beacon records each read before it sends the answer: which key, which person it acts for, what was read and when. If the record can't be written, nothing is sent. Admins see the reads on **Settings → Who read what**, and each key's recent reads in its side panel on the Keys page.

## Related

> [card] [Pick your way in](https://docs.beaconrevenue.io/build/overview.md)
>
> Claude, agents, apps or files.

> [card] [Stay current](https://docs.beaconrevenue.io/build/stay-current.md)
>
> Re-read only what changed.

> [card] [App keys](https://docs.beaconrevenue.io/app-keys.md)
>
> Make, replace and switch off keys.


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