Skip to main content

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 same Authorization: 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.
A user credential cannot exceed the person holding it. Its access is recomputed on every request as the permissions approved at consent intersected with your live membership of the project being acted on, so losing access in the dashboard removes it from the credential at the same moment.

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
Create API Key Modal

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 the X-Roark-Project-Id header:
Two endpoints answer “what am I holding, and what can it reach”, so a client never has to infer either from a failed request:
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 against POST /v1/cli/auth/token. The Roark CLI and MCP server already handle this. That endpoint’s response gained fields, and projectId is now nullable:
Read 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.
A client that validates projectId as a required string will reject a perfectly good user credential. Accept both shapes before anyone in your organization is issued one.

Security Best Practices

Never expose your API key in client-side code, public repositories, or logs. If compromised, regenerate immediately in your dashboard.

Environment Variables

Store keys in .env files or secure vaults, never hardcode them

Regular 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

Initialize SDKs with your key:

Need Help?

API Reference

Explore all available endpoints and parameters

Integration Guides

Step-by-step platform integration tutorials