How authentication works
When you sign in at knoq.one, your browser receives a session cookie. On every API request, Knoq’s server validates that cookie to confirm your identity and determine which organisation your request is scoped to. If the session is missing or has expired, the request is rejected with a401 Unauthorized response.
All API endpoints under /api/managed-agents/ require a valid session. The authentication check runs on every request before it reaches the route handler, so you will receive a 401 immediately if the cookie is absent or invalid.
Making authenticated requests
To call the Knoq API programmatically — for example, from a script, a backend service, or an integration test harness — you must supply the session credentials that would normally be managed by your browser. Every authenticated request must include:Your Knoq session token. Pass the session cookie value exactly as your browser stores it for
knoq.one.Must be set to
https://knoq.one on all mutating requests (POST, DELETE). Knoq’s CSRF guard rejects mutating requests whose Origin header does not match the application’s own origin. Read-only requests (GET) do not require this header, but including it is harmless.Must be
application/json on all POST and DELETE requests that include a body.The easiest way to obtain a session token for scripted use is to sign in to
Knoq in your browser, open DevTools, navigate to Application → Cookies
for
knoq.one, and copy the session token value. Treat this value like a
password — it grants full access to your account.Example authenticated request
The following example lists all sessions for your active organisation. It passes your session cookie in theCookie header and the required Origin header.
Organisation context
All API calls are scoped to your active organisation. Knoq reads your current organisation from your session — every query filters by both your user ID and your organisation ID, so you can only see and modify data that belongs to your org. If you are a member of multiple organisations, your active org is determined by which organisation your session was established with. To switch the active organisation, sign in to Knoq on the web and use the org switcher in the user menu, or callPOST /api/auth/switch-org. Any subsequent API calls will be scoped to the newly active organisation.
Error responses
| Status code | What it means | What to do |
|---|---|---|
401 Unauthorized | Your session cookie is missing or the session has expired. | Re-authenticate by signing in to Knoq and obtaining a fresh session token. |
403 Forbidden | Your plan does not include the feature you are requesting, or the CSRF Origin check failed on a mutating route. | Check that you are including Origin: https://knoq.one. If the origin is correct, review your organisation’s plan tier. |
The Knoq API is currently designed for use from authenticated browser
sessions. A standalone API key authentication method for server-to-server
integration — without requiring a browser sign-in — is on the roadmap.