Request reference

Fields, responses, and status codes for the session and chat endpoints.

Both endpoints are described narratively in Application endpoints; this page is the scannable reference for their exact fields and status codes.

Create a session

POST https://mcp-host.tuix.ch/stream/<ApplicationId>/session

Request body

FieldTypeRequiredDescription
userIdstringYesYour own identifier for this session. Not looked up anywhere.

Response — 201 Created

FieldTypeDescription
sessionIdstringIdentifies the session. Used in every subsequent chat call.
userIdstringEchoes the userId you sent.
sessionSecretstringRequired header value for every chat call on this session.
createdAtstringISO 8601 timestamp.
initialMessagestringThe application's configured Initial Message.

Status codes

StatusMeaning
201Session created.
400userId missing from the request body.
401Neither Authorization nor X-Api-Key was sent, or the API key is unknown.
404The API key is valid but doesn't belong to this application's account.

Send a chat message

POST https://mcp-host.tuix.ch/stream/<ApplicationId>/chat

Request body

FieldTypeRequiredDescription
sessionIdstringYesFrom the session endpoint's response.
messagestringYesThe user's message.

Headers

See Authentication for Authorization/X-Api-Key, and Session endpoint for x-session-secret.

Response — 200 OK, Content-Type: text/event-stream

A stream of typed events, see The response stream.

Status codes

StatusMeaning
200The stream has started. Errors that happen afterwards arrive as an error event inside the stream, not as an HTTP status.
400sessionId or message missing from the request body.
401Neither Authorization nor X-Api-Key was sent, or the API key is unknown.
404x-session-secret is missing or doesn't match the session, or sessionId doesn't exist or has expired. The same status covers all three, deliberately, so a request can't be used to probe for valid session IDs.

A 404 from the chat endpoint doesn't distinguish a wrong secret from an expired session, by design. If you see one, the safe recovery is always the same: call the session endpoint again and start a new session.

End a session early

Sessions expire on their own after 1 hour, but you can delete one before that:

DELETE https://mcp-host.tuix.ch/stream/<ApplicationId>/session/<sessionId>

Requires the same Authorization/X-Api-Key header as the other endpoints.

StatusMeaning
204Session deleted.
401Neither Authorization nor X-Api-Key was sent, or the API key is unknown.
404sessionId doesn't exist.

Error response shape

Every error, whether it's an authentication failure, a validation error, or a session that couldn't be found, comes back with the same shape:

{
    "message": "<description of what went wrong>"
}

Use the HTTP status code to branch on the kind of error, and message for a human-readable description.

On this page