Skip to content

Exchange a token for a session

POST
/v1/session
curl --request POST \
--url https://app.mondochat.io/v1/session \
--header 'Content-Type: application/json' \
--data '{ "app_id": "0199d6a0-0000-7000-8000-000000000001", "token": "example-client-token" }'

Trades a client token your server signed for a session token. This route is public: the token in the body is the proof. With no token and guests.enabled on, it creates a guest and returns a guest_token; with a stored guest token it resumes that guest. With a client token and a guest token of the same app, it merges the guest into the member while guests.merge_on_login is on.

Errors: 401 unauthorized for an expired token, a lifetime over 600 seconds, a wrong issuer, a guest token of another app, or a replayed jti; 403 banned; 403 forbidden while a test app already has 50 users, or when the tenant is suspended; 429 rate_limited above 300 exchanges per IP per minute.

Guide: Sessions and tokens.

Media typeapplication/json
SessionRequest

What to exchange for a session: a client token, a guest token, or neither for a new guest.

object
app_id
required
App Id

The app’s id.

string format: uuid
guest
Any of:
string
<= 8192 characters
token
Any of:
string
<= 8192 characters

Successful Response

Media typeapplication/json
Session

A session, with a guest token when the user is a guest.

object
app
required
FrameConfig

The app’s settings for this viewer.

object
branding
required
Branding

Colours, fonts, logo and launcher.

object
avatars
Avatars

Show the people’s pictures; off draws the initial on the primary colour.

boolean
default: true
background
Background

Background color.

string
default: #ffffff /^#[0-9a-fA-F]{6}$/
font_css_url
Any of:
string
<= 2048 characters /^https://\S+$/
font_family
Font Family

CSS font family.

string
default: system-ui, sans-serif >= 1 characters <= 200 characters
heading_font_family
Any of:
string
>= 1 characters <= 200 characters
inbox_close_chip
Inbox Close Chip

The inbox close button is a 30px tinted chip.

boolean
inbox_tint
Inbox Tint

Tint the inbox background on every layout, not only two-pane.

boolean
launcher
Launcher

Launcher bubble.

object
enabled
Enabled

Show the launcher bubble.

boolean
default: true
inline_close_desktop
Inline Close Desktop

Show the inbox close button on the inline page on a screen with a mouse.

boolean
default: true
plain
Plain

Flat bubble colour, and Arial in the unread badge and the toast.

boolean
position
Position

Launcher corner.

string
default: right
Allowed values: right left
logo_url
Any of:
string
<= 2048 characters /^https://\S+$/
on_primary
On Primary

Text on the primary color.

string
default: #ffffff /^#[0-9a-fA-F]{6}$/
primary
Primary

Primary color.

string
default: #2f6fed /^#[0-9a-fA-F]{6}$/
radius_px
Radius Px

Corner radius in pixels.

integer
default: 12 <= 32
surface
Surface

Surface color.

string
default: #f4f5f7 /^#[0-9a-fA-F]{6}$/
text
Text

Text color.

string
default: #111318 /^#[0-9a-fA-F]{6}$/
calls
required
FrameCalls

Call settings, without prices unless per-minute is on.

object
area
Area

Agora area code, e.g. EUROPE.

string
default: GLOBAL /^[A-Z_]{2,32}$/
codec
Codec

Agora video codec.

string
default: vp8
Allowed values: vp8 vp9 h264 av1
confirm_start
Confirm Start

Ask before starting a call.

boolean
dock
Dock

Every call takes the whole window, the chat button docks the call as a strip or a side rail beside the thread, and a minimise button shrinks it to a bubble.

boolean
enabled
Enabled

Video calls enabled.

boolean
max_duration_minutes
Max Duration Minutes

Calls end after this.

integer
default: 240 >= 1 <= 1440
offline_note
Offline Note

After calling an offline peer, note in the thread that they may not answer.

boolean
per_minute
Any of:
PerMinute

Per-minute charging of calls through the call_minute callout.

