Skip to content

Authentication

Get Your API Key

  1. Sign in to the Dashboard

    Go to ladger.pages.dev and sign in with your GitHub account.

  2. Create or Select a Project

    From the dashboard, create a new project or select an existing one.

  3. Generate an API Key

    Navigate to Project SettingsAPI Keys and click Generate New Key.

  4. Copy Your Key

    Your API key will look like this:

    ladger_sk_live_abc123def456...

API Key Format

Ladger API keys follow a specific format:

PrefixEnvironmentExample
ladger_sk_live_Productionladger_sk_live_abc123...
ladger_sk_test_Developmentladger_sk_test_xyz789...
ladger_Legacyladger_abc123...

All keys must start with ladger_ or the SDK will throw an error.

Store Your Key Securely

Store your API key as an environment variable:

.env
LADGER_API_KEY=ladger_sk_live_your_key_here

Then 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.

PermissionDescription
ingest:writeSend spans and traces
project:readView project metrics

Rotating Keys

To rotate an API key:

  1. Generate a new key in Project Settings
  2. Update your application configuration
  3. Deploy the change
  4. Delete the old key from the dashboard

Troubleshooting

”apiKey is required”

Make sure you’re passing the API key to the constructor:

// ❌ Wrong
const tracer = new LadgerTracer({ flowName: 'app' });
// ✅ Correct
const tracer = new LadgerTracer({
apiKey: 'ladger_sk_live_...',
flowName: 'app'
});

“apiKey must start with ‘ladger_’”

Ensure your key has the correct prefix:

// ❌ Wrong
const tracer = new LadgerTracer({
apiKey: 'sk_live_abc123', // Invalid prefix
flowName: 'app'
});
// ✅ Correct
const tracer = new LadgerTracer({
apiKey: 'ladger_sk_live_abc123',
flowName: 'app'
});

Next Steps