Authentication
Neuroon exposes two credentials depending on where the request originates. Pick the one that matches the origin of the request; they are not interchangeable.
Which one should I use?
Comparison table
| Mechanism | Header | Format | TTL | Origin | Endpoints |
|---|---|---|---|---|---|
| Widget Token | X-Widget-Token | Opaque string | 24 h | Browser | /api/widget/* |
| API Key | Authorization: Bearer <key> | Bearer token | Permanent (until rotation) | Your server | /api/integrations/v1/* |
Widget Token flow (frontend)
- Your server signs the Widget Token locally using the API Key as the HMAC secret (
Base64URL(shopId:unixTimestamp:HMAC-SHA256(...))). See Recipe · Server-to-server token. - Cache the token (~23 h) and inject it as
data-tokenin the<script>tag served in your HTML. - The widget sends the token in every request to the backend as
X-Widget-Token. - When >23 h have passed, your server re-signs and rotates the token with zero downtime.
For manual cases (demo, dev), you can also generate a Widget Token from Dashboard → Shops → "Generate widget token". The JavaScript client does not sign anything: the token is opaque and the signature is validated server-side on every request.
API Key flow (server-to-server)
- Get your API Key from the Neuroon Dashboard (shop settings).
- Store it in your secret manager.
- In every request to
/api/integrations/v1/*include:
Authorization: Bearer <api-key>
- The API key is bound to a specific shop — you don't need to include
shopIdin the URL. The backend resolves the shop automatically. - Calls must be server-to-server. If a browser
Originis detected, the backend will reject the request.
Common errors
| Symptom | Likely cause |
|---|---|
401 Unauthorized with header present | Token expired, malformed, or from another environment |
401 Unauthorized without header | You forgot the Authorization: Bearer ... header |
404 Not Found | Shop not found for this API key |
402 Payment Required | Quota exceeded — upgrade your plan |
422 Unprocessable Entity | Search log ID not found or expired (conversions) |
429 Too Many Requests | Rate limit exceeded — check Retry-After |
Details for each: Errors.
Further reading
- Widget Token — issuance, rotation, usage.
- API Key — obtaining, storing, rotating.
- Rate Limits — quotas and backoff.
- Errors — codes, structure, field-level errors.