Skip to content
GitmoapAPIBeta
Agentsai-org
GET/ai-sessions/{session_id}/turns

A session's turns, with their tool calls and summarized reasoning.

list_ai_session_turns
  • ai_org:read
    A token needs the ai_org:read scope: Read an AI organization, its agents, sessions and usageGranted by read_api, write_api.Every operation this scope unlocks
  • Single-resource

    x-gitmoap-isolation: {"kind":"single_or_self_scoped"}

  • Paginated
    Pass the next_token a page returns to get the next one.

Readable only by someone who can read everything the session read from.

Parameters

Path
  • session_idAiSessionId (string · uuid)The session
Query
  • limitinteger · int64optionalMaximum number of turns, 1-100 (default 50)
  • next_tokenstringoptionalPagination token

Responses

200Turns, oldest firstapplication/json
  • itemsarray of AiTurn
    • The AiTurn schema
    • attemptinteger · int32
    • cost_microsinteger · int64The settled charge, fee included, in micro-dollars.
    • started_atstring · date-time
    • stateAiTurnStatereservedsentrespondedexecutingcompletedHow far a turn has got: its cost reserved, its request sent to the model, the model's response recorded, its tool calls running, or complete.
    • tool_callsarray of AiToolCall
      • The AiToolCall schema
      • call_nointeger · int32
      • stateAiToolCallStateplannedstartedcompletedgated
      • toolstring
      • duration_msinteger · int32 or nulloptional
      • outcomeAiToolOutcomeokerrorrefusedgatedhaltedor nulloptional
      • request_idstring or nulloptionalThe request id its audit records carry.
      • summarystring or nulloptional
      • targetobject or nulloptionalThe address acted on, as the tool named it.
    • turn_nointeger · int32
    • cache_read_tokensinteger · int32 or nulloptional
    • cache_write_tokensinteger · int32 or nulloptional
    • ended_atstring · date-time or nulloptional
    • input_tokensinteger · int32 or nulloptional
    • latency_msinteger · int32 or nulloptional
    • model_idstring or nulloptional
    • output_tokensinteger · int32 or nulloptional
    • providerstring or nulloptional
    • reasoning_summarystring or nulloptionalThe provider's summarized reasoning. Absent for a turn that was pure tool calls — the model's raw reasoning is never shown, because no provider returns it.
    • regionstring or nulloptional
    • stop_reasonAiStopReasonend_turntool_usemax_tokensrefusalpause_turnerroror nulloptional
  • next_tokenstring or nulloptional
200 exampleSynthesized example
{
"items": [
{
"attempt": 5,
"cost_micros": 84,
"started_at": "2026-10-13T22:01:09Z",
"state": "reserved",
"tool_calls": [],
"turn_no": 63
},
{
"attempt": 5,
"cost_micros": 11,
"started_at": "2026-10-10T12:59:54Z",
"state": "reserved",
"tool_calls": [],
"turn_no": 24
}
],
"next_token": "next-token-1c9d"
}
400Bad request — a path parameter is not a well-formed value of its typeapplication/json
Error codes
  • BAD_REQUESTThe request is malformed: a parameter or a body field is not a well-formed value of its type
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
400 exampleSynthesized example
{
"error": {
"code": "code-18a8",
"message": "Stream pipeline status into the run header"
}
}
401Unauthenticated — no credential, or an invalid oneapplication/json
Error codes
  • UNAUTHORIZEDNo credential was sent, or the one sent is invalid, expired or revoked
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
401 exampleSynthesized example
{
"error": {
"code": "code-853e",
"message": "Pin a page's payload to the build that rendered it"
}
}
403Forbidden — the caller's access level or token scope is insufficientapplication/json
Error codes
  • FORBIDDENYou are signed in but may not do this here; reason names the permission or the rule that refused it
  • INSUFFICIENT_SCOPEThe access token lacks the scope this operation needs; required_scope names it
  • PERMISSION_REQUIREDYou need a permission you do not hold here; the message names it
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
403 exampleSynthesized example
{
"error": {
"code": "code-cbdc",
"message": "Inline scalar newtypes but keep their brand"
}
}
404Not found — or found and private, which is masked as absentapplication/json
Error codes
  • NOT_FOUNDThe resource does not exist — or exists and you cannot see it: a private resource you have no access to answers exactly as an absent one does
  • errorErrorBody
    • The ErrorBody schema
    • codestringThe coarse category, tied to the status: NOT_FOUND, CONFLICT, INSUFFICIENT_SCOPE. Every error has one; the API reference's error catalogue lists them all.
    • messagestringWhat went wrong, for a person. Written to be read, not parsed: match on reason or code.
    • fieldstring or nulloptionalOn a 400 that refused one field's value, the field, as its JSON path: email, items[0].name. Put the message under that input. Absent on every other error.
    • reasonstring or nulloptionalThe specific code, when the error has one: LAST_ORGANIZATION_OWNER, BRANCH_PROTECTED. The message starts with it too. Match on this when it is present, and on code otherwise.
    • required_scopestring or nulloptionalThe scope the access token was missing, on INSUFFICIENT_SCOPE.
    • violationsanyoptionalPresent on the structured-validation errors (PROVIDER_VALIDATION_FAILED per-node, PIPELINE_VALIDATION_FAILED DAG): a JSON array of the offending elements, so a caller can fix every one in a single round-trip. Absent (omitted) on every other error.
404 exampleSynthesized example
{
"error": {
"code": "code-fde6",
"message": "Pin a page's payload to the build that rendered it"
}
}

CLI

gitmoap ai-org list-ai-session-turns

  • --session-ididThe session
  • --limitnumberoptionalMaximum number of turns, 1-100 (default 50)
  • --next-tokenstringoptionalPagination token