The widget contact API provides endpoints underDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jAtInn71/chatwoot-costom/llms.txt
Use this file to discover all available pages before exploring further.
/api/v1/widget/contact for managing the visitor’s contact record during a widget session. These endpoints handle everything from reading the current contact’s profile to updating identity details and removing custom attributes.
All endpoints in this group are called by the widget SDK. Unless you are building a custom integration, you will typically interact with this layer indirectly through the widget JavaScript API (for example, $chatwoot.setUser(...)) rather than calling these endpoints directly.
Authentication
Every endpoint requireswebsite_token as a query parameter to identify the inbox. In addition, contact endpoints use a contact auth token sent as a request header. The token is issued by the server on first contact creation, stored in session storage by the widget, and cleared on chat exit.
Contact auth token flow
The widget uses a session-scoped token to associate subsequent requests with the same contact record:- First visit — no token exists in session storage. The widget calls the contact creation endpoint to register a new contact and receives an auth token in the response.
- Subsequent requests — the token is read from session storage and sent as a header on every contact and conversation API call. This ties all activity during the session to the same contact.
- Chat exit (soft exit) — when a visitor ends the chat, the widget calls
clearCurrentUser()which clears the auth token from session storage and removes it from the default request headers. The next visitor who opens the widget starts with no token and receives a fresh contact, keeping sessions isolated.
The
website_token is captured once at module load time from the original iframe URL, before any window.history.replaceState() calls that strip session parameters during exit. This ensures contact API calls are never broken by URL mutations.Show current contact
Update contact
- When the visitor submits the pre-chat form (name, email, phone number)
- When your application calls
$chatwoot.setCustomAttributes(...)to attach metadata to the contact
Set user identity
$chatwoot.setUser(identifier, { name, email, ... }).
The identifier is a unique string from your application (typically a user ID). When HMAC identity verification is enabled on the inbox, you must also pass a hmac_token computed server-side from the identifier and the inbox’s HMAC secret.
Request body: