Skip to content

Sessions

A repository's sessions, most recently heard from first, up to 100: state active (heard from in the last 15 minutes), idle or ended; issue or pull for those on one, attached or tied to it any other way; path for those that touched a file (or any under a folder ending in /).

GET/repos/{owner}/{name}/sessions

Subagents are left out unless subagents is true, which lists each tree whole. Each says how many subagents it started. Anyone who can read the repository may.

  • Authentication: Optional. Public data can be read without a token; send one to see what is private.
  • MCP tool: session with action list, and the same inputs
  • Scope: An access token needs pull_requests:read.
Name Type Required Description
owner string Yes The workspace that owns the repository.
name string Yes The repository’s name.
Name Type Required Description
state string No Only sessions in this state. One of active, idle, ended.
issue integer No Only sessions on this issue: attached, or tied to it any other way.
pull integer No Only sessions on this pull request: attached, or tied to it any other way.
path string No Only sessions that touched this file, or any under it when it ends in /.
subagents boolean No List subagents too, each tree whole. Left out, only the sessions at the top.
curl "https://api.g1t.sh/repos/flagon-io/hello/sessions?state=active&issue=12" \
-H "Authorization: Bearer $G1T_TOKEN"

A successful request answers 200 with:

[
{
"id": "ses_01m4b2c3d4e5f6g7h8j9k0m1n2",
"repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr",
"issue": 12,
"pull": 14,
"branch": "greet-caller",
"actor": {
"id": "usr_01kkntcg1eeb98j62xjm7eh09p",
"username": "syntaqx"
},
"harness": "claude_code",
"harness_session_id": "5b0c1f9e-3d2a-4e8b-9f61-0c7d2a9e4b13",
"title": "Make the greeting name the caller",
"state": "active",
"head_commit": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13",
"started_at": "2026-10-12T14:02:11.204Z",
"last_seen_at": "2026-10-12T14:31:40.518Z",
"ended_at": null,
"end_reason": null
}
]

A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.

Status Code When
401 unauthenticated A token is required, or the one sent is not valid.
403 forbidden The token is valid but not allowed to do this, such as a member-only change, or a token without the scope it needs.
404 not_found It does not exist, or you cannot see it.
422 invalid The input is not valid. message says which field and why.