Kovlet end users REST API reference
For people calling Kovlet's end-user routes directly instead of through an SDK. It lists every REST route for your app's own users: sign-in, data access, the end-user directory and the owner's settings.
On this page
At a glance
- Sign-in routes live under
/v1/eu/{space}/…and take the app'sapp_id. They return akvu_…access token and akvur_…refresh token. POST /v1/eu/{space}/tokentakes five grants:magic_code,authorization_code,id_token,sign_in_codeandrefresh_token.- An end-user session may read, write with
transactand sync over protocol 2. Other/v1/spaces/…routes answer403 end_user_forbidden. - The directory is for the console and
impersonatemachines. Settings and rules are for owners. - Every route, with its schemas, is also in /openapi.json.
The SDKs call these routes for you. To set up sign-in step by step, follow Let strangers sign in to your app (end users).
All bodies are JSON. Errors use the standard envelope {"error": {"code", "message", "hint", "details"}}.
Sign-in (/v1/eu/{space}/…, called by the app)
Every request names the app with app_id. Browsers must send an Origin the app pinned. Token requests carry the SDK's device key, and later requests a device proof (Kovlet-Device-Proof, as for member sessions).
| Endpoint | Body | Answer |
|---|---|---|
GET /v1/eu/{space}/config?app_id= | {enabled, providers: [{name, kind}]} where kind is email, oauth or id_token | |
POST /v1/eu/{space}/codes | {app_id, email} | 202 {sent: true, expires_in}. A 6-digit code, valid 10 minutes |
POST /v1/eu/{space}/guest | {app_id, device_key} | token response |
GET /v1/eu/{space}/oauth/{provider}/start | query: app_id, redirect_uri, state, code_challenge (S256) | 302 to the provider |
GET|POST /v1/eu/oauth/{provider}/callback | from the provider | 303 to redirect_uri?code=…&state=…, or ?error=…&state=… |
POST /v1/eu/{space}/token | see grants below | token response |
GET /v1/eu/{space}/me | {user} | |
POST /v1/eu/{space}/sign-out | 204. Ends the session and its refresh token |
Grants for /token (every grant except refresh_token also takes app_id and device_key, a P-256 public JWK):
grant_type | Fields |
|---|---|
magic_code | email, code |
authorization_code | code, code_verifier, redirect_uri (the OAuth return) |
id_token | provider, id_token |
sign_in_code | code (minted by your server) |
refresh_token | refresh_token, plus Kovlet-Device-Proof signed over the refresh token |
Token response: {access_token: "kvu_…", refresh_token: "kvur_…", token_type: "Bearer", expires_in, user: {id, email, email_verified, is_guest, created_at}, guest_id?}.
- Guests. Signing in by any method with
Authorization: Bearer <guest token>attaches the identity to the guest, so the guest's rows keep pointing at it. If the identity already belongs to another end user, the session switches to that user and the response carriesguest_id, so the app can move rows itself. Nothing merges automatically. - Linking. A provider identity whose provider verified the email signs in to the end user with that email. Unverified provider emails never link.
- Limits. Codes are rate-limited per email, IP and space, and capped per workspace per day. New sign-ups past the workspace's
end_usersquota (monthly active end users) getquota_exceeded. Existing end users keep working.
Data
End-user sessions (and impersonated ones) can use:
GET /v1/spaces/{space}/tables: only tables whose view rule can match.GET /v1/spaces/{space}/records?table=…and?table=…&ids=…: only rows the rules allow; trashed rows never.POST /v1/spaces/{space}/query: nested queries, filtered by the rules on every table and link.POST /v1/spaces/{space}/transact: atomic writes, each checked against the rules (kovlet.auth.transact(writes)in the SDK).- Sync protocol 2: query subscriptions,
mutate, files (with a_filesrule) and rooms (_rooms, or a room bound to a row they may view).
Every other /v1/spaces/… route answers 403 end_user_forbidden. A protocol: 1 sync hello with an end-user token answers unsupported_protocol with details.supported: [2].
Management (console, or a machine whose grant has impersonate)
| Endpoint | Body | Answer |
|---|---|---|
GET /v1/spaces/{space}/end-users?q=&limit=&after= | {end_users: [EndUser], next_after?}, newest first | |
POST /v1/spaces/{space}/end-users | {email, id?} (id keeps an imported ID) | 201 {end_user} |
GET /v1/spaces/{space}/end-users/{id} | {end_user} | |
PATCH /v1/spaces/{space}/end-users/{id} | {blocked: true|false} | {end_user} |
DELETE /v1/spaces/{space}/end-users/{id} | 204. Erasure (below) | |
POST /v1/spaces/{space}/end-users/{id}/sign-in-codes | {app_id} | {code, expires_at}. One-time, 10 minutes |
EndUser: {id, email, email_verified, is_guest, providers: ["email", "google", …], created_at, last_active_at, blocked_at}.
Settings (owner, console)
| Endpoint | Body | Answer |
|---|---|---|
GET /v1/spaces/{space}/end-user-settings | {callback_url, apps: [{app_id, name, enabled, max_role, missing: [...]}], providers: [Provider]} | |
PUT /v1/spaces/{space}/apps/{appId}/end-users | {enabled} | {app_id, enabled}. 409 end_users_requirements with details.missing (approval, origins_or_redirect_uris) |
PUT /v1/spaces/{space}/auth-providers/{name} | OAuth: {client_id, client_secret} (Apple: {client_id, team_id, key_id, private_key}). ID token: {issuer, audience, jwks_url?} | {provider} |
DELETE /v1/spaces/{space}/auth-providers/{name} | 204 | |
PUT /v1/spaces/{space}/machine-grants/{mid}/{appId}/impersonate | {enabled} | {machine_id, app_id, impersonate} |
GET /v1/spaces/{space}/rules | {version, document} | |
PUT /v1/spaces/{space}/rules | {document} | {version, document}. 422 rules_invalid with errors |
POST /v1/spaces/{space}/rules/test | {email | end_user_id, table, action?, record_id?, fields?, document?} | {allowed, rule?, rows?, visible, total, filter?}. Read-only |
POST /v1/spaces/{space}/rules/proposals (editor: apps, CLI) | {document} | {proposal}, pending until an owner approves it |
Provider: {name, kind: "oauth"|"id_token", client_id?, issuer?, audience?, jwks_url?, has_secret, updated_at}. Secrets are encrypted at rest with KOVLET_SECRETS_KEY and never returned.
OAuth provider names are google, apple, github and linkedin. Any other lower-case name (clerk, firebase, auth0, …) is an ID-token provider.
The rules document has the shape of InstantDB's instant.perms.ts, with CEL rules (the rules reference has the language):
{
"$default": { "allow": { "$default": "false" } },
"announcements": { "allow": { "view": "true" } },
"todos": { "bind": ["isOwner", "auth.id == data.owner"], "allow": { "view": "isOwner", "create": "auth.id == newData.owner" } },
"_users": { "allow": { "view": "auth.id == data.id" } }
}_users only takes a view rule.
Queries can follow a t.ref("_users") column to the user's profile, e.g. to-dos with their owner: useQuery(space, { todos: { owner: {} } }). The _users view rule decides which profiles arrive. With the default, an end user sees their own and gets null for anyone else's, live too. Widen it to show more, for example "auth.id == data.id || data.is_guest == false".
Next
- Per-record rules reference: the rules language these routes enforce.
- Let strangers sign in to your app (end users): the same flow with the SDKs.
- Kovlet errors and limits reference: every error code with its HTTP status.
Ready to try it? Start free. No credit card, no API keys.
For coding agents: this page is also Markdown. Add .md to the URL or send Accept: text/markdown. The full reference is at /llms-full.txt.