Access
Introduction
The Access tab controls who may call a source through swarmvia. Caller authorization always runs before a concurrency slot is taken. How swarmvia reaches the upstream (origins, the upstream credential, and origin verification) is on the Connection tab.
Checks run in this order: IP policies → JWT / Cloudflare Access → access key → the source's policy.
Access keys
An access key admits callers to one source. Each key is a token signed by
swarmvia (sv_at_…) with an expiry. It works only on the source it was issued
for, and it can make the calls in that source's
policy. Keys come from three places:
| Where | For | Lifetime |
|---|---|---|
| Sources → Access → Keys and sign-in → Create test key | You, for curl and quick checks | 1 hour (default) or 24 hours |
| The Control API | Scripts, CI, and integrations | 24 hours (default), 1 hour, or 7 days |
start_source_session over MCP |
Agents | 1 hour (default), 24 hours, or 7 days |
No key lasts longer than 7 days. An integration keeps a Control API token, mints its own key, and mints a new one before the old one expires. See Refresh access tokens before they expire.
Send the key with X-Swarmvia-Key:
curl -sS "https://your-source.swarmvia.cloud/v1/records" \
-H "X-Swarmvia-Key: $ACCESS_KEY"On managed sources you may instead send
Authorization: Bearer $ACCESS_KEY or Authorization: Swarmvia $ACCESS_KEY.
Authorization: Nthbouncer is still accepted. X-Nthpool-Key is still accepted.
On pass-through sources, always use X-Swarmvia-Key for the access key so
Authorization can carry the upstream credential.
Missing or invalid keys return 401. The message says why; see
Understand admission errors.
A new key works on its first request: swarmvia checks its signature, so there is nothing to wait for.
Expiry and revocation
- Expiry: an expired key returns
401withaccess token expired. Mint a new one: agents start a new session, integrations call the Control API again. Keys are not renewed in place. - Revocation: a key expires on its own, so nothing needs to end it when the
work is done. Revoke a key only if it leaked: on the Access tab, or with
revoke_sessionand itssession_key_idfrom the agent. It stops working at once.
The Access tab lists the source's active keys with their label, expiry, and who they act for, and revokes them. It counts expired and revoked keys without listing them, and deletes them 30 days after they expire or are revoked.
Session tokens
When an agent calls start_source_session, swarmvia signs an access key for
that source and returns it with its expires_at. It acts for the member who
connected the agent. The agent may ask for 24h or 7d with expires_in;
the default is 1 hour.
Keys that start with nb_live_
Keys created before signed tokens started with nb_live_. They stopped
working on November 7, 2026, and a request that sends one gets 401 with
legacy access key no longer accepted. Replace it:
- For an integration, create a Control API token and have it mint and refresh its own keys (how).
- For a tool that can only send a fixed header, paste a 7-day key and replace it on a schedule.
Keys that act for a member
A test key created with Acts for: Me carries your identity. The source's
logs name you as the caller, and a per-member credential
uses your own connected account for its calls. Keys agents mint over MCP
act for the member who connected the agent. Keys minted with the Control API
act for the token's owner when the request sends "for_me": true, and for no
one otherwise.
When a member is removed from the org or leaves it, the keys that act for them are revoked. Machine keys are not affected.
What a key can call
A key can make the calls its source's policy allows for whoever it acts for:
- The default source policy, which every key gets.
- Plus the calls the source gives the member's groups, and the member.
- Less, if the key came from an API token or agent that was limited to chosen calls, or if it is a read-only key.
Any other call returns 403 before the request reaches your origin, and
before it takes a concurrency slot. A key names who it acts for and holds no
copy of the rules, so a policy change applies to keys already issued, within
about a minute.
A read-only key admits GET, HEAD, and OPTIONS. On a source that
counts a query POST as a read, it admits that POST too, and the Policy
tab says so. Check Read-only key when you create a test key. Use one for callers that only
fetch: retrieval agents, dashboards, search indexers. A prompt injection or a
buggy loop cannot delete a record no matter what it sends.
On a database source there is no policy to edit and
the HTTP method is not the write gate. Every query is a POST, including a
read. The write boundary is the Postgres role swarmvia connects as. In v1 that
is always the read role, so every key connects the same way. A statement that
tries to write is refused by the database (403, SQLSTATE 25006). MCP query
tools (source_query, source_schema, source_count_rows) are read-only;
there is no write tool to hide.
The Access tab of a database source shows what every key is held to: read only, the row cap, the statement timeout and the result size. Read only is marked confirmed once a connection test has seen the read-only transaction take effect. On a JDBC source whose driver ignores the request, the tab says read-only is not enforced by the driver, and the login's own permissions are the only limit. The caps are the source's and apply to every key; change them under Settings.
Caller JWT (plan-gated)
Configure a JWKS URL (and optional issuer / audience) on Access. Prefer the
X-Swarmvia-Jwt header. On pass-through sources, a bearer JWT may also be
accepted in Authorization when that does not conflict with upstream auth
needs.
Cloudflare Access (plan-gated)
Configure team domain and application audience on Access. Send the Access JWT
as Cf-Access-Jwt-Assertion or X-Swarmvia-Jwt.
Worked setup: Configure Cloudflare Zero Trust.
IP policies (plan-gated)
Attach an IP policy to the source. Requests from a blocked
range, or from outside the allowed ranges when an allow policy is attached,
receive 403 before other auth checks. Policy edits take effect within a few
seconds.