# Authentication

Authenticate API requests with a FiscalRail secret key.

FiscalRail authenticates API requests with secret keys. Create the first key from **Developers → API keys** in the [dashboard](https://dashboard.fiscalrail.com). Once authenticated, you can [manage API keys through the API](/en/api/api-keys).

Send your key as a Bearer token in the `Authorization` header:

```http
Authorization: Bearer ak_...
```

Secret keys provide access to an account and must only be used in trusted server-side code. Do not put them in browser code, mobile applications, source control or public documentation.

Keys beginning with `ak_test_` are reserved for the test environment. Live keys use the `ak_` prefix without the `test` marker. A secret key is only shown once when it is created, so store it securely.

Read the key from your application's secret manager and pass it explicitly to the Python SDK:

```python
import os

from fiscalrail import FiscalRail

client = FiscalRail(os.environ["FISCALRAIL_API_KEY"])
```

The SDK deliberately does not inspect environment variables. See the [Python SDK guide](/en/python-sdk) for installation and connection pooling.
