# Integrate Katcha safely

Read the [quick start](/markdown/guide/quick-start.md),
[widget configuration](/markdown/guide/configuration.md), and
[server verification](/markdown/api/verify.md) before editing the project.
Use the [page index](/llms.txt) to select additional guidance, or read the
[complete documentation](/llms-full.txt).

## Establish the deployment contract

Ask the operator for the deployed widget URL, verification URL, and public site
key if absent. Documentation hosts ending in `.example` are placeholders.
Do not invent service hosts, package names, renamed API paths, or compatibility
with an older widget. Identify the protected form and its server endpoint.

## Implement and review

Use `window.katcha`, the `katcha` container class, and `katcha-token` form field.
Set the widget language to English. Map the token to `challenge_id` in POST JSON
alongside `site_key` and `secret_key`. Load the private key on the server from
`KATCHA_SECRET_KEY`; load the operator-approved HTTPS verification URL from
`KATCHA_VERIFY_URL`. These environment names are application conventions.

Never place secrets in browser bundles, public environment variables, prompts,
logs, or source control. Do not ask the user to paste secrets into a chat.
Require the literal `success: true` before protected side effects. Reject absent
tokens, timeouts, transport failures, malformed JSON, and non-boolean success.
Retain authentication, authorization, input validation, and CSRF protection.

## Test before release

Test valid, missing, expired, and duplicate tokens, failed verification,
network errors, and malformed responses. Use mocks for failure paths and staging
for deployment checks. Inspect browser bundles for accidental secrets. Review
generated changes with a human before deploying.