object
currency
Currency

ISO 4217 currency.

string
default: EUR /^[A-Z]{3}$/
enabled
Enabled

Charge calls per minute.

boolean
payer_role
Any of:
string
/^[A-Za-z0-9_-]{1,32}$/
preauthorize_minutes
Preauthorize Minutes

Minutes charged when both have joined.

integer
default: 1 >= 1 <= 60
price_minor
Price Minor

Price per minute in minor units.

integer
0
ring_timeout_seconds
Ring Timeout Seconds

Ring time before missed.

integer
default: 45 >= 10 <= 600
ring_when_closed
Ring When Closed

An incoming call opens the chat and rings while it is closed; off shows the toast and sound, and the ring when the chat opens.

boolean
default: true
show_locked
Show Locked

Show buyers a locked call button with a tip when they cannot call a seller.

boolean
single_card
Single Card

One card per call that reads Call ended when it is over, and a busy callee closes the caller’s call screen instead of showing an error.

boolean
video
Video

Camera capture settings.

object
fps
Fps

Capture frame rate.

integer
default: 30 >= 1 <= 60
height
Height

Capture height in pixels.

integer
default: 720 >= 120 <= 2160
width
Width

Capture width in pixels.

integer
default: 1280 >= 160 <= 3840
warn_if_offline
Warn If Offline

Warn before calling an offline peer.

boolean
default: true
chat
required
Chat

Message, photo, video and voice rules.

object
avatar_upload
Avatar Upload

Users may upload their own picture; it shows only after photo moderation approves it, and it wins over the host’s avatar.

boolean
consent_allow_last
Consent Allow Last

The photo consent prompt puts Don’t allow before Allow; off puts Allow first.

boolean
earlier_on_scroll
Earlier On Scroll

Older messages load when the thread scrolls to its top; off shows a Load earlier button.

boolean
edit_window_seconds
Edit Window Seconds

Senders may edit a text message this long after sending; 0 turns edits off.

integer
default: 172800 <= 31536000
photo_max_bytes
Photo Max Bytes

Maximum photo upload size in bytes.

integer
default: 20000000 >= 1 <= 50000000
photos
Photos

Photo messages enabled.

boolean
default: true
refuse_blocked_send
Refuse Blocked Send

A message to someone who blocked the sender is refused (403 forbidden, reason undelivered) and not stored; off accepts it and drops it silently.

boolean
short_day_labels
Short Day Labels

Day separators read day and month only; off adds the weekday, and the year for earlier years.

boolean
text_max_length
Text Max Length

Maximum message length.

integer
default: 4000 >= 1 <= 10000
unsend_window_seconds
Unsend Window Seconds

Senders may delete a message for everyone this long after sending; 0 turns it off. Deleting for oneself is always allowed.

integer
default: 172800 <= 31536000
video_max_bytes
Video Max Bytes

Maximum video size in bytes; the browser converts to fit.

integer
default: 104857600 >= 1000000 <= 209715200
video_max_seconds
Video Max Seconds

Maximum video length in seconds.

integer
default: 900 >= 1 <= 3600
videos
Videos

Video messages enabled.

boolean
default: true
view_once
View Once

Senders may mark a photo, video or voice note view once.

boolean
default: true
voice
Voice

Voice notes enabled.

boolean
default: true
voice_max_bytes
Voice Max Bytes

Maximum voice note size in bytes.

integer
default: 10485760 >= 100000 <= 52428800
voice_max_seconds
Voice Max Seconds

Maximum voice note length in seconds.

integer
default: 900 >= 1 <= 3600
commerce
required
CommerceFlags

Commerce modes and flags only.

object
catalog_source
Catalog Source

Catalog from the catalog callout or the dashboard.

string
default: webhook
Allowed values: webhook dashboard
custom_amount
CustomAmount

An amount the buyer types, in the catalog currency.

object
enabled
Enabled

Buyers may type an amount, such as a tip.

boolean
max_minor
Max Minor

