# Messenger API

Read and update dimmi messenger appearance, launcher settings, identity verification rules, and signing secrets over the dimmi JSON REST API.

## Identity secrets

- `GET /identity-secrets` - List identity secrets: Lists the keys the customer's own server signs messenger identity tokens with, revoked ones included. Shows names, algorithms, fingerprints and status, never the secret values. Returns every identity secret with its algorithm, key id, fingerprint, status and when it was last used.
- `POST /identity-secrets` - Create an identity secret: Makes a new key for signing visitors' identity tokens. For HS256 dimmi generates the shared secret and returns it once, in this answer only: hand it to the person to store, never repeat it elsewhere. Returns the secret with, for HS256, its value and the environment variable names to keep it in.
- `POST /identity-secrets/{secret}/rotations` - Rotate an identity secret: Makes a new secret with the same name and algorithm and retires the old one after a grace period, so the customer's servers can switch without failed sign-ins. A new HS256 value is returned once. Returns the new secret with, for HS256, its value and the environment variable names to keep it in.
- `GET /identity-secrets/{secret}` - Get an identity secret: Reads one identity secret's details and status. The secret value itself is never shown again. Returns the secret's name, algorithm, key id, fingerprint, status and retirement or revocation dates.
- `PATCH /identity-secrets/{secret}` - Rename, retire or revoke an identity secret: Renames a secret, retires it so it keeps working until a date, or revokes it at once. Revoking is final and, unless revoke_sessions is false, signs out every visitor it verified. Returns the secret as it now is.

## Identity verification

- `GET /identity-verification/stats` - Get identity verification stats: Counts messenger sessions over recent days by outcome: verified, invalid token or anonymous. Use it to see whether sign-in works before relying on it. Returns the totals, the counts per day and the share of sessions that were verified.
- `GET /identity-verification/settings` - Get identity verification settings: Reads how strict the messenger is about who visitors are: off ignores tokens, optional (default) proves signed-in customers and lets others chat anonymously, required admits only proven customers. Returns the mode and the attributes the messenger may set from the page.

## Widget settings

- `GET /widget-settings` - List messengers: Lists the workspace's messengers, the chat widgets customers see on its sites, oldest first. Returns every messenger with its settings, inbox, audiences and when it last loaded on a site.
- `POST /widget-settings` - Create a messenger: Adds a messenger with its own inbox connection and any settings sent. It shows on a site only once its snippet is installed there. Returns the new messenger with its settings.
- `GET /widget-settings/{widget}` - Get a messenger: Reads one messenger's settings: look, texts, allowed sites, email collection, tabs, audiences. Returns the messenger with all its settings and its config version.
- `PATCH /widget-settings/{widget}` - Update a messenger: Changes what customers see and can do in a messenger on the sites it is installed on; live pages pick it up within a minute. Only the fields sent change. Returns the messenger as it now is.
- `PATCH /widget-settings/{widget}/audiences` - Set who sees a messenger: Sets audience rules for who sees the launcher, who may start a conversation and who sees the help and changelog tabs. A rule sent replaces that one, null removes it, one left out stays. Returns the messenger's rules as stored.
- `DELETE /widget-settings/{widget}` - Delete a messenger: Removes a messenger. Sites that embed it stop showing it. Returns nothing once it is removed.

---

Index of all dimmi docs: https://trydimmi.com/llms.txt (full text: https://trydimmi.com/llms-full.txt)
