***

title: verify_api_key
slug: /reference/python/agents/configuration/auth-handler/verify-api-key
description: Verify an API key using constant-time comparison.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

Verify an API key using constant-time comparison.

## **Parameters**

<ParamField path="api_key" type="str" required={true} toc={true}>
  The API key string to verify.
</ParamField>

## **Returns**

`bool` -- `True` if the key matches. Returns `False` if API key authentication
is not enabled.

## **Example**

```python {6}
from signalwire.core.security_config import SecurityConfig
from signalwire.core.auth_handler import AuthHandler

security = SecurityConfig()
auth = AuthHandler(security)
is_valid = auth.verify_api_key("my-secret-api-key")

print(f"API key valid: {is_valid}")
```