Moonborn — API · chat
Start a chat session bound to (persona, user, workspace)
POST/v1/personas/{id}/chat/sessionsscope · Bearer (API key or session JWT)
Path parameters
| Field | Type | Description |
|---|---|---|
| idreq | string | Persona id (e.g. `psn_*`). |
Request body
| Field | Type | Description |
|---|---|---|
| personaIdreq | string | |
| title | string |
Responses
201Session created
Body
| Field | Type | Description |
|---|---|---|
| sessionreq | object | |
| session.sessionIdreq | string | |
| session.orgIdreq | string | |
| session.workspaceIdreq | string | |
| session.personaIdreq | string | |
| session.userIdreq | string | |
| session.titlereq | string | |
| session.statusreq | string · "active" | "ended" | "archived" | |
| session.messageCountreq | number | |
| session.inputTokensreq | number | |
| session.outputTokensreq | number | |
| session.costUsdMicrosreq | number | |
| session.startedAtreq | string | |
| session.lastActiveAtreq | string | |
| session.endedAtreq | string |
401Unauthenticated
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
404Persona not found
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
422Validation error
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
Examples
cURL
curl -X POST https://api.moonborn.co/v1/personas/<id>/chat/sessions \
-H "Authorization: Bearer $MOONBORN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"personaId": "<string>"
}'TypeScript
import Moonborn from '@moonborn/sdk';
const client = new Moonborn({ apiKey: process.env.MOONBORN_API_KEY });
const result = await client.chat.startChatSession({
id: '<id>',
personaId: "<string>",
});Python
import os
from moonborn import Moonborn
client = Moonborn(api_key=os.environ["MOONBORN_API_KEY"])
result = client.chat.start_chat_session(
id="<id>",
persona_id="<string>",
)