Create a ban
const url = 'https://app.mondochat.io/v1/server/bans';const options = { method: 'POST', headers: { 'Mondochat-App-Id': '<Mondochat-App-Id>', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"expires_at":"2026-12-01T00:00:00Z","external_id":"alice","reason":"Spam"}'};
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/bans \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Mondochat-App-Id: <Mondochat-App-Id>' \ --data '{ "expires_at": "2026-12-01T00:00:00Z", "external_id": "alice", "reason": "Spam" }'Bans one of your users by external_id, or an IPv4 or IPv6 range by cidr; give one of them. A ban may expire. Takes the app id and the server secret, and an Idempotency-Key header. A banned user is refused with 403 banned at session exchange and refresh, conversation open, message send, call start, call token and upload; the problem carries reason temporary when the ban expires. A banned user is sent session.revoked. Bans are cached for 60 seconds. Sends the ban.created webhook. See https://docs.mondochat.io/guides/safety/.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “Responses”Successful Response
A ban on a user or an address range.
object
When the ban was made.
The ban’s id.
Why the ban was made.
Example
{ "created_at": "2026-11-01T09:30:00Z", "expires_at": "2026-12-01T00:00:00Z", "external_id": "alice", "id": "0199d6a0-6000-7000-8000-000000000001", "reason": "Spam", "user_id": "0199d6a0-1000-7000-8000-000000000001"}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"}