Create a widget
Creates a widget for an assistant and returns it with its snippets: paste snippets.bubble before </body> for a launcher, snippets.embed where the chat should sit, link to snippets.hosted for a full page, or use snippets.iframe where scripts are refused. Only the bubble is on by default: snippets.embed and snippets.iframe work once settings.embed is true, snippets.hosted once settings.hosted_page is true; a format that is off answers 404. Add the websites that show it to allowed_domains: the browser refuses the bubble and the embed on any site not listed. Visitors' answers are charged to this workspace in the widget's mode; limits caps them per visitor and per month. Costs no credits itself.
POST/v1/widgets
Requires assistants:write.
Creating a widget costs no credits. Each visitor question that reaches the model spends the widget’s mode price (flash by default, 30 credits), whether or not Lookio finds an answer. Say so to whoever sets it up, and set limits to cap the spending.
- Allowed domains. List the websites that show the widget in
allowed_domains, for exampledocs.acme.com.acme.comalso coverswww.acme.com, and*.acme.comcovers every subdomain. The browser refuses the bubble and the embed on any site not listed. With no domain, nothing shows on any site; only the hosted page works, once you turn it on. - Formats. Each format is on or off with a setting:
settings.bubble(on by default),settings.embed(off) andsettings.hosted_page(off). A new widget starts with the chat bubble only. A format that is off does not exist: the loader script draws no launcher, and the in-page frame and the hosted page answer 404.snippets.iframebelongs to the embed format. - Limits. By default a visitor may ask 20 questions per hour and 60 per day, and the widget may spend 3,000 credits per calendar month (UTC). Set
limits.monthly_creditstonullfor no ceiling beyond the workspace’s balance. See Access and limits. - Sources.
settings.sourcesisnumbered(the default),numbered_no_links,inline_linksornone. See Appearance. - Snippets. The response holds the code to install it:
snippets.bubblebefore</body>for a launcher,snippets.embedwhere the chat should sit,snippets.hostedfor a full page andsnippets.iframewhere scripts are refused. See Install a widget.
The widget is live as soon as it exists. Send an Idempotency-Key header so a retried request does not create two widgets.
Authorizations
Authorizationbearerin headerrequiredHeader parameters
Idempotency-Keystringlength: 1–255 charsA unique key for this request, such as a UUID, 1 to 255 visible ASCII characters. Send the same key when you retry: the first response is returned (with Idempotent-Replayed: true) instead of running the request again, for 24 hours, per credential. The same key on a different request is a 409 conflict. A streamed answer is not recorded.
Body
application/jsonrequiredassistant_idstringrequiredpattern: ^ast_[abcdefghjkmnpqrstuvwxyz23456789]{12}$The assistant the widget speaks for. A technical identity limited to some assistants can only pick one of them.
namestringlength: 1–120 chars1 to 120 characters. Defaults to the assistant's name followed by widget.
modeenum<string>one of: eco, flash, deepThe query mode every answer of this widget uses, so what it costs per answer (Eco 10, Flash 30 credits (the default), Deep 80). Default flash.
statusenum<string>one of: live, pausedlive answers visitors; paused shows nothing and answers nothing, until set live again.
allowed_domainsstring[]items: ≤ 50 itemsThe websites allowed to show the widget, as hosts (docs.acme.com) or *.acme.com for all subdomains (which also covers acme.com). Scheme, path and port are removed. The browser refuses to show the bubble and the embed on any other site, so a widget with no domain shows nowhere (the hosted page still works). Replaces the previous list.
settingsobjectAppearance, words and behaviour. Every field is optional and has a default.
limitsobjectSpending and abuse limits. Every field is optional and has a default.
Response
Create a widget
dataobjectrequiredrequest_idstringrequiredPossible codes: invalid_request, unknown_field, invalid_parameter, invalid_cursor
errorobjectrequiredrequest_idstringrequiredPossible codes: authentication_required, invalid_api_key, api_key_expired, api_key_revoked, invalid_access_key
errorobjectrequiredrequest_idstringrequiredPossible codes: insufficient_scope, feature_not_available, admin_required, permission_denied
errorobjectrequiredrequest_idstringrequiredPossible codes: resource_not_found
errorobjectrequiredrequest_idstringrequiredPossible codes: conflict, assistant_has_no_resources
errorobjectrequiredrequest_idstringrequiredPossible codes: request_too_large
errorobjectrequiredrequest_idstringrequiredPossible codes: rate_limited
errorobjectrequiredrequest_idstringrequiredPossible codes: internal_error
errorobjectrequiredrequest_idstringrequired