# REST API: authentication, errors and rate limits

Send goals, payments and crawler hits from your server with a website API key: the base URL, authentication, endpoints, error codes and rate limits.

The REST API is for your server: send goals, payments and crawler hits. Base URL:

```
https://supranalytics.app/api/v1
```

## Authentication

Use a **website API key**, from the website's Settings → API. Keys start with `pk_`, belong to one website, and can be named, rolled and deleted (up to 20). Send it as a bearer token:

```
Authorization: Bearer pk_YOUR_KEY
Content-Type: application/json
```

> Keep keys on your server. The API has no CORS, on purpose: it's not meant to be called from browsers.

## Endpoints

| Endpoint | What it does |
| --- | --- |
| `POST /api/v1/goals` | [Record a goal](https://supranalytics.app/docs/api/goals.md) for a visitor. |
| `POST /api/v1/payments` | [Record a payment](https://supranalytics.app/docs/api/payments.md), a renewal or a refund. |
| `POST /api/v1/crawl` | [Record crawler hits](https://supranalytics.app/docs/api/crawl.md). |

## Errors

| Status | Meaning |
| --- | --- |
| `400` | A field is missing or invalid. The body says which: { "error": "…" } |
| `401` | Missing or wrong API key: { "error": "Invalid API key" } |
| `404` | Not found (for goals: the visitor has no visits yet). |
| `429` | Too many requests. Wait the number of seconds in the Retry-After header. |

## Rate limits

3,000 requests a minute per key.

## Reading your data

To read reports from code, use the [read API](https://supranalytics.app/docs/api/read.md) with an account API key. From a terminal, use the [CLI](https://supranalytics.app/docs/cli.md). For an AI assistant, use the [MCP server](https://supranalytics.app/docs/mcp.md).

---

This page on the web: https://supranalytics.app/docs/api
Every documentation page: https://supranalytics.app/docs.md
