---
title: Give every generated app its own Kovlet backend (partner API)
overline: HOW-TO
nav: Partner API
updated: 2026-12
minutes: 9
next: end-users
---

# Give every generated app its own Kovlet backend (partner API)

Set up a ready-made Kovlet backend for each app your platform generates. Later, hand it to your customer without redeploying anything.

> **At a glance**
>
> - A [partner](/docs/glossary#partner "An AI app builder or agent platform that creates a Data Space per generated app through the partner API.") is a Kovlet workspace with partner access turned on. Ask for it through the [contact form](https://kovlet.com/upgrade).
> - Partner keys (`kvp_...`) call `/v1/partner/*`, and only that. Owners and admins create them under **Access → Partner**.
> - For each app you create a Data Space, its schema and rules, an app with end-user sign-in, and a server key.
> - A claim link moves the space into the customer's workspace. IDs stay the same, so the app keeps working.
> - Every change is in an audit trail the customer sees after the transfer.

## Prerequisites

- Partner access for your Kovlet workspace. Ask through the [contact form](https://kovlet.com/upgrade).
- A partner key (`kvp_...`) from the console under **Access → Partner**. It needs the `keys` scope if you mint server keys (step 5).
- `curl`, with `API=https://api.kovlet.com` and `KEY=<your partner key>` set in the shell.

## How partner access works

Partners are AI app builders, templates and agent platforms. You can set up a backend for each app you generate before the end customer has a Kovlet account. The backend is:

- a Data Space with a schema and rules
- an app with end-user sign-in
- a server key

Later you hand the backend over. The customer claims it into their own workspace, with nothing redeployed.

The pieces:

- **Partner access.** A partner is a Kovlet workspace with partner access turned on. Its limits are the workspace's quotas, pooled across every app it generates.
- **Partner keys.** Workspace owners and admins create **partner keys** (`kvp_...`) in the console under **Access → Partner**. Send one as `Authorization: Bearer kvp_...` to `/v1/partner/*`, and only there.
- **Scopes.** A key has one or more scopes:
  - `read`
  - `manage`: spaces, schema, rules, apps, sign-in, limits, transfers
  - `keys`: mint Machine Auth Keys. This is the only way a partner reaches data or end users.
- **Transfers.** `POST /v1/partner/spaces/{id}/transfers` returns a claim link. The customer signs in, reviews what moves and claims the space into their own workspace. IDs stay the same, so the deployed app and its signed-in users keep working.
- **Audit.** Every change is in the audit trail (`GET /v1/partner/audit-events`). After a transfer, the customer sees the space's full history, including which server keys you minted.

## What a partner key can reach

| Reaches | Doesn't reach |
| --- | --- |
| Spaces it created: schema, rules, apps, end-user sign-in, auth providers (write-only secrets), per-app limits, transfers, usage | Records, files, the Trash, rollback, Activity, the sync WebSocket, MCP |
| Machine Auth Keys for those spaces (`keys` scope), which are visible and audited | The end-user directory's contents (it returns counts only) |
| The partner workspace's pooled usage and audit trail | The partner workspace's own spaces, other workspaces, members, plan, and other partner keys |

Spaces a key can't reach answer `404 unknown_space`, never 403. So a key can't confirm that a space exists.

A session token (`kvs_`) on a partner route answers `401`. So does a partner key anywhere else.

> **Tip:** Keep the `keys` scope in a single backend secret. Use separate keys for staging and production. A leaked `read`/`manage` key reaches the control plane of your generated spaces, but never their data.

## 1. Create a space

Steps 1–5 set up the backend for one generated app. Every call sends `Authorization: Bearer $KEY` (your partner key) to `$API` (`https://api.kovlet.com`).

`external_id` is your own ID for the app. A retry with the same one answers `409 external_id_taken` with the existing `space_id`. So retries are safe.

```bash
curl -sX POST $API/v1/partner/spaces -H "Authorization: Bearer $KEY" \
  -d '{"name": "Todo app", "external_id": "gen-8f2c", "limits": {"max_end_users": 1000}}'
```

> **You should see**
>
> - `{"space": {"id": "…", "external_id": "gen-8f2c", "status": "managed", "name": "Todo app", …}}`. Set `SPACE` to its `id`.

## 2. Add the schema

Send the same JSON an app declares in `hello.schema`:

```bash
curl -sX POST $API/v1/partner/spaces/$SPACE/schema -H "Authorization: Bearer $KEY" \
  -d '{"tables": {"todos": {"columns": {"title": {"type": "string"}, "owner": {"type": "ref", "ref_table": "_users"}}}}}'
```

### Schema changes later

`POST /v1/partner/spaces/{id}/schema` takes either:

- `tables`: the declared schema, diffed against the current one, or
- `changes`: explicit changes.

Additive changes apply at once. Destructive ones (dropping a column, changing a type) wait as proposals. Send `"approve": true` to approve them in the same call. Or decide them with `POST .../schema/proposals/{pid}/decision`. The answer is `202` while proposals still wait.

## 3. Set the rules

Send the same document as `PUT /v1/spaces/{id}/rules`. End users are closed by default. The [rules reference](/docs/rules-reference) has the rule language. Here each end user sees and changes only their own todos:

```bash
curl -sX PUT $API/v1/partner/spaces/$SPACE/rules -H "Authorization: Bearer $KEY" \
  -d '{"document": {"todos": {"bind": ["isOwner", "auth.id == data.owner"], "allow": {"view": "isOwner", "create": "auth.id == newData.owner", "update": "isOwner && newData.owner == data.owner", "delete": "isOwner"}}}}'
```

Rules are checked against the schema. `422 rules_invalid` names each bad rule. Rules apply at once: partner-managed spaces don't go through rules proposals.

## 4. Create the app

Pin the app to where it is deployed, and turn end-user sign-in on:

```bash
curl -sX POST $API/v1/partner/spaces/$SPACE/apps -H "Authorization: Bearer $KEY" \
  -d '{"name": "Todo web", "origins": ["https://todo-8f2c.example.com"], "end_users": true}'
```

> **You should see**
>
> - `{"app": {"id": "…", "approval_status": "approved", "end_users": true, …}}`. Set `APP` to its `id`.

## 5. Mint a server key (optional)

Create a server key for the app's backend. This needs the `keys` scope.

```bash
curl -sX POST $API/v1/partner/spaces/$SPACE/machine-keys -H "Authorization: Bearer $KEY" \
  -d '{"name": "api", "app_id": "'$APP'", "role": "editor"}'
```

> **You should see**
>
> - The server key. It is shown once, so store it now.

Each step answers one JSON object. Write the space ID and app ID into the generated app's config.

End users sign in with an email code by default. To add Google, Apple, GitHub or LinkedIn, call `PUT /v1/partner/spaces/{id}/auth-providers/{name}`. It takes the same body as the console route. The [end-users guide](/docs/end-users) covers the SDK side.

## 6. Hand the backend over

Create a transfer for the customer's email:

```bash
curl -sX POST $API/v1/partner/spaces/$SPACE/transfers -H "Authorization: Bearer $KEY" \
  -d '{"to_email": "founder@example.com"}'
```

The answer is `{"transfer": {"id": "...", "claim_url": "https://kovlet.com/claim?t=kvt_...", "expires_at": "..."}}`.

Send `claim_url` to the customer.

> **Caution:** Always set `to_email`. Only a Kovlet user with that email can open the link.

About claim links:

- Links are single use.
- They expire after 7 days by default. Set `expires_in` in seconds, from 60 seconds to 30 days. `"expires_in": 86400` is one day.
- A new link cancels the space's previous one.
- `DELETE .../transfers/{tid}` cancels a link.

On the claim page, the customer signs in (or creates an account). They see:

- your name
- the space, its tables, rows, storage and end users
- its apps and origins
- the server keys you minted
- its sign-in providers

Then they pick the workspace to claim it into. Everything below happens in one transaction:

| What | After the claim |
| --- | --- |
| The space, records, files, schema, rules | Same IDs, now in the customer's workspace. The customer is the owner. |
| End users and their sessions | Unchanged: signed-in users stay signed in. Monthly active users count for the customer. |
| Auth providers | They move. Secrets are sealed per space, so they keep working. Delete yours first if the customer shouldn't keep using your OAuth client. |
| Apps | Same IDs, origins and redirect URIs. Approved if the customer is an admin or owner of that workspace, otherwise pending until an admin approves (the claim page warns about this). |
| Machine Auth Keys you minted | The customer chooses: **keep** (the default; they move to the customer, and the page reminds them you still hold the keys) or **revoke**. |
| Your access | Ends at once. `GET /v1/partner/spaces/{id}` answers `{"status": "transferred", ...}`; every other route answers 404. |

The customer's workspace may not have room (spaces, rows, storage, end users, kept keys). Then the claim answers `402 quota_exceeded` and nothing moves. The app keeps running on your quota until the customer upgrades and claims again.

> **Tip:** To learn about claims, poll `GET /v1/partner/spaces?status=transferred`.

## Limits, usage and billing

- **Pooled limits.** Your limits are your workspace's quotas: spaces, rows, storage, headless machines, monthly active end users and sign-in emails per day. Kovlet sets them per contract.
- **Per-app caps** stop one runaway app from using up the pool.
  - Set them with `limits` on create, or `PATCH /v1/partner/spaces/{id}`.
  - The caps are `max_rows`, `max_storage_bytes`, `max_end_users` and `max_end_user_emails_per_day`.
  - A `PATCH` replaces every cap. Leave one out to remove it.
  - A cap only narrows your pooled limit. Going past one gives the usual `quota_exceeded` error with `"scope": "space"`.
  - Caps are cleared when a space is transferred.
- **Usage.**
  - Each space comes with its usage (`rows`, `storage_bytes`, `end_users_active`, `machine_keys`).
  - `GET /v1/partner` has the pooled report.
  - `GET /v1/partner/usage/daily` has one snapshot per space per UTC day.
- **Billing** is manual, per your contract, based on these snapshots. There is no self-serve partner billing.
- **Rate limit.** 20 requests per second per key, with bursts up to 100. Past that: `429 rate_limited` with `Retry-After`.

## Keys, revocation and audit

- **Rotate** by creating a new key, switching to it, then revoking the old one. A partner holds at most 20 active keys. A partner key can never create, list or revoke partner keys.
- **Revoke a key** in the console. It stops working at once (`401 invalid_partner_key`). For incident response, tick "also revoke the server keys it minted". That revokes those still in your workspace, not ones on transferred spaces.
- **Revoke other things** over the API:
  - a server key: `DELETE /v1/partner/spaces/{id}/machine-keys/{mid}`
  - an app: `DELETE .../apps/{appId}`
  - a sign-in method: `PATCH .../apps/{appId}` with `{"end_users": false}`
- **Suspension.** Kovlet can suspend a partner. Every key then answers `403 partner_suspended`. Generated apps keep running, and claim links still work.
- **Audit trail.** `GET /v1/partner/audit-events` lists every change with the key that made it: `space.created`, `schema.changed`, `rules.changed`, `app.created`, `auth_provider.set`, `machine_key.created`, `limits.changed`, `transfer.created`, `space.transferred`, `partner_key.revoked`, ... Filter with `space` and `kind`, and page with `before`. Events never carry secrets or end users' personal data.

## Errors you will see

| Status | Code | Meaning |
| --- | --- | --- |
| 401 | `invalid_partner_key` | The key is unknown, revoked or expired. |
| 403 | `insufficient_scope` | The key lacks the scope named in `required`. |
| 403 | `partner_suspended` | Kovlet paused your partner access. |
| 404 | `unknown_space` | Not a space you manage (or it was transferred). |
| 409 | `external_id_taken` | A space with this `external_id` exists: its ID is in `space_id`. |
| 402 | `quota_exceeded` | A pooled limit, or a per-app cap with `"scope": "space"`. |
| 429 | `rate_limited` | Slow down for `Retry-After` seconds. |

The full reference, with every request and response schema, is in [/openapi.json](/openapi.json) under the `partners` tag.

## Next

- [Let strangers sign in to your app (end users)](/docs/end-users): the SDK side of the generated app's sign-in.
- [Write per-record rules for end users](/docs/rules): the rules each generated space enforces.
- [Kovlet plans and quotas](/docs/plans-and-quotas): the pooled limits every generated app shares.
