v2
OpenAPI 3.0.02026-08-051996591.2 MBCreate session via alias
Creates a session by routing through an alias. The alias's policy selects the underlying agent that owns the session. Subsequent operations on the session can use this alias or the direct path /v2/agents/{resolved_agent_key}/sessions/{session_key}.
Path parameters
The unique key that identifies an alias. Alias keys are independent of agent keys. The same string can exist as both an alias key and an agent key in the same customer account. Calls to /v2/agent_aliases/{key}/... target the alias. Calls to /v2/agents/{key}/... target the agent.
The alias whose routing policy decides which agent owns the session.
Headers
The platform makes a best effort to complete the request in the specified seconds, or it times out.
The platform makes a best effort to complete the request in the specified milliseconds, or it times out.
Request body
Example request
{
"key": "customer_support_chat",
"name": "Customer Support Session",
"description": "Helping customer troubleshoot issues",
"metadata": {
"customer_id": "12345",
"priority": "medium",
"channel": "web_chat"
},
"enabled": true,
"tti_minutes": 60,
"secrets": {
"slack_user_token": "xoxp-your-token-here"
}
}Response
The newly created session, owned by the agent the alias's policy resolved to.
Example response
{
"key": "customer_support_chat",
"agent_key": "customer_support",
"name": "Customer Support Session",
"description": "Helping customer troubleshoot widget installation issues",
"metadata": {
"customer_id": "12345",
"priority": "high",
"channel": "web_chat"
},
"current_step_name": "billing",
"enabled": true,
"status": "stopped",
"created_by_agent_key": "customer_support",
"created_by_session_key": "customer_support_chat",
"tti_minutes": 60,
"created_at": "2024-01-15T10:30:00Z",
"session_context_usage": {
"input_tokens": {
"count": 120,
"cached_tokens": 100
},
"output_tokens": {
"count": 30
},
"total_tokens": 150,
"model_context_window": 200000
},
"effective_compaction": {
"enabled": true,
"threshold_percent": 80,
"keep_recent_inputs": 1
},
"alias_key": "support",
"secrets": {
"slack_user_token": "****"
}
}