Overview
API keys authenticate your requests to Roark’s API, enabling secure access to monitoring, testing, and analytics features.API keys are essential for all integrations - whether you’re using our SDKs, webhooks, or direct API calls.
Two kinds of credential
Roark issues two shapes of bearer credential. Both go in the sameAuthorization: Bearer header, and most callers only ever need the first.
Use a project key for anything automated: ingestion, webhooks, CI pipelines, a service that
outlives whoever set it up. A project key keeps working when people join and leave, which is
exactly what a pipeline needs and exactly what a user credential deliberately does not do.
Generating an API Key
1
Navigate to API Keys
Go to the API Keys section in your dashboard
2
Create New Key
Click the “Create API Key” button
3
Set Permissions
Choose your access level:
- Read-Only: Retrieve data only
- Full Access: Read and write operations
4
Save Securely
Copy and store your key immediately - it won’t be shown again

Using Your API Key
All API requests require authentication via the Authorization header:Choosing the project a request acts on
A project key is bound to one project, so it never has to say which. A user credential can reach every project you are a member of, so each request names one with theX-Roark-Project-Id header:
GET /v1/projects is computed through the same permission engine that gates every other request, so
it will not advertise a project that your next call rejects. A project key gets a one-element list:
the project it is bound to.
When a project cannot be resolved
That last one is deliberately an error rather than a silent no-op. A caller that believes it is
writing to project B must never end up writing to project A.
A user credential created through a browser consent remembers the project chosen on the consent
screen and falls back to it when a request names none, so a client that never sends the header
still works. Do not rely on it if your integration touches more than one project: send the header
explicitly and the behaviour stays obvious.
Building your own browser login
Only relevant if you wrote your own client againstPOST /v1/cli/auth/token. The Roark CLI and MCP
server already handle this.
That endpoint’s response gained fields, and projectId is now nullable:
scopeKind to know what you were given. A projectId of null means the credential is
user-scoped and has no single project: treat it as “call GET /v1/projects and pick one”, never as
an error. defaultProjectId is the project chosen on the consent screen, which is what the API falls
back to when a request names none, so storing it is the simplest way to keep working without asking.
Security Best Practices
Environment Variables
Store keys in
.env files or secure vaults, never hardcode themRegular Rotation
Regenerate keys periodically to maintain security
Least Privilege
Use read-only keys when write access isn’t needed
Monitor Usage
Check last-used timestamps to detect unauthorized access
Common Integration Patterns
- SDK Integration
- CI/CD Pipeline
Initialize SDKs with your key:
Need Help?
API Reference
Explore all available endpoints and parameters
Integration Guides
Step-by-step platform integration tutorials