Skip to main content

Domain whitelist

Restrict your API key so it only works on domains you control. This limits exposure if your key is ever scraped from your front-end code. A key with an empty domain list is unrestricted: no origin check is made and it works from any website or server.

How to configure

  1. In your dashboard, go to API Keys.
  2. Click Security on the key you want to restrict.
  3. Under Allowed domains, add your domains.
You can also enter domains when you create the key. URLs are cleaned automatically (https://www.example.com/page becomes example.com).

How matching works

The server reads the request origin from the first of these headers that is present: X-Widget-Origin, Origin, Referer. It keeps the hostname, removes a leading www., and compares it with each entry (also stripped of www.). No regex, no wildcard syntax — entering kookai.fr is enough to cover your entire domain and all its subdomains.

Effect on requests

  • Widget requests include an Origin header automatically (set by the browser)
  • Direct API calls must include an Origin (or Referer) header manually when restrictions are active
  • Requests with no such header receive 403 Origin header required when domain restrictions are active
  • Requests from a non-whitelisted origin receive 403 Domain not authorized for this API key

Server-to-server calls

Server-side calls don’t have a browser Origin. Two options:
  1. Remove domain restrictions for keys used exclusively server-side
  2. Add your server’s domain to the whitelist and send it as the Origin header
The origin header is set by the caller, so this check protects against accidental use from other sites, not against a caller who sets the header deliberately. Keep server-side keys on your server.