Create a session from your server
const url = 'https://app.mondochat.io/v1/server/sessions';const options = { method: 'POST', headers: { 'Mondochat-App-Id': '<Mondochat-App-Id>', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"avatar":"https://example.test/alice.jpg","external_id":"alice","name":"Alice"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://app.mondochat.io/v1/server/sessions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Mondochat-App-Id: <Mondochat-App-Id>' \ --data '{ "avatar": "https://example.test/alice.jpg", "external_id": "alice", "name": "Alice" }'Creates or updates the user with the profile you send and returns a session token for them, so a client without the embed can call the user routes. Server route: send the server secret as a bearer token with Mondochat-App-Id. tier must be a key of workspace.tiers; null clears it and leaving it out keeps the stored one.
Errors: 422 validation for an unknown role or tier or a reserved external id; 403 forbidden while a test app already has 50 users.
Guide: Sessions and tokens.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”The user to sign in from your server, with their profile.
object
The user’s id on your site.
Display name.
Per-user overrides carried in the perms claim; a null field changes nothing.
object
Responses
Section titled “Responses”Successful Response
A session token minted from your server, with the user.
object
When the session token expires.
Bearer token for the user routes; valid 15 minutes.
The user the token is for.
object
The user’s id on your site, the sub claim.
The user’s id in mondochat.
member for a user your server signed in, guest for an anonymous one.
Display name.
A role key from the app’s roles.
Example
{ "expires_at": "2026-11-01T12:15:00Z", "session_token": "example-session-token", "user": { "avatar": "https://example.test/alice.jpg", "external_id": "alice", "id": "0199d6a0-1000-7000-8000-000000000001", "kind": "member", "name": "Alice", "role": "member" }}Problem
An RFC 9457 problem: the body of every error answer.
object
The stable error code to branch on, such as policy_denied.
What went wrong this time, when there is more to say.
For validation, one entry per invalid field.
One invalid field.
object
The path to the field.
What is wrong with it.
The path of the request.
For policy_denied and limit_reached, the rule or limit that refused the request; for forbidden, a short cause such as you_blocked; for banned, temporary when the ban expires.
The HTTP status code.
A short summary of the problem.
A URL that names the problem, https://app.mondochat.io/problems/<code>.
Example
{ "code": "policy_denied", "detail": null, "instance": "/v1/conversations/0199d6a0-2000-7000-8000-000000000001", "reason": "pins", "status": 403, "title": "Policy denied", "type": "https://app.mondochat.io/problems/policy_denied"}