Authentication
One API key protects the instance. Browsers exchange it for an HttpOnly cookie; scripts send it as a header.
API key
Every endpoint except /api/v1/health requires authentication. Scripts and tools send the key in the X-API-Key header:
curl https://your-instance.example.com/api/v1/topics \
-H "X-API-Key: YOUR_API_KEY"The key is compared in constant time on the server. There is no user table and no key rotation UI — to rotate, change BELLCAST_API_KEY, redeploy, and sign in again on each client.
Browser sessions
The web app never stores the key in localStorage. It posts the key to /api/v1/session, which sets an HttpOnly, SameSite=Lax cookie named bellcast_session. All later requests are authenticated by that cookie.
curl -i -X POST https://your-instance.example.com/api/v1/session \
-H "Content-Type: application/json" \
-d '{"key":"YOUR_API_KEY"}'Sign out with DELETE /api/v1/session, which clears the cookie. The cookie is marked Secure outside development.
Connect link
The web sign-in screen accepts an optional connect link so a browser can be signed in without typing the key. The desktop app stores the key locally instead and never passes it to a remote page:
https://your-instance.example.com/connect#key=YOUR_API_KEYThe fragment is read by the client, exchanged for a cookie, and removed from the URL. Fragments are not sent to the server or included in referrers, but avoid pasting connect links into chat or shell history.
Auth errors
401 unauthorized— missing or wrong key.403 bad_origin— a cross-origin session request was rejected.503 not_configured— the server is missing its key or database settings.