> For the complete documentation index, see [llms.txt](https://docs.layerlens.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layerlens.ai/more-in-this-section-9/authentication.md).

# Authentication

SDK authentication — API keys, env vars, key scoping.

## API key

Generate at **Premium → Settings → API keys**. Set as env var:

```bash
export LAYERLENS_STRATIX_API_KEY="ll_..."
```

Or pass explicitly:

```python
client = Stratix(api_key="ll_...")
```

## Scoping

API keys can be scoped to a subset of permissions: `traces:read`, `traces:write`, `replay:execute`, `feedback:write`, `feedback:read`, `admin`, `ingest`. Scope keys narrowly when issuing for CI runners or third-party integrations.

## Rotation

Rotate via **Settings → API keys → Rotate**. The old key works for 24 hours during the grace period.

## See also

* [Client configuration](/more-in-this-section-9/client.md)
* [Errors](/more-in-this-section-9/errors-1.md)
