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

# Authentication

> Authenticate WebSocket connections using API keys and Ed25519 signatures.

## Signing a request

To initiate a WebSocket connection to Anchorage Digital, the initial connection request header must be authenticated by including your API access key in the `Api-Access-Key` header and by providing an Ed25519 signature specifying the `Api-Signature` and `Api-Timestamp` headers. To register an API key for websocket trading, follow the [Setup guide](/knowledge-base/api-reference/introduction#send-your-first-api-call) and assign the **Execute trades (TRADE)** permission to your API key.

Code example for creating and signing a request header:

```python theme={null}
from nacl import signing
import requests

def signed_request(request: requests.PreparedRequest, api_access_key, api_signing_key):
    timestamp = timestamp = str(int(time.time()))
    message = b"".join(
        [bytearray(timestamp, "utf-8"), bytearray(request.method, "utf-8"),
         bytearray(request.path_url, "utf-8"), request.body]
    )
    signing_key = signing.SigningKey(api_signing_key)
    signature = signing_key.sign(message).signature.hex()

    request.headers["Api-Access-Key"] = api_access_key
    request.headers["Api-Signature"] = signature
    request.headers["Api-Timestamp"] = timestamp
    return request
```