Largest amount in minor units.

integer
default: 100000 >= 1
min_minor
Min Minor

Smallest amount in minor units.

integer
default: 100 >= 1
enabled
Enabled

Selling in conversations enabled.

boolean
payment_mode
Payment Mode

How purchases are paid.

string
default: server_charge
Allowed values: server_charge page_callback checkout_url
payment_window
Payment Window

Where checkout and top-up pages open.

string
default: popup
Allowed values: popup same_tab
show_balance
Show Balance

Show the balance the catalog callout returns.

boolean
trim_whole_prices
Trim Whole Prices

A euro price on a purchase card reads 5 € or 5.50 €, never grouped.

boolean
guests
required
FrameGuests

Guest nudge and notify prompt for the viewer.

object
notify_prompt
required
Notify Prompt

Show the notify prompt to this viewer.

boolean
notify_prompt_signup
required
Notify Prompt Signup

The prompt’s button opens the sign-up.

boolean
notify_prompt_sticky
required
Notify Prompt Sticky

Keep the prompt until done.

boolean
nudge
required
Nudge

The create-account nudge; enabled only where it applies to the viewer.

object
enabled
Enabled

Show guests a create-account nudge, and members whose role is guests.role when that is not default_role.

boolean
default: true
login_url
Any of:
string
<= 2048 characters /^https://\S+$/
signup_url
Any of:
string
<= 2048 characters /^https://\S+$/
i18n
required
I18n

Languages and copy overrides.

object
copy
Copy

Text overrides per language and message key.

object
key
additional properties
object
key
additional properties
string
default_lang
Default Lang

Language when nothing else decides.

string
default: en
Allowed values: it en es fr
languages
Languages

Languages offered.

Array<string>
default: en >= 1 items
Allowed values: it en es fr
limits
required
Limits

The limits that apply to the viewer.

object
messages_per_minute
Any of:
integer
>= 1
messages_to_unanswered
Any of:
integer
new_conversations_per_day
Any of:
integer
photos_per_day
Any of:
integer
voice_per_day
Any of:
integer
links
required
Links

Links to your site.

object
open_conversation_url_template
Any of:
string
<= 2048 characters /^https://\S+$/
profile_sellers_only
Profile Sellers Only

The conversation header opens the profile of sellers only.

boolean
profile_url_template
Any of:
string
<= 2048 characters /^https://\S+$/
services_menu
Services Menu

With services_page, buyers also get a Services menu item.

boolean
default: true
services_page
Services Page

Buyers can open the seller’s services page from a conversation.

boolean
services_url_template
Any of:
string
<= 2048 characters /^https://\S+$/
support_email
Any of:
string
<= 254 characters /^[^@\s]+@[^@\s]+\.[^@\s]+$/
notifications
required
FrameNotifications

Sound, banner and toast behaviour.

object
banner
required
Banner

Show a banner on new messages.

boolean
banner_throttle
required
Banner Throttle

At most one banner per 5 seconds.

boolean
sound
required
Sound

Play a sound on new messages.

boolean
toast_opens
required
Toast Opens

Clicking the launcher toast opens its conversation, or only the panel.

string
Allowed values: conversation panel
onboarding
required
FrameOnboarding

Onboarding for the viewer’s role.

object
enabled
required
Enabled

Whether onboarding slides are on.

boolean
reshow_hours
required
Reshow Hours

Show the slides again after this many hours.

integer
slides
required
Slides

The slides for the viewer’s role.

Array<object>
Slide

One onboarding slide.

object
art
Any of:
string
Allowed values: composer call_button incoming_call mail
body
Body

Body per language.

object
key
additional properties
string
bullets
Bullets

Icon bullets.

Array<object>
default: <= 4 items
Bullet

An icon bullet on an onboarding slide.

object
body
Body

Body per language.

object
key
additional properties
string
icon
required
Icon

Bullet icon.

string
Allowed values: card shield mail lock coin
signup
Signup

