Tawa docs
Guides

Authentication

How the Python client authenticates, and how key verification works.

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:

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 for the full eager-vs-lazy breakdown.

Keep your secret key server-side. Don't ship it to the browser or commit it.

Managing keys

Create and revoke API keys from the dashboard under Settings → API keys.

Calling the API without the SDK, or need the raw /verify endpoint and error shape? See Authentication in the API Reference.

On this page