# API reference

The public endpoints, all on `https://api.pagebee.ai`. Bodies are JSON in UTF-8, timestamps ISO 8601 in UTC, revenue in integer minor units.

## Ingest

| Method and path | Who calls it | Auth |
| --- | --- | --- |
| `GET /script.js` | Browsers | None |
| `POST /i` | The web script | Public site key in the body |
| `POST /i/batch` | The Swift and Kotlin SDKs, up to 50 events | Public site key in the body |
| `POST /v1/events` | Your servers, up to 100 events | `Authorization: Bearer pb_sk_...` |

`/i` and `/i/batch` always answer `202`, even for an unknown key or a filtered bot, so they can't be used to probe keys. They set no cookies. Details of `/v1/events` are in [Server API and Node](/docs/server).

## MCP

| Method and path | Auth |
| --- | --- |
| `POST /mcp` | `Authorization: Bearer pb_ak_...` |

See [MCP](/docs/mcp) for the tools.

## Limits

| What | Limit |
| --- | --- |
| Browser beacons | 600 a minute per network |
| App batches | 300 a minute per network |
| Server requests | 1,200 a minute per secret key |
| MCP calls | 120 a minute per key |
| Beacon body | 16 KB |
| App batch body | 256 KB |
| Server request body | 512 KB |

Over a limit, the API answers `429` with a `Retry-After` header. Errors come back as JSON with a code and a message that names the fix.

## Keys

| Prefix | Kind | Where it's safe |
| --- | --- | --- |
| `pb_pk_` | Public site key | In your web page or app |
| `pb_sk_` | Secret ingest key | On your server only |
| `pb_ak_` | API and MCP key, read or dev | On your machine or server only |
