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

# Authentication

> Authenticate requests to Uniblock WebSocket endpoints.

Most Uniblock WebSocket endpoints use the following header:

* Header: `X-API-KEY`
* Value: Your unique Uniblock API key

Some provider-specific endpoints use query parameter authentication instead.
For example, Hydromancer requires `apiKey` in the connection and validation
URLs.

Codex also accepts `apiKey` as a query parameter and requires the API key in the
GraphQL WebSocket `connection_init` payload under `Authorization`.

## Authentication flow

Use the same authentication header for both steps of the connection flow:

1. Send an HTTP request to the provider's `/validate` endpoint.
2. Open the corresponding WSS endpoint.
3. Send your provider-specific subscription or message payload.

<Tip>
  Use a WebSocket client that supports custom headers so you can pass
  `X-API-KEY` during connection setup.
</Tip>

## Example validation request

```bash theme={null}
curl --request GET \
  --url 'https://websocket.uniblock.dev/ankr/validate?chainId=1' \
  --header 'X-API-KEY: YOUR_UNIBLOCK_API_KEY'
```

## Notes

* Reuse the same header values when moving from validation to the WebSocket
  connection.
* Some providers require additional query parameters such as `chainId` or
  `apiKey`.
* Message formats after connection are provider-specific.
