Skip to content

Create a guest from your server

POST
/v1/server/guests
curl --request POST \
--url https://app.mondochat.io/v1/server/guests \
--header 'Authorization: Bearer <token>' \
--header 'Mondochat-App-Id: <Mondochat-App-Id>'

Creates a guest user and returns its guest token and the user. Send the guest token to POST /v1/session to sign in. Server route: send the server secret as a bearer token with Mondochat-App-Id.

Errors: 403 forbidden with reason guests_disabled while guests.enabled is off.

Guide: Sessions and tokens.

Successful Response

Media typeapplication/json
ServerGuest

A new guest minted from your server.

object
guest_token
required
Guest Token

Send it to POST /v1/session as token to sign in.

string
user
required
User

The guest user.

object
avatar
Any of:
string
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
kind
required
Kind

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

string
Allowed values: member guest
name
required
Name

Display name.

string
role
required
Role

A role key from the app’s roles.

string

Example

{
"guest_token": "example-guest-token",
"user": {
"avatar": "https://example.test/alice.jpg",
"external_id": "alice",
"id": "0199d6a0-1000-7000-8000-000000000001",
"kind": "guest",
"name": "Guest 4f2a9c",
"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"
}