Authentication
Get Your API Key
-
Sign in to the Dashboard
Go to ladger.pages.dev and sign in with your GitHub account.
-
Create or Select a Project
From the dashboard, create a new project or select an existing one.
-
Generate an API Key
Navigate to Project Settings → API Keys and click Generate New Key.
-
Copy Your Key
Your API key will look like this:
ladger_sk_live_abc123def456...
API Key Format
Ladger API keys follow a specific format:
| Prefix | Environment | Example |
|---|---|---|
ladger_sk_live_ | Production | ladger_sk_live_abc123... |
ladger_sk_test_ | Development | ladger_sk_test_xyz789... |
ladger_ | Legacy | ladger_abc123... |
All keys must start with ladger_ or the SDK will throw an error.
Store Your Key Securely
Environment Variables (Recommended)
Store your API key as an environment variable:
LADGER_API_KEY=ladger_sk_live_your_key_hereThen access it in your code:
import { LadgerTracer } from '@ladger/sdk';
const tracer = new LadgerTracer({ apiKey: process.env.LADGER_API_KEY!, flowName: 'my-app',});Using dotenv
If you’re using dotenv, load environment variables at the start of your application:
import 'dotenv/config';import { LadgerTracer } from '@ladger/sdk';
const tracer = new LadgerTracer({ apiKey: process.env.LADGER_API_KEY!, flowName: 'my-app',});Self-Hosted Configuration
If you’re running your own Ladger instance, specify the projectUrl:
const tracer = new LadgerTracer({ apiKey: process.env.LADGER_API_KEY!, flowName: 'my-app', projectUrl: 'https://ladger.your-company.com/api',});API Key Permissions
API keys have full access to send traces to the associated project. There are currently no scoped permissions.
| Permission | Description |
|---|---|
ingest:write | Send spans and traces |
project:read | View project metrics |
Rotating Keys
To rotate an API key:
- Generate a new key in Project Settings
- Update your application configuration
- Deploy the change
- Delete the old key from the dashboard
Troubleshooting
”apiKey is required”
Make sure you’re passing the API key to the constructor:
// ❌ Wrongconst tracer = new LadgerTracer({ flowName: 'app' });
// ✅ Correctconst tracer = new LadgerTracer({ apiKey: 'ladger_sk_live_...', flowName: 'app'});“apiKey must start with ‘ladger_’”
Ensure your key has the correct prefix:
// ❌ Wrongconst tracer = new LadgerTracer({ apiKey: 'sk_live_abc123', // Invalid prefix flowName: 'app'});
// ✅ Correctconst tracer = new LadgerTracer({ apiKey: 'ladger_sk_live_abc123', flowName: 'app'});Next Steps
- Start tracking your first AI call
- Learn about Flow Names and organization