# HTTP API

> The Tapback endpoints you can call yourself: public counts, signed attestations and the public key set with a publishable key, and data export with a secret key.

All endpoints live on `https://api.tapback.party`. Reading counts needs only your publishable key (`pk_live_…`), the same one in your embed; exporting needs a secret key (`sk_live_…`) from the console's **API keys** card. Configuring a Tapbar is done in the console or [over MCP](https://docs.tapback.party/mcp/), not through this API.

`entity` is the exact id a bar sends: its `entity` attribute, or — when it has none — the page's host plus path, lowercased with the trailing slash removed (`example.com/blog/my-post`).

## Counts

```http
GET /v1/counts?key=pk_live_…&entity=/blog/my-post
```

```json
{ "counts": { "heart": 18234, "idea": 512 }, "uniques": { "heart": 4112, "idea": 340 }, "seq": 91 }
```

`counts` is total taps per reaction; `uniques` is distinct readers. Cached for up to 30 seconds. [Verifiable counts](https://docs.tapback.party/verifiable-counts/) explains the numbers.

## Signed attestation (Pro)

```http
GET /v1/attest?key=pk_live_…&entity=/blog/my-post
```

```json
{ "payload": "eyJ2Ijox…", "kid": "att-2026-07", "sig": "Hn1Q…" }
```

`payload` is base64url-encoded JSON (`v`, `app`, `entity`, `at`, `counts` with `total` and `uniques` per reaction) and `sig` is a base64url Ed25519 signature over the `payload` string. A Tapbar without Pro gets `403` with `plan_required`. Cached for up to 30 seconds.

## Public key set

```http
GET /.well-known/tapback-attestation.json
```

The JWK set (`kid`, `kty`, `crv`, `alg: "EdDSA"`, `x`) that verifies attestations. Public, free, and cacheable for an hour. [Verify one](https://docs.tapback.party/verifiable-counts/#verify-one) has the code.

## Export (secret key)

```http
GET /v1/apps/YOUR_APP_ID/export
Authorization: Bearer sk_live_…
```

| `format` | Returns |
| --- | --- |
| *(none)* or `json` | Config (no secrets), lifetime totals, the per-day history and recent usage |
| `csv` | The same data as one long-format file: `table,day,entity,kind,count` |
| `archive` | A zip with `tapback-archive.json`, `tapback-static.js` and a README — the [static archive](https://docs.tapback.party/export/#static-archive-your-reactions-outlive-us) |

`YOUR_APP_ID` is the Tapbar's `app_…` id, shown at the top of its page in the console. Counts trail live pages by up to about 15 seconds. A wrong or missing key gets `401`.

## Errors

Errors come back as JSON with a `code`: `bad_request` (400), `unauthorized` (401), `unknown_key` or `unknown_app` (404), `app_paused` or `app_migrating` (403), `plan_required` (403), `rate_limited` (429, with `Retry-After`).
