Skip to content
OpenCode
Esc
navigateopen⌘Jpreview

List sessions

Retrieve sessions in the requested order. Items keep that order across pages; use cursor.next or cursor.previous to move through the ordered list.

GET/api/session
Query parameters
workspaceobject | any
limitstring | any
orderstring | any
searchstring | any
parentIDobject | string | any
directorystring | any
projectstring | any
subpathstring | any
cursorstring | any
Responses
200SessionsResponse
dataSession.Info[]required
Show properties
Array of Session.Info
idobjectrequired
Show properties
object
parentIDobject
Show properties
object
forkobject
Show properties
sessionIDobjectrequired
Show properties
object
messageIDobject
Show properties
object
projectIDstringrequired
agentstring
modelModel.Ref
Show properties
idstringrequired
providerIDstringrequired
variantstring
costMoney.USDrequired
tokensTokenUsage.Inforequired
Show properties
inputnumberrequired
outputnumberrequired
reasoningnumberrequired
cacheobjectrequired
Show properties
readnumberrequired
writenumberrequired
timeobjectrequired
Show properties
creatednumberrequired
updatednumberrequired
archivednumber
titlestringrequired
locationLocation.Refrequired
Show properties
directorystringrequired
workspaceIDobject
Show properties
object
subpathstring
revertSession.Revert
Show properties
messageIDobjectrequired
Show properties
object
partIDstring
snapshotstring
filesFileDiff.Info[]
Show properties
Array of FileDiff.Info
filestringrequired
patchstringrequired
additionsobjectrequired
Show properties
object
deletionsobjectrequired
Show properties
object
statusstringrequired
Allowed:addeddeletedmodified
cursorobjectrequired
Show properties
previousstring | any
Show properties
Any of:
string
string
any
any
nextstring | any
Show properties
Any of:
string
string
any
any
400InvalidCursorError | InvalidRequestError
Any of:
InvalidCursorError
_tagstringrequired
Allowed:InvalidCursorError
messagestringrequired
InvalidRequestError1
_tagstringrequired
Allowed:InvalidRequestError
messagestringrequired
kindstring | any
Show properties
Any of:
string
string
any
any
fieldstring | any
Show properties
Any of:
string
string
any
any
InvalidRequestError
_tagstringrequired
Allowed:InvalidRequestError
messagestringrequired
kindstring | any
Show properties
Any of:
string
string
any
any
fieldstring | any
Show properties
Any of:
string
string
any
any
401UnauthorizedError
_tagstringrequired
Allowed:UnauthorizedError
messagestringrequired
Request
curl -X GET "/api/session"
Response
{
  "data": [
    {
      "id": {},
      "parentID": {},
      "fork": {
        "sessionID": {},
        "messageID": {}
      },
      "projectID": "string",
      "agent": "string",
      "model": {
        "id": "string",
        "providerID": "string",
        "variant": "string"
      },
      "cost": 0,
      "tokens": {
        "input": 0,
        "output": 0,
        "reasoning": 0,
        "cache": {
          "read": 0,
          "write": 0
        }
      },
      "time": {
        "created": 0,
        "updated": 0,
        "archived": 0
      },
      "title": "string",
      "location": {
        "directory": "string",
        "workspaceID": {}
      },
      "subpath": "string",
      "revert": {
        "messageID": {},
        "partID": "string",
        "snapshot": "string",
        "files": [
          {
            "file": "string",
            "patch": "string",
            "additions": {},
            "deletions": {},
            "status": "added"
          }
        ]
      }
    }
  ],
  "cursor": {
    "previous": "string",
    "next": "string"
  }
}