Guide
Clara Widget guide
One script tag adds the Clara voice scribe to any web page. It fills your own fields by id, emits events on window, and runs under your organization's key.
Install: one script tag
Paste the tag before </body> of the page where the clinician documents. The widget reads its configuration from the data-clara-* attributes of its own tag, draws the floating Clara button and, when a consultation starts, writes each value into the inputs of your page whose id or name matches a field of the template.
Two environments: cdn.clara.care talks to the production API (real systems, real patients, keys created in the production Platform) and cdn-dev.clara.care to the development API (testing and staging, no real patient data; development keys only). Keys of one environment do not work in the other.
<script
src="https://cdn.clara.care/widget/latest.js"
data-clara-api-key="PUBLISHABLE_KEY"
data-clara-template="TEMPLATE_ID"
data-clara-lang="en"
></script>
Attributes
| Attribute | Values | Description |
|---|---|---|
data-clara-api-key | | Your organization's publishable key. |
data-clara-template | | Template filled in while dictating. Alias: data-clara-template-id. |
data-clara-lang | es | en | Interface language. If you set it, the user cannot change it. |
data-clara-color | #2a4276 | Primary color (hex). |
data-clara-position | bottom-right | bottom-left | center | Where the button appears. Defaults to bottom-right. |
data-clara-launcher-left, data-clara-launcher-bottom | px | Fixed position of the button. |
data-clara-draggable | true | false | Lets the user drag the button. Defaults to true. |
data-clara-auto-open | true | Opens the panel when the page loads. |
data-clara-web-font | true | Loads Plus Jakarta Sans from Google Fonts. Off by default (a strict CSP blocks it). |
data-clara-voice-fill-mode | text | live | text (default): fills in from each transcribed sentence. live: fills in while listening. |
data-clara-chirp-transcript | true | false | Chirp does the transcription (on by default); false turns it off. |
data-clara-link-quality | true | false | Discreet latency indicator in the session header (on by default). |
data-clara-enable-google-login, data-clara-google-client-id | true | false, id | Sign-in with Google and its OAuth client id. |
data-clara-login-branding-* | enabled, label, partner-name, logo-url, logo-alt | Your organization's brand appears automatically from your key or loader; these override it. |
data-clara-auto-unmount | true | false | Unmounts when the iframe that injected it navigates away. Defaults to true. |
data-clara-template-builder | true | false | Offers to create a template from the form on screen. Defaults to true. |
data-clara-trusted-origins | https://a.com,https://b.com | Origins on other domains the widget exchanges fill commands with (EHR iframes). Without them it only talks to your own origin. |
How the widget finds your fields
Each field of the template has an htmlFieldId. When Clara extracts a value, the widget looks for an element with that id (or name) on the page: inputs, textareas, selects and checkboxes. It writes the value and dispatches the input and change events your framework listens to, so React, Vue or Angular state updates as if the person had typed. Fields inside iframes of your own origin work too; other origins need data-clara-trusted-origins.
The person keeps control: values are written into the form they are already looking at, nothing is saved by the widget, and a template can be created from the form on screen with the template builder.
// Every field with a stable id (or name): the htmlFieldId in your template.
<input id="reason_for_visit" value={reason} onChange={(e) => setReason(e.target.value)} />
// React Hook Form: register sets the name; Clara finds it just the same.
<textarea {...register('treatment_plan')} />
Events on window
The widget dispatches CustomEvents on window so your application can react: mark fields, lock them, show the transcript, or save the visit when the session ends. Clara Form listens to the same events to fill itself without any network.
window.addEventListener('clara:session-started', (e) => {
console.log('Visit started', e.detail.analysisId);
});
window.addEventListener('clara:field-filled', (e) => {
const { fieldName, value } = e.detail;
// Clara has just filled fieldName
});
window.addEventListener('clara:session-stopped', (e) => {
saveVisit(e.detail.analysisId);
});
| Event | detail |
|---|---|
clara:session-started | { analysisId, timestamp } |
clara:session-stopped | { analysisId, timestamp } |
clara:field-filled | { fieldName, value, sectionKey, timestamp, analysisId?, sourceUtteranceId?, sourceText? } |
clara:formdata-updated | { formData, changedField?, changedFields?, timestamp } |
clara:transcript-updated | { role, content, messages: [{ id?, role, content, timestamp, speaker? }], timestamp, speakersChanged? } |
clara:title-updated | { title, analysisId, timestamp } |
clara:template-changed | { templateId, templateName, sections, timestamp } |
clara:odontogram-updated | { fieldId, teeth, timestamp } |
clara:odontogram-cleared | { fieldId, teeth, timestamp } |
JavaScript API
| Call | Description |
|---|---|
ClaraWidget.destroy() | Ends the visit in progress, unmounts the widget and deletes window.ClaraWidget. |
ClaraWidget.fill(fieldId, value, sectionKey?) | Fills a field on your page the way Clara would. |
ClaraWidget.init(config) | Manual start with the configuration in camelCase (apiKey, templateId, lang, position…). The script already starts on its own when it loads: do not call it on a mounted widget. |
ClaraStore.getFormData() | Values Clara has filled in. |
ClaraStore.getTranscript() | Transcript messages. |
ClaraStore.getCurrentAnalysis() | Active visit. |
ClaraStore.isAuthenticated() | Whether there is a signed-in session. |
ClaraStore.subscribe(listener) | Calls listener on every state change; returns the function to unsubscribe. |
React and Next.js
In a React or Next.js app install @clara.care/widget and mount <ClaraWidget> once, in the layout, so it stays across routes. The component takes the same options as the attributes, in camelCase. initClaraWidget and destroyClaraWidget give you the same from plain code.
npm install @clara.care/widget
'use client';
// app/clara.tsx: put it in app/layout.tsx so it stays mounted across routes
import { ClaraWidget } from '@clara.care/widget/react';
export default function Clara() {
return <ClaraWidget apiKey="PUBLISHABLE_KEY" templateId="TEMPLATE_ID" lang="en" />;
}
Your organization: key, sites and brand
Publishable keys are created in Clara Platform, Integrate. The same screen lists your widget sites: the origins (https://your-ehr.com) where you embed Clara, which the API answers with CORS on the widget's routes and nothing else. Without that registration the browser blocks the widget's calls from your page.
Platform also gives your organization its own loader (https://cdn.clara.care/t/YOUR_CODE/widget.js) that pins a verified release and carries your name, logo and icon. With a verified custom domain the widget shows only your brand. If the organization is suspended, the API rejects its key and the widget stops working until it is reactivated.
<script
src="https://cdn.clara.care/t/YOUR_CODE/widget.js"
data-clara-api-key="PUBLISHABLE_KEY"
data-clara-template="TEMPLATE_ID"
data-clara-lang="en"
></script>
Content Security Policy and permissions
A strict CSP on your page needs these sources. The microphone is requested by the widget itself in the top-level page; if your page is served inside an iframe, delegate it with allow="microphone".
| Directive | Value | For |
|---|---|---|
script-src | https://cdn.clara.care | the widget bundle (or your organization's loader) |
connect-src | https://api.clara.care | sign-in, templates, consultations |
connect-src | https://proxy-aws.clara.care wss://proxy-aws.clara.care | the voice session |
connect-src | https://*.s2.dev | the consultation stream |
style-src | 'unsafe-inline' | the widget injects its stylesheet |
img-src | https://cdn.clara.care | your organization's logo and icon |
Permissions-Policy | microphone=(self) | recording in the top-level page |
Without touching the system: the browser extension
Clinics that cannot change their software use the Clara extension for Chrome, Edge and other Chromium browsers: the same assistant from a side panel, configured with the organization's key, template and the sites where it works. Your organization's package is downloaded from Clara Platform, Integrate.
Planning an integration?
Tell us about your system and your forms. We run small pilots with technology partners.


