# Authentication and rate limits

> The public API needs no key; the site REST API uses API keys with scopes. Writes are limited per visitor, accounts use a same-origin cookie, and bodies are capped.

## Authentication

The public API is open: it needs no key or token. The site is chosen by the address, either the site's own domain (`/_vorjo/…`) or `https://api.vorjo.com/v1/sites/<site>/…`. It only exposes what a visitor to the site could see anyway: active products, published posts, content, open booking slots and the customer's own orders (by reference).

- **CORS** on the API host allows any origin, with `GET`, `POST` and `OPTIONS` and no credentials.
- **Customer accounts** use an HttpOnly cookie on the shop's own host, and requests from other origins are refused. They only work on the site's own address.
- **The private preview** marks every order, booking and message as a test.
- **Card payments** run through the owner's own Stripe account. Vorjo never sees full card numbers.

### API keys (the site REST API)

The [site REST API](/developers/rest-api) shows what the admin panel shows, so it needs a key: `Authorization: Bearer vsk_…`.
Owners (and team members with the **Developers** permission) make keys in **Settings › Developers › API keys**. Each key:

- works for one site only, with the scopes it was given (each resource read, or read and write);
- is shown once; only its SHA-256 hash is stored, and revoking it stops it at once;
- has its own rate limit: 60, 120 (default), 300 or 600 requests a minute, with `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `Retry-After` on a `429`.

Webhooks go the other way: each endpoint has a signing secret, and every request is signed (see [Webhook events](/developers/webhook-events)).

## Rate limits

Limits are per visitor and per site, over a 10-minute window. Going over returns `429` with `{ "error": "Too many requests…" }`.

| Action | Limit per 10 minutes |
| --- | --- |
| Form messages | 20 |
| Bookings | 10 |
| Cart quotes | 600 |
| Checkouts | 20 |
| Order lookups | 20 |
| Reviews | 8 |
| Account sign-ups | 10 |
| Account sign-ins | 12 |
| Password or login codes sent | 6 |

Reading products, posts and content isn't limited this way, but please cache where you can.

## Other limits

- Request bodies: up to 32 KB
- Products per list request: up to 200; posts: up to 100
- Forms: up to 40 fields. Fill `_hp` (a hidden honeypot field) only if you're a bot: such requests get a fake success and are dropped.
- Emailed codes: 5 tries each, valid for 30 minutes
