Get your public key
Open your dashboard at Settings → Developers and create or copy a Public key.
Configure environment variables
Next.js
NEXT_PUBLIC_COSSISTANT_API_KEY=pk_live_xxxxxxxxxxxxReact
COSSISTANT_API_KEY=pk_live_xxxxxxxxxxxxAuto-detection
The SDK automatically checks NEXT_PUBLIC_COSSISTANT_API_KEY and COSSISTANT_API_KEY. You can also pass the key explicitly through publicKey.
Public vs private keys
| Type | Prefix | Purpose | Safe in browser |
|---|---|---|---|
| Public | pk_live_*, pk_test_* | Widget integration | Yes |
| Private | sk_live_*, sk_test_* | Server-to-server API | No |
Only use public keys in frontend widget code.
Allowed domains
Public keys work only on whitelisted domains.
- Production keys (
pk_live_*) require explicit allowlisting. - Test keys (
pk_test_*) work on localhost.
Use full origins, for example:
https://example.comhttps://app.example.comhttps://staging.example.com
Troubleshooting
Configuration error in the widget
Check:
- env variable name is correct
- key is still active
- app was restarted after env changes
Domain not allowed
Check:
- domain is listed in Settings → Developers → Allowed domains
- protocol matches (
https://)