# Authentication (/docs/python/guides/authentication)



`TawaGuard(api_key)` reads your key from the argument you pass it (or
wherever you source `TAWA_API_KEY` from). By default the sync client
verifies it against `/verify` immediately — a bad key raises
`TawaAPIError` at construction time rather than on the first scan call:

```python
from tawaguard import TawaGuard, TawaAPIError

try:
    client = TawaGuard("YOUR_API_KEY")
except TawaAPIError as err:
    if err.status_code == 401:
        ...  # bad or revoked key
```

The async client (`AsyncTawaGuard`) verifies eagerly only via
`AsyncTawaGuard.create(...)` or `async with` — see
[Configuration](/docs/python/sdk/client) for the full eager-vs-lazy
breakdown.

<Callout type="warn">
  Keep your secret key server-side. Don't ship it to the browser or commit
  it.
</Callout>

## Managing keys [#managing-keys]

Create and revoke API keys from the [dashboard](https://tawaguard.com) under
**Settings → API keys**.

<Callout type="info">
  Calling the API without the SDK, or need the raw `/verify` endpoint and
  error shape? See [Authentication](/docs/api/authentication) in the API
  Reference.
</Callout>
