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

# Authentication

> Create an API key and use it to authorize requests from the Validio API, SDK, and CLI.

All requests to interact with the Validio platform through the API require authorization with an API key. An API key consists of an access key and an access secret. To create one, see [Managing API keys](https://docs.validio.io/v10.3/docs/access-and-settings/settings/managing-api-keys.md).

> [!WARNING]
>
> **Caution**
>
> The API key credentials cannot be obtained again. If you lose your credentials, you must either create a new API key or regenerate the credentials for your existing API key.

## Authorize API requests

To authenticate your requests to the GraphQL API, pass the `Authorization` header. The header value has the format `<access-key>:<access-secret>`.

> [!TIP]
>
> You can use environment variables to avoid storing credentials on disk. The variables to set are `VALIDIO_ENDPOINT`, `VALIDIO_ACCESS_KEY`, and `VALIDIO_SECRET_ACCESS_KEY`.

## How the CLI and SDK find credentials

The Validio SDK, and the CLI that wraps it, look for credentials in the following order:

1. The environment variables `VALIDIO_ENDPOINT`, `VALIDIO_ACCESS_KEY`, and `VALIDIO_SECRET_ACCESS_KEY`.
2. A `config.json` in the path set by `VALIDIO_CONFIG_PATH`.
3. A `config.json` in an OS-specific path defined by [platformdirs](https://platformdirs.readthedocs.io/en/latest/).

You can create the `config.json` with the Validio CLI by running `validio config init`. See [Configure default API credentials](https://docs.validio.io/v10.3/developer/getting-started.md#configure-default-api-credentials).

When using the SDK, you can also pass the credentials directly to the client without storing them on your disk. See [Validio SDK](https://docs.validio.io/v10.3/developer/validio-sdk.md).

## API keys and namespaces

An API key has a global role, similar to the global role for users, that determines access rights for non-namespaced resources such as users, namespaces, and tags. For how API keys gain access to namespaces, see [API keys and namespaces](https://docs.validio.io/v10.3/developer/getting-started/namespaces.md#api-keys-and-namespaces).