Link text per language that opens guests.nudge.signup_url.

object
key
additional properties
string
title
Title

Title per language.

object
key
additional properties
string
image_url
Any of:
string
<= 2048 characters /^https://\S+$/
quote
Quote

Highlighted note per language.

object
key
additional properties
string
title
Title

Title per language.

object
key
additional properties
string
origins
required
Origins

The origins allowed to embed the chat.

Array<string>
policy
required
Policy

The viewer’s resolved policy per role.

object
key
additional properties
PolicyFlags

What a role may do toward another role.

object
block
Block

May block the peer.

boolean
default: true
buy
Buy

May buy from the peer.

boolean
call
Call

May start calls.

boolean
message
Message

May send messages.

boolean
default: true
offers
Offers

May send ad hoc offer cards.

boolean
photo_consent_required
Photo Consent Required

The receiver must accept photos per conversation.

boolean
photos
Photos

May send photos.

boolean
default: true
require_vouch
Require Vouch

Starting needs a vouch token or the session’s peer.

boolean
see_presence
See Presence

May see the peer’s presence.

boolean
default: true
start_conversation
Start Conversation

May start a conversation.

boolean
default: true
presence
required
Presence

Online status settings.

object
enabled
Enabled

Presence enabled.

boolean
default: true
fanout
Fanout

Also push presence changes to each peer’s own channel. Turn off once every client subscribes with presence_pass.

boolean
default: true
in_inbox
In Inbox

Show the online dot and last seen in inbox rows.

boolean
default: true
show_last_seen
Show Last Seen

Show “last seen” times.

boolean
default: true
pwa
Any of:
FramePwa

What the installed app needs to subscribe to push.

object
icon_url
required
Icon Url

Https URL of the installed app’s icon.

string
name
required
Name

The installed app’s name.

string
push_key
required
Push Key

The VAPID public key, uncompressed P-256, base64url.

string
roles
required
Roles

The app’s roles.

Array<object>
Role

A user role. Roles are referenced by policy, limits, guests and the role claim.

object
key
required
Key

Role key, the value of the role claim.

string
/^[A-Za-z0-9_-]{1,32}$/
label
Label

Display name per language.

object
key
additional properties
string
seller
Seller

Users with this role sell services.

boolean
safety
required
Safety

Blocking and reporting settings.

object
ban_close_button
Ban Close Button

The banned panel has its own Close button.

boolean
default: true
report_reasons
Report Reasons

A report asks for a reason; off is a plain confirm.

boolean
default: true
workspace
required
Workspace

Inbound is true only where the app has guests; queue, notes and tiers as set.

object
aliases
Aliases

Users may give peers a private name.

boolean
away_reply
Away Reply

Sellers may set a reply sent for them, once a day per chat, while away.

boolean
inbound
Inbound

Members may take messages from members only.

boolean
notes
Notes

Users may keep a private note on a peer.

boolean
pins
Pins

Users may pin up to 10 conversations.

boolean
queue
Queue

Inbox views, archive, search, spent and purchases, and the sign-up invite.

boolean
quick_replies
Quick Replies

Sellers keep up to 20 saved replies and send one with a tap.

boolean
reply_time
Reply Time

Conversations with a seller carry her typical reply time.

boolean
tiers
Tiers

Client tiers, lowest first; users get one by key.

Array<object>
default: <= 10 items
Tier

A client tier a user can hold.

object
color
required
Color

Badge color.

string
/^#[0-9a-fA-F]{6}$/
key
required
Key

Tier key, the value of a user’s tier.

string
/^[A-Za-z0-9_-]{1,32}$/
label
Label

Display name per language.

object
key
additional properties
string
expires_at
required
Expires At

When the session token expires.

string format: date-time
guest_token
Any of:
string
realtime
required
Realtime

The realtime address for this user.

object
channel
required
Channel

The user’s own channel, /users/{user id}.

string
http_host
required
Http Host

Host of the realtime HTTP endpoint.

