Pular para o conteúdo principal
POST
Create session

Autorizações

X-API-Key
string
header
obrigatório

Parâmetros de caminho

agent_id
string
obrigatório

Corpo

application/json
user
SessionUser · object | null

End-user of a session, addressed by id or by reference.

id is lookup-only: it never writes, so name/email/phone sent with it are ignored. reference is an upsert key: unknown references are created, known ones are merged with the display fields provided here — fields left out keep their stored value.

Defined here (rather than in a surface's schemas.py) because both the agent and the public/widget surfaces expose the very same field and must validate it identically. Re-exported by api/v1/external/agent/schemas.py for backwards compatibility.

context
Context · object | null

Free-form key/value pairs injected into the agent's system context for this session. Use for plan tier, language, channel, etc.

metadata
Metadata · object | null

Free-form storage for the integrator. Saved with the session and returned on read. Not seen by the agent.

Resposta

Successful Response

id
string
obrigatório
agent_id
string
obrigatório
status
enum<string>
obrigatório
Opções disponíveis:
active,
closed,
expired
created_at
string<date-time>
obrigatório
updated_at
string<date-time>
obrigatório
user
UserSummary · object | null
messages_count
integer
padrão:0
last_message_at
string<date-time> | null
closed_at
string<date-time> | null
context
Context · object | null
metadata
Metadata · object | null