Create an API key
Follow these steps inside your Ragen instance to generate a new key:1
Open API Keys
Log in to your Ragen instance, then navigate to Settings → API Keys.
2
Create a new key
Click Create API Key. Give the key a descriptive name and select the project (assistant) it should access by default.
3
Configure optional settings
Enable Debug mode if you want API conversations saved as threads visible in the API threads tab. This is useful during development but should be disabled for production keys handling sensitive queries.
4
Copy the key immediately
Click Create. The full key is displayed only once. Copy it now and store it in a secrets manager or environment variable — only a masked version is kept for display afterward.
API key format
Every Ragen API key follows this structure:sk- prefix signals that the value is an API secret key. The <keyId> portion identifies the key; the <secret> portion is the credential that authenticates the request. Both parts are required.
Passing the Authorization header
Include the key as aBearer token in the Authorization header of every request:
With the TypeScript SDK
The SDK reads your key from theRAGEN_API_KEY environment variable by default, so you rarely need to pass it explicitly:
API key scope
An API key is bound to:- One organization — all operations act on resources within that organization.
- One default project (
assistantId) — chat completions use this project unless you pass a differentassistantIdper call.
Debug mode
Each API key has an optional Debug mode toggle you can enable when creating the key. When debug mode is on:- Every API conversation is persisted as a thread on the server.
- The saved threads appear in the API threads tab inside your Ragen instance.
- This lets you inspect the full context, retrieved documents, and generated responses for each call.
Disable debug mode for production keys to avoid storing user conversations unnecessarily. You can create a separate debug key for development and keep your production key clean.