curl request to https://api.datalyr.com/v1/workspace returns your
workspace instead of 401.
Before you start
You must have theowner or admin role in the workspace. A member cannot generate or
regenerate a key.
The two workspace keys
Settings → API holds exactly one key of each type. The two are not interchangeable.
The
/v1 handler reads the Authorization header, requires the Bearer scheme, and
requires the token to start with dk_agent_. A write key fails that prefix test, so it
returns 401.
Create the key
- Open Settings → API.
- Find the Agent key card.
- Select generate key, or regenerate when a key already exists.
- Confirm in the dialog.
- Copy the full value from the one-time dialog.
Copy the key before you close the dialog. We store a SHA-256 hash for lookup and never
show the full value again, so a lost key means regenerating, which breaks every client
still holding the old one.
Send the key
The key identifies the workspace on its own. No workspace ID or header goes in the
request.
What a rejected request looks like
A rejected request returns HTTP401, the header
WWW-Authenticate: Bearer realm="Datalyr Read API", and this body:
Authorization header, a header that is not two
space-separated parts, a scheme other than Bearer, a token without the dk_agent_
prefix, and a token whose hash matches no workspace.
We cache both a valid and an invalid key lookup for 300 seconds, so a fresh key can take
that long to take effect everywhere.
Verify
Run thecurl command above against /v1/workspace. A 200 response with your
workspace name proves the key works.
When it doesn’t work
Next
- Read API: the sixteen endpoints and their parameters.
- Errors and limits: the rate limit and every status code.
- Connect Claude or Codex: read the same data over OAuth, with no key to store.