string
ws_url
required
Ws Url

WebSocket URL of the realtime endpoint.

string
session_token
required
Session Token

Bearer token for the user routes; valid 15 minutes.

string
user
required
Me

The signed-in user.

object
app_prompt_done
App Prompt Done

True once the user dismissed Get the app or has had a device.

boolean
avatar
Any of:
string
avatar_review
Any of:
string
Allowed values: pending rejected
external_id
required
External Id

The user’s id on your site, the sub claim.

string
id
required
Id

The user’s id in mondochat.

string format: uuid
inbound
Inbound

Members: guests may not message this user.

string
default: everyone
Allowed values: everyone members
kind
required
Kind

member for a user your server signed in, guest for an anonymous one.

string
Allowed values: member guest
lang
Any of:
string
last_seen
required
Last Seen

Nobody hides this user’s last seen from everyone and everyone’s from them.

string
Allowed values: everyone nobody
name
required
Name

Display name.

string
notify_prompt_done
required
Notify Prompt Done

True once the viewer tapped or dismissed the notify prompt.

boolean
onboarding_done
required
Onboarding Done

False while the onboarding slides are due, and again onboarding.repeat_hours after they were shown when that is set.

boolean
onboarding_shown_at
Any of:
string format: date-time
read_receipts
required
Read Receipts

False: this user neither sends nor sees read ticks in any conversation.

boolean
role
required
Role

A role key from the app’s roles.

string

Example

{
"app": {
"branding": {
"primary": "#2f6fed"
},
"calls": {
"enabled": false
},
"chat": {
"text_max_length": 4000
},
"commerce": {
"enabled": false
},
"guests": {
"notify_prompt": false,
"notify_prompt_signup": false,
"notify_prompt_sticky": false,
"nudge": {
"enabled": false
}
},
"i18n": {
"default_lang": "en",
"languages": [
"en"
]
},
"limits": {
"messages_per_minute": 30
},
"links": {
"support_email": "help@example.test"
},
"notifications": {
"banner": true,
"banner_throttle": true,
"sound": true,
"toast_opens": "conversation"
},
"onboarding": {
"enabled": false,
"reshow_hours": 24,
"slides": []
},
"origins": [
"https://example.test"
],
"policy": {
"member": {
"call": false,
"message": true
}
},
"presence": {
"enabled": true
},
"roles": [
{
"key": "member",
"label": {
"en": "Member"
},
"seller": false
}
],
"safety": {
"report_reasons": true
},
"workspace": {
"queue": false
}
},
"expires_at": "2026-11-01T12:15:00Z",
"realtime": {
"channel": "/users/0199d6a0-1000-7000-8000-000000000001",
"http_host": "example.appsync-api.eu-west-1.amazonaws.com",
"ws_url": "wss://example.appsync-realtime-api.eu-west-1.amazonaws.com/event/realtime"
},
"session_token": "example-session-token",
"user": {
"app_prompt_done": false,
"avatar": "https://example.test/alice.jpg",
"external_id": "alice",
"id": "0199d6a0-1000-7000-8000-000000000001",
"inbound": "everyone",
"kind": "member",
"lang": "en",
"last_seen": "everyone",
"name": "Alice",
"notify_prompt_done": false,
"onboarding_done": true,
"onboarding_shown_at": "2026-11-01T09:00:00Z",
"read_receipts": true,
"role": "member"
}
}

Problem

Media typeapplication/problem+json

An RFC 9457 problem: the body of every error answer.

object
code
required

The stable error code to branch on, such as policy_denied.

string
detail

What went wrong this time, when there is more to say.

string | null
errors

For validation, one entry per invalid field.

Array<object>

One invalid field.

object
loc

The path to the field.

array
msg

What is wrong with it.

string
instance

The path of the request.

string
reason

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.

string
status
required

The HTTP status code.

integer
title
required

A short summary of the problem.

string
type
required

A URL that names the problem, https://app.mondochat.io/problems/<code>.

string

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"
}