Issue and revoke tokens
Create, use, and revoke personal access tokens that authenticate the watcher and other Data Hub API clients, and see what a token can and can’t do.
Personal access tokens authenticate the watcher, the processing Lambda, and scripts that call the Data Hub API. Only admins can create and revoke tokens. Members can view the list at Settings → Access Tokens but can’t create or delete tokens. For roles and scopes, see Security and permissions.
How a token acts
A token acts under its own name, which the web app shows with a key icon, not as the admin who created it. Tokens can’t claim runs or send or review feedback, because those need a signed-in person. The routes that the watcher and the Lambda call accept only tokens, so a browser session gets 401 Unauthorized there. See How tokens act for the full rules.
Create a token
In the web app
Sign in as an admin.
Go to Settings → Access Tokens.
Choose Create token.
Enter a Name that identifies the client (for example, FPLC watcher, Lab 201). People see this name wherever the token acts, so make it recognizable.
Choose an Expiration: 30 days, 90 days (the default), 1 year, or no expiry.
Under Scopes, choose a preset, or choose Customize scopes to select individual scopes.
Choose Create token.


Data Hub shows the token only once, so copy it now. It starts with dhub_, followed by 64 hexadecimal characters (0–9 and a–f).


Scope presets
A preset selects the minimum scopes a common client needs:
- Read-only: view instruments, runs, files, watchers, and archive jobs; change nothing
- Watcher: what a watcher needs to register, report runs, and upload files
- Lambda: what the processing Lambda needs to read instruments and runs, and write run and file results
The Lambda preset includes runs:read, which DishCam processing needs to pair each photo stack with its run.json. A Lambda token created from an older preset gets 403 FORBIDDEN on DishCam files. Create a new token from the current preset and update the Lambda’s DATA_HUB_API_KEY; the Lambda developer docs describe the swap.
A token’s scopes are fixed when you create it. To change them, revoke the token and create a new one.
Via the API
Only admins can create and delete tokens through the API, and only from a signed-in browser session (a session cookie). Tokens can’t manage other tokens.
curl -X POST https://datahub.example.com/api/v1/tokens \
-H "Cookie: session_cookie_here" \
-H "Content-Type: application/json" \
-d '{
"name": "FPLC watcher",
"scopes": ["instruments:read", "instruments:write", "watchers:read", "watchers:report", "runs:create", "runs:update", "runs:upload", "files:update"],
"expires_at": "2027-01-01T00:00:00Z"
}'scopes is required and must list at least one specific scope. Data Hub rejects the wildcard * and the older coarse scopes runs:write, files:write, and watchers:write.
expires_at is optional; without it, the token never expires. Data Hub rejects a request that includes user_id, because tokens don’t belong to a person. The response includes the token once, in the token field.
Use a token
With the watcher
Paste the token when data-hub-watcher init asks for it. You can also set it first:
export DATA_HUB_API_KEY=dhub_your_token_here
data-hub-watcher initWith the REST API
curl https://datahub.example.com/api/v1/instruments \
-H "Authorization: Bearer dhub_your_token_here"See the API overview for more.
MCP clients sign in with OAuth instead of a token. See MCP overview.
View tokens
Settings → Access Tokens lists every active token with these columns:
- Name
- Created by: the admin who made the token. For tokens created before October 6, 2026, this shows the person the token used to act as.
- Token: the prefix only, because Data Hub never stores the full token
- Scopes
- Last used
- Expires
- Created
datahub.example.com/settings/tokens

Revoke a token
Go to Settings → Access Tokens.
Choose the delete icon on the token’s row, then confirm.
The token stops working immediately. Clients using it start receiving 401 Unauthorized.
To revoke a token through the API, send a DELETE from a signed-in admin session:
curl -X DELETE https://datahub.example.com/api/v1/tokens/your_token_id \
-H "Cookie: session_cookie_here"A revoked token leaves the list, but Data Hub keeps its record. Wherever the token acted, its name stays visible and is marked (revoked).
After revoking a token
If a running watcher used that token:
Create a new token with the Watcher preset.
On the instrument PC, run data-hub-watcher init again and enter the new token. The new token takes over the existing watcher registration, so you don’t need to deregister the old one first.
Restart the watcher (data-hub-watcher watch or the Windows service).
When someone leaves
Tokens keep working after the admin who created them leaves or their account is deleted, because tokens act as themselves. When someone leaves, check the Created by column and revoke any of their tokens that nobody else should keep using.
Token hygiene
- Name tokens clearly: name each one after the PC or client it belongs to, for example “FPLC watcher, Lab 201”
- Set expirations: give temporary setups a token that expires
- Give each token the fewest scopes it needs: don’t hand out a broad token for a single read-only integration; see Token scopes
- Revoke unused and exposed tokens immediately: revoke a token when you stop using its watcher or the token may have been exposed. Revoking takes effect at once, and clients using the token start getting
401 Unauthorized; see After revoking a token. - Revoke a departing person’s tokens: tokens keep working when the person who created them leaves, so check the Created by column under Settings → Access Tokens
Data Hub stores only a SHA-256 hash of each token, never the token itself.