served

Articles ·

A database and a key for each of your users

When each user or agent has their own database, each can have their own key too: one that opens that database and nothing else. Two requests when they arrive.

If each of your users has their own database, each can have their own key as well: one that opens that database and nothing else. The same pattern gives each agent a database and a key scoped to that database.

Two requests when a user arrives

Your own key, the one for the whole account, makes both. First the database:

curl https://api.served.dev/v1/databases \
  -H "Authorization: Bearer $SERVED_KEY" \
  -d '{"name": "user-42"}'

Then a key that works only for it:

curl https://api.served.dev/v1/keys \
  -H "Authorization: Bearer $SERVED_KEY" \
  -d '{"name": "user 42", "databases": ["user-42"]}'

{"id": 7, "name": "user 42", "prefix": "served_ab12cd", "databases": ["user-42"],
 "created": "2026-11-30T10:00:00Z", "key": "served_..."}

key is the new key. It is shown this once and works at once. Keep the id beside your user's record: it is how you revoke the key later.

What the key can do

Everything, to its own database: query it, download it, replace it, delete it. For any other database it gets 403 forbidden, whether or not that database exists, and when it lists databases it sees only its own.

It cannot make keys, and it cannot make new databases. The one thing it can create is its own database, by name, so the two requests above can go in either order.

Where to use it

A key can do anything to its database, and what the database holds counts toward your account's storage. Hand it to code and people you would let do that.

More than one database

A key can be limited to as many as 100 databases, named when it is made:

{"name": "team 9", "databases": ["team-9", "team-9-archive"]}

To change a key’s scope, make a replacement with the new scope and revoke the old key.

When the user leaves

curl -X DELETE https://api.served.dev/v1/keys/7 \
  -H "Authorization: Bearer $SERVED_KEY"

curl -X DELETE https://api.served.dev/v1/databases/user-42 \
  -H "Authorization: Bearer $SERVED_KEY"

The key stops working at once. GET /v1/keys lists every key on the account with what it is limited to and when it was last used, which is how you find the ones nobody uses any more.

How many

An account can have 1000 keys. If you have more users than that, make keys for the ones that need to reach their database directly, and serve the rest from your own backend with the account's key. Databases have no such limit.

Served is hosted SQLite. Real SQLite behind an HTTP API, $5 a month, and the file is yours to download whenever you like.

Get started Read the docs