Sessions
Get a session
A session and its entries, oldest first, numbered within the session (seq); after gives the entries after that number, 500 at a time.
/repos/{owner}/{name}/sessions/{id}With them: children, its subagents and theirs in the order they started (each names its parent_id); touched, the files, commits, branches, pull requests and issues it and they touched; links, the issues and pull requests they worked on and how each was tied (via: attached, claim, branch, commit, trailer, opened or ref); skills, the skills they used by name; and for a subagent, root, the session at the top of its tree. Anyone who can read the repository may.
Entries are numbered within the session and come 500 at a time; send the last seq you have as after for the next page. children are the session’s subagents and theirs; touched, links and skills cover the whole tree.
- Authentication: Optional. Public data can be read without a token; send one to see what is private.
- MCP tool:
sessionwithactionget, and the same inputs - Scope: An access token needs
pull_requests:read.
Path parameters
Section titled “Path parameters”| Name | Type | Required | Description |
|---|---|---|---|
owner |
string | Yes | The workspace that owns the repository. |
name |
string | Yes | The repository’s name. |
id |
string | Yes | The session’s id (ses_…), from start_session or list_sessions. |
Query parameters
Section titled “Query parameters”| Name | Type | Required | Description |
|---|---|---|---|
after |
integer | No | Only entries after this sequence number, for the next page. |
Example request
Section titled “Example request”curl "https://api.g1t.sh/repos/flagon-io/hello/sessions/id?after=0" \ -H "Authorization: Bearer $G1T_TOKEN"Example response
Section titled “Example response”A successful request answers 200 with:
{ "session": { "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 }, "entries": [ { "seq": 1, "kind": "prompt", "text": "Make the greeting name the caller (issue #12).", "tool": null, "commit": null, "at": "2026-10-12T14:02:12.008Z" }, { "seq": 2, "kind": "tool_call", "text": "cargo test", "tool": "Bash", "commit": "9f2c4e1a7b3d5f60812a4c6e8b0d2f4a6c8e0b13", "at": "2026-10-12T14:30:12.660Z" } ], "children": [ { "id": "ses_01m4b2d8x1y2z3a4b5c6d7e8f9", "repo_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr", "issue": 12, "pull": null, "branch": "greet-caller", "actor": { "id": "usr_01kkntcg1eeb98j62xjm7eh09p", "username": "syntaqx" }, "harness": "claude_code", "harness_session_id": "5b0c1f9e-3d2a-4e8b-9f61-0c7d2a9e4b13/agent/a4d2c8f1e0b3a297", "title": null, "state": "ended", "head_commit": null, "started_at": "2026-10-12T14:05:40.112Z", "last_seen_at": "2026-10-12T14:07:02.930Z", "ended_at": "2026-10-12T14:07:02.930Z", "end_reason": "done", "parent_id": "ses_01m4b2c3d4e5f6g7h8j9k0m1n2", "agent_type": "Explore", "task": "Find where the greeting is built", "prompt": "Find every place the greeting text is built and say which file to change.", "result": "The greeting is built in src/greet.rs (greet) and nowhere else.", "model": "claude-sonnet-5-5", "subagents": 0 } ], "touched": [ { "session_id": "ses_01m4b2c3d4e5f6g7h8j9k0m1n2", "kind": "file", "value": "src/greet.rs", "at": "2026-10-12T14:12:30.004Z" }, { "session_id": "ses_01m4b2c3d4e5f6g7h8j9k0m1n2", "kind": "branch", "value": "greet-caller", "at": "2026-10-12T14:30:40.871Z" } ], "links": [ { "kind": "pull", "number": 14, "title": "Name the caller in the greeting", "state": "open", "via": [ "attached", "branch" ], "session_ids": [ "ses_01m4b2c3d4e5f6g7h8j9k0m1n2" ] }, { "kind": "issue", "number": 12, "title": "Make the greeting name the caller", "state": "open", "via": [ "attached", "claim" ], "session_ids": [ "ses_01m4b2c3d4e5f6g7h8j9k0m1n2", "ses_01m4b2d8x1y2z3a4b5c6d7e8f9" ] } ], "skills": [ { "session_id": "ses_01m4b2c3d4e5f6g7h8j9k0m1n2", "name": "work-on-issue", "uses": 1 } ], "root": null}Errors
Section titled “Errors”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. |