Mark the caller offline
const url = 'https://app.mondochat.io/v1/presence/offline';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"hidden_ms":31000,"session_token":"example-session-token"}'};
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/presence/offline \ --header 'Content-Type: application/json' \ --data '{ "hidden_ms": 31000, "session_token": "example-session-token" }'Marks the caller offline when the page closes or has been hidden. It is public because a browser beacon cannot set headers: the session token travels in the body. hidden_ms is how long the page has been hidden, clamped to 0 to 60000, and last_seen_at becomes now minus it. Nothing happens while presence.enabled is off.
Errors: 401 unauthorized for an invalid session token.
Guide: Presence.
Request Bodyrequired
Section titled “Request Bodyrequired”The offline beacon: the session token and how long the page has been hidden.
object
How long the page has been hidden; clamped to 0 to 60000.
The caller’s session token.
Responses
Section titled “Responses”Successful Response
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"}