Skip to main content
POST
/
api
/
v1
/
sessions
Create sessions
curl --request POST \
  --url https://api.agenhq.com/api/v1/sessions \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "branch_name": "<string>",
  "auto_commit": false,
  "model": "<string>"
}
'
{
  "id": "<string>",
  "title": "<string>",
  "workspace_id": "<string>",
  "user_id": "<string>",
  "branch_name": "<string>",
  "auto_commit": false,
  "status": "<string>",
  "origin": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "sandbox_id": "<string>",
  "model": "<string>",
  "agent_status": "<string>",
  "merged_at": "<string>",
  "deep_work_id": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.agenhq.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

x-api-key
string
header
required

Body

application/json
branch_name
string | null
required

The git branch Agen should use for this session.

auto_commit
boolean
default:false

Whether Agen should automatically create git commits while working in the session.

model
string

The LLM model code to use for the session, if you want to override the workspace default.

Response

Default Response

id
string
required

The unique identifier of the session inside Agen.

title
string
required

A short title generated from the initial prompt that helps identify the session.

workspace_id
string
required

The workspace that owns this session.

user_id
string
required

The user who created the session.

branch_name
string | null
required

The git branch Agen should use for this session.

auto_commit
boolean
default:false
required

Whether Agen should automatically create git commits while working in the session.

status
string
required

The current lifecycle status of the session.

origin
string
required

Where the session was created from, such as the app, API, or a deep work flow.

created_at
string<date-time>
required

When the session was created.

updated_at
string<date-time>
required

When the session was last updated.

sandbox_id
string | null

The sandbox currently assigned to this session.

model
string

The LLM model code to use for the session, if you want to override the workspace default.

agent_status
string

The current execution status of the coding agent inside the session.

merged_at
string | null

When the session changes were merged, if the related merge request has been merged.

deep_work_id
string | null

The related deep work item ID, if this session was created from a deep work flow.