> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ledger.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> How to authenticate requests to the Ledger API.

## API keys

Create API keys from the [Ledger Dashboard](https://dashboard.ledger.so). Each key is scoped to an environment:

* **Sandbox** — keys start with `ld_test_`. No real money moves.
* **Live** — keys start with `ld_live_`. Real funds, real cards, real bank transfers.

Key format: `ld_<env>_<prefix>_<secret>`

## Sending your key

Include your API key in every request using either header format:

<CodeGroup>
  ```bash Authorization header theme={null}
  curl https://api.ledger.so/v1/customers \
    -H "Authorization: Bearer ld_test_..."
  ```

  ```bash X-API-Key header theme={null}
  curl https://api.ledger.so/v1/customers \
    -H "X-API-Key: ld_test_..."
  ```
</CodeGroup>

## Environments

All resources are scoped to the API key that created them. A sandbox key cannot access live resources and vice versa.

| Environment | Key prefix | Base URL                   |
| ----------- | ---------- | -------------------------- |
| Sandbox     | `ld_test_` | `https://api.ledger.so/v1` |
| Live        | `ld_live_` | `https://api.ledger.so/v1` |
