# Configuration

## Environment Variables

| Variable | Required | Description |
|---|---|---|
| `UNPAYWALL_EMAIL` | For PDF downloads | Email for Unpaywall API |
| `S2_API_KEY` | No | Semantic Scholar API key (higher rate limits) |

## Config File

Path: `~/.config/axm-bib/config.toml`

```toml
email = "user@example.com"
```

This file is auto-created when you respond to the interactive email prompt on first `axm-bib pdf` use.

## Email Resolution Order

For PDF downloads, the Unpaywall email is resolved in this order:

1. `UNPAYWALL_EMAIL` environment variable
2. `~/.config/axm-bib/config.toml`
3. Interactive prompt (value is saved to config file)

## Semantic Scholar API Key

The public S2 API has rate limits (~100 requests per 5 minutes). For heavier use, get a free API key:

1. Request at [Semantic Scholar API](https://www.semanticscholar.org/product/api#api-key-form)
2. Set the environment variable:

```bash
export S2_API_KEY="your-api-key"
```

!!! note "Environment variable only"
    Unlike `UNPAYWALL_EMAIL`, the S2 API key is resolved **only** from the
    `S2_API_KEY` environment variable. It cannot be set in `config.toml`.
    If unset, public rate limits apply — this is fine for occasional use.
