BindKit

Developers

Security headers

Your own keys in every sample. Sign in and the code on this page uses your web agent's publishable key.

Sign in

If your site sends a Content-Security-Policy, add BindKit to it. The messenger runs in a frame with no address of its own, so your page's policy applies to it too. Anything the policy refuses doesn't load, and the reason shows only in the browser's console.

Content-Security-Policy
script-src 'self' https://api.bindkit.ai 'wasm-unsafe-eval';
connect-src 'self' https://api.bindkit.ai wss://api.bindkit.ai
  https://huggingface.co https://*.hf.co;
style-src 'self' 'unsafe-inline';
img-src 'self' https: blob:;
worker-src blob:

Merge these into the policy you have and send it as one line. To check it first, send it as Content-Security-Policy-Report-Only, which reports what it would refuse without refusing it.

Directive Why BindKit needs it
script-src https://api.bindkit.ai serves the messenger and your components' code. 'wasm-unsafe-eval' runs the speech model for dictation.
connect-src https://api.bindkit.ai is the API, and wss://api.bindkit.ai streams replies. The speech model downloads from https://huggingface.co, which redirects to a *.hf.co host.
style-src 'unsafe-inline' allows the <style> elements in the messenger's shadow root, without which it draws unstyled. It needs no style attributes, so you can allow only the elements: style-src-elem 'self' 'unsafe-inline'.
img-src https: allows the pictures in your articles and components, which can be on any host. To be stricter, replace it with https://api.bindkit.ai and the hosts your pictures are on. blob: shows a preview of the files a visitor attaches.
worker-src blob: starts the worker that runs dictation.
frame-src, font-src Nothing to add: the frame has no address, and the messenger loads no fonts.

Without dictation

Dictation runs in the visitor's browser, so what they say never leaves it. It is the only reason for 'wasm-unsafe-eval', worker-src and the Hugging Face hosts. If you leave those out, hide its button too, or dictation stops at “Getting dictation ready”:

app.js
BindKit.messenger({ publishableKey: 'pk_...', css: '.bk-mic { display: none; }' })

Nonces

With a nonce in script-src, keep https://api.bindkit.ai there as well: widget.js loads the rest of the messenger, which can't carry your nonce. Your own inline <script> that calls BindKit.messenger() needs the nonce like any other, or skip it with the data-publishable-key attribute.

What stops the messenger loading

Header What happens
'strict-dynamic' in script-src The browser ignores the hosts listed beside it and refuses messenger.js. Use the sandbox, which works with it.
require-trusted-types-for 'script' widget.js is refused when it writes its frame. Use the sandbox, which works with it.
Cross-Origin-Embedder-Policy: require-corp widget.js is refused. Use credentialless, or the sandbox, which works with both.

Other headers

For dictation, keep microphone=(self) in Permissions-Policy: with microphone=(), visitors are asked to allow a microphone they can't. BindKit needs nothing from Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, frame-ancestors, Referrer-Policy, Cross-Origin-Opener-Policy or Cross-Origin-Resource-Policy, so set them as strictly as you like.

In the sandbox

The sandbox runs on embed.bindkit.ai, with a policy of its own, so yours only has to let the frame in. connect-src, style-src, img-src and worker-src need nothing for BindKit. With an iframe of your own, frame-src is all it takes. The loader needs script-src too.

Content-Security-Policy
script-src https://embed.bindkit.ai;
frame-src https://embed.bindkit.ai;
Header In the sandbox
'strict-dynamic' Works. Give the loader's <script> your nonce, and keep frame-src.
require-trusted-types-for 'script' Works.
Cross-Origin-Embedder-Policy Works with require-corp and credentialless.
Permissions-Policy For dictation, the frame needs the microphone: microphone=(self "https://embed.bindkit.ai"), and allow="microphone" on an iframe of your own. Without them, the rest of the messenger still works.

CORS

You don't need to configure CORS for BindKit, or list your domain with us. The messenger's API answers any origin, without cookies: the publishable key says which agent a request is for, and it's safe to expose.

Address What it answers
/api/v1/* Access-Control-Allow-Origin: *, with the headers content-type and x-bindkit-key. It never allows credentials, and no other header gets through a preflight, so an Authorization header is refused.
/api/images/*, /component-runtime.js, /whistle/*, /sandbox/* Access-Control-Allow-Origin: *.
/widget.js, /messenger.js No CORS headers, as plain scripts need none. Don't add crossorigin to the widget.js tag, which makes the browser ask for them and refuse the script.
wss://api.bindkit.ai WebSockets don't use CORS. Only connect-src applies.

Your own servers need CORS only for calls your page makes across origins, as for any other request. A userToken function or an onAction runs on your page, so a call to your own origin needs none, and one to another origin needs that server to allow your page, with Access-Control-Allow-Credentials if it reads your cookies. BindKit's servers call your MCP servers directly, not from a browser, so CORS doesn't apply there. A component's code from the dashboard runs with your page's origin in the default install. In the sandbox it has no origin and can't make requests, so have onAction make them.

Put an agent in your product this week