POST /api/v1/chat/session
Creates a new support chat session, or returns an existing active session. Optionally sends an initial message when creating the session. Sessions are identified by a cookie or user ID.
Authentication​
Optional. Authenticated users are linked to their account. Anonymous users are tracked via session cookie.
Request​
No request body is required. The session is identified by a chat_session_id cookie. If a valid cookie exists and the session is found in the DB, the existing session is returned. Otherwise a new session is created and a chat_session_id cookie is set (HttpOnly, 1 year expiry).
Example​
curl -X POST https://intotes.com/api/v1/chat/session
Response​
200 OK​
{
"session_id": "a1b2c3d4e5f6"
}
The session_id is a random string identifier. A Set-Cookie: chat_session_id=... header is included for new sessions.
Errors​
| Status | Code | Description |
|---|---|---|
| 400 | bad_request | Invalid request body |
| 500 | internal_error | Server failed to create session |