Skip to main content

Authentication

All API requests must include your API key in the Api-Key header.

API Keys

API keys are scoped to your organization and can be created in the Dashboard.
EnvironmentKey PrefixDescription
Sandboxlk_test_For testing and development
Productionlk_live_For live transactions
Security Best Practices
  • Never expose API keys in client-side code
  • Don’t commit keys to version control
  • Rotate keys periodically
  • Use separate keys for development and production

Making Authenticated Requests

Include your API key in the Api-Key header:
curl https://api.ledger.so/v1/agents \
  -H "Api-Key: lk_test_your_api_key"

Error Responses

Missing API Key

{
  "error": "Missing Api-Key header"
}
Status: 401 Unauthorized

Invalid API Key

{
  "error": "Invalid API key"
}
Status: 401 Unauthorized

Expired API Key

{
  "error": "API key expired"
}
Status: 401 Unauthorized

Rate Limits

API requests are rate-limited per organization:
OperationRateBurst
Read (GET)100/min20
Write (POST/PATCH/DELETE)30/min10
Card Creation10/min5
When rate limited, you’ll receive:
{
  "error": "Rate limit exceeded",
  "retryAfter": 5000
}
Status: 429 Too Many Requests Headers:
  • Retry-After: Seconds until you can retry

Managing API Keys

Create a Key

  1. Go to Dashboard
  2. Navigate to Settings > API Keys
  3. Click Create Key
  4. Name your key and set expiration (optional)
  5. Copy the key immediately (it won’t be shown again)

Revoke a Key

  1. Go to Settings > API Keys
  2. Find the key you want to revoke
  3. Click Revoke
Revoking a key is immediate and permanent. Any requests using that key will fail.

Environments

EnvironmentBase URL
Sandboxhttps://sandbox.ledger.so
Productionhttps://api.ledger.so
Use sandbox for testing. No real charges are made and you can use test credentials.