Your site's build reads content with a key, and that key can leak through a log, a screenshot or a repository. A LyEve key made for reading answers every write with 403, records each request it makes, and stops working the moment you revoke it.
Five such keys per tenant are free, each with thirty days of request history.
The site, the server and a super admin
- A LyEve engine and LyEve Console, on PostgreSQL, MySQL or SQL Server. Each database takes its own connection string, listed under supported databases. The run behind this guide used PostgreSQL 16 on November 11, 2026, with the LyEve engine v0.62.0 and admin console v0.28.0.
- A super admin account, and its token in
TOKENfor the API steps. First-run setup in the quickstart gives you one. - Somewhere the key stays secret: your build's environment or your server, never code that runs in a visitor's browser.
The steps read a content type named faq. To follow along on a test install, create it with one entry:
curl -X POST http://localhost:3001/api/admin/schemas \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "faq", "display_name": "FAQ", "fields": [{"name": "question", "field_type": "text", "required": true}, {"name": "answer", "field_type": "rich_text"}]}'
curl -X POST http://localhost:3002/api/v1/content/faq \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"data": {"question": "Do you deliver?", "answer": "Within ten miles."}}'1. Give the viewer role read access to faq
A key acts with the roles it carries, and a role reaches content only through an access rule. viewer has no rights of its own, which makes it the role for a read key.
Console v0.28.0
- Open Access > Permissions. If there is no
viewerrow, choose New role, enterviewerin Role name and choose Create. - Choose Add a content type rule for viewer. In Resource, pick
faq. - Tick Read alone and choose Create.
Engine API v0.62.0
curl -X POST http://localhost:3001/api/admin/permissions \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"role": "viewer", "schema_name": "faq", "actions": ["read"]}'The answer is 200 with the rule.
Without this rule the key in step 3 gets 403 with permission denied on its first read. Roles and access rules explains how rules combine.
2. Create a key that may only read
Console v0.28.0
- Open Access > API keys and choose New key.
- Enter
websitein Name. Under Roles, keep viewer, which the form ticks for you. - Leave Access as it opens. The summary under it reads 1 scope: content:read.
- Leave Expires on No expiry and choose Create.
- The API key created dialog shows the key once. Copy it into
KEY.
Engine API v0.62.0
curl -X POST http://localhost:3001/api/admin/api-keys \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "website", "roles": ["viewer"], "scopes": ["content:read"]}'{"id":"824917d4-112d-44b0-af3a-466f960eb12c","name":"website","roles":["viewer"],"schemas":[],"scopes":["content:read"],"tenant_id":"default","enabled":true,"monthly_limit":0,"daily_limit":0,"hourly_limit":0,"created_at":"2026-11-11T11:42:02.759713Z","raw_key":"ly_51b5..."}The answer is 201. Copy raw_key into KEY and id into KEY_ID. The key is shown once, and LyEve keeps only a hash of it.
content:read covers every GET under /api/v1/content/. Writing needs content:write, and deleting content:delete, which this key does not hold.
3. Read with it, then try to write
curl http://localhost:3002/api/v1/content/faq \
-H "X-API-Key: $KEY"[{"id":"414c1b9d-22c7-499e-b2af-885148c644f5","data":{"answer":"Within ten miles.","question":"Do you deliver?"},"created_at":"2026-11-11T11:42:02.672419Z","updated_at":"2026-11-11T11:42:02.672419Z"}]Now send a write with the same key:
curl -X POST http://localhost:3002/api/v1/content/faq \
-H "X-API-Key: $KEY" \
-H "Content-Type: application/json" \
-d '{"data": {"question": "Written with a read key?"}}'{"code":"forbidden","error":"insufficient scope","request_id":"d82360e5d3f0659ee34438af9949d8ee"}The answer is 403. A PUT on the entry and a call to the Admin API on port 3001 answer the same.
4. See what the key did
Console v0.28.0
On Access > API keys, the key's row counts its requests under Usage (this month), here 2 req after one read and one refused write. The console has no view of each request on this release, so the API tab shows the log.
Engine API v0.62.0
curl "http://localhost:3001/api/admin/api-keys/$KEY_ID/audit?limit=10" \
-H "Authorization: Bearer $TOKEN"[
{"id":"302690a4-...","api_key_id":"824917d4-...","method":"GET","path":"/api/admin/schemas","status":403,"ip":"10.186.0.4","ts":"2026-11-11T11:42:02.855979Z"},
{"id":"1cf3740a-...","api_key_id":"824917d4-...","method":"PUT","path":"/api/v1/content/faq/414c1b9d-22c7-499e-b2af-885148c644f5","status":403,"ip":"10.186.0.4","ts":"2026-11-11T11:42:02.83953Z"},
{"id":"59ebcaba-...","api_key_id":"824917d4-...","method":"POST","path":"/api/v1/content/faq","status":403,"ip":"10.186.0.4","ts":"2026-11-11T11:42:02.823741Z"},
{"id":"ffce2127-...","api_key_id":"824917d4-...","method":"GET","path":"/api/v1/content/faq","status":200,"ip":"10.186.0.4","ts":"2026-11-11T11:42:02.806516Z"}
]Newest first, each with its method, path, status and the address it came from. GET /api/admin/usage/api-key/$KEY_ID gives the month's totals: requests, bytes_in and bytes_out.
A run of 403 answers from an address you do not know is the sign to replace the key.
5. Replace the key without downtime
Make the new key first, move your site to it, and revoke the old one last.
Console v0.28.0
- Create a second key as in step 2, named
website-2, and put it in your site's environment. - Rebuild or restart the site, and check that it reads content.
- On Access > API keys, choose the revoke button on the
websiterow. The dialog asks Revoke key website?. Choose Revoke.
The row's status turns to Revoked, and its usage stays listed.
Engine API v0.62.0
-
Create
website-2with the call from step 2 and move your site to itsraw_key. -
Revoke the old one:
Shellcurl -X POST http://localhost:3001/api/admin/api-keys/$KEY_ID/revoke \ -H "Authorization: Bearer $TOKEN"The answer is
204. Its request log stays readable.
From then on the old key gets this, and the new one keeps reading:
{"code":"unauthorized","error":"authentication required","request_id":"c42687c9279304b9b0221f580e3ba33b"}Five keys and thirty days, free
A tenant holds five active keys on the free tier, and a revoked key does not count. A sixth answers 402 with "cap":"apikey.keys". The request log of each key reads back thirty days.
API Keys Pro, $2 a month and in beta, removes both limits, and every plan from Starter includes it. It also sets request limits on a key by the hour, day or month. Without it, setting one answers 402 with payment_required. API key request limits covers them.
When a key is refused
401 with authentication required
The request carried no key, or a key that is unknown, revoked or expired. Check that the header is X-API-Key and that your site reads the new key after a rotation.
403 with permission denied on a read
No access rule lets the key's roles read that content type. Give viewer a rule as in step 1. The key itself needs no change.
402 with cap_exceeded when you create a key
The tenant already holds five active keys. Revoke one you no longer use, or add API Keys Pro.
Rebuild the site when content changes
A static site reads with this key at build time, and a webhook can start that build each time an editor publishes. Rebuild a static site with webhooks sets that up. What a headless CMS is shows the same read from the side of the site.