Create a chat session
Starts a conversation of the organization and its author. spaceId is its origin space — the space selected when it is created, which must be one of the spaces the conversation can act in (the reachable spaces where the caller holds chat:write, chat:read and mcp:read together; else a 400 naming the field) — and it is touched by definition, so the conversation is listed in that space before anything else. restricted: true limits it to that space and needs spaceId (else a 400 naming the field). Ignores X-Space-Id; admitted when the acting set is not empty. A credential confined to spaces (pinned to one, or carrying a space allowlist, such as the bearer of a chat turn) is refused (403).
/api/orgs/{orgId}/chat/sessionsCookie session from Better Auth. Requires X-Org-Id header for org-scoped routes.
In: cookie
Path Parameters
Organization ID.
Request Body
application/json
curl -X POST "https://your-instance/api/orgs/string/chat/sessions" \ -H "Content-Type: application/json" \ -d '{}'{
"object": "chat_session",
"id": "string",
"title": "string",
"generating": true,
"unread": true,
"skill_discovery": true,
"pins": [
{
"id": "string",
"status": "injected",
"chars": 0
}
],
"spaceId": "string",
"restricted": true,
"space_ids": [
"string"
],
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}{
"type": "https://docs.appstrate.dev/errors/validation-failed",
"title": "Validation Failed",
"status": 400,
"detail": "name: Invalid input: expected string, received undefined (+2 more)",
"code": "validation_failed",
"request_id": "req_abc123",
"errors": [
{
"field": "name",
"code": "required",
"message": "Invalid input: expected string, received undefined"
},
{
"field": "email",
"code": "invalid_format",
"message": "Invalid email address"
},
{
"field": "age",
"code": "invalid_type",
"message": "Invalid input: expected number, received string"
}
]
}{
"type": "https://docs.appstrate.dev/errors/forbidden",
"title": "Forbidden",
"status": 403,
"detail": "Insufficient permissions",
"code": "forbidden",
"request_id": "req_abc123"
}{
"type": "https://docs.appstrate.dev/errors/rate-limited",
"title": "Rate Limited",
"status": 429,
"detail": "Too many requests. Please try again shortly.",
"code": "rate_limited",
"request_id": "req_abc123",
"retry_after": 30
}