Start a session for the caller (engineer or above) and issue its session token
POST
/v1/projects/{project_id}/sessions
const url = 'http://127.0.0.1:8080/v1/projects/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/sessions';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://127.0.0.1:8080/v1/projects/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/sessions \ --header 'Authorization: Bearer <token>'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”project_id
required
string format: uuid
Responses
Section titled “Responses”The session and its token. The token is shown only in this response.
Media typeapplication/json
object
session
required
object
id
required
string format: uuid
project_id
required
string format: uuid
user_id
required
string format: uuid
user_handle
required
string
intent_id
required
Set from M2.
string | null format: uuid
status
required
string
activity
required
What the agent last said it is doing, set by a heartbeat. Null until one sets it.
string | null
created_at
required
string format: date-time
last_heartbeat_at
required
string format: date-time
ended_at
required
string | null format: date-time
token
required
The session token, zt_s_. Shown only once.
string
token_info
required
object
id
required
string format: uuid
kind
required
string
display_prefix
required
The first characters of the token, safe to show.
string
label
required
string
user_id
string format: uuid
session_id
string format: uuid
project_id
string format: uuid
scopes
required
Array<string>
created_at
required
string format: date-time
expires_at
string format: date-time
last_used_at
string format: date-time
revoked_at
string format: date-time
Example
{ "session": { "status": "starting" }, "token_info": { "kind": "user" }}The request is malformed.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
Example generated
{ "error": { "code": "example", "message": "example" }}No valid bearer token.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
Example generated
{ "error": { "code": "example", "message": "example" }}The token may not do this.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
Example generated
{ "error": { "code": "example", "message": "example" }}No such resource in the caller’s org.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
Example generated
{ "error": { "code": "example", "message": "example" }}A rate limit or quota stopped the request. Retry-After gives seconds to wait.
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
Example generated
{ "error": { "code": "example", "message": "example" }}Headers
Section titled “Headers”Retry-After
integer