> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xenovia.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get session turns

> **Auth:** organization API key (`read` scope or higher) or a signed-in user.

Turns `from` to `to` of a session with their steps, at most 50 per call, for a long session whose detail returns only a window of turns. Set `whole=true` to get every step of a long request rather than only its ends.



## OpenAPI

````yaml https://cp.xenovia.io/openapi.json get /api/v1/sessions/{session_id}/turns
openapi: 3.1.0
info:
  title: Xenovia Control Plane API
  version: 1.0.0
  description: >-
    Management API for agents, providers, policies, telemetry, alerts and
    organization settings.
servers:
  - url: https://cp.xenovia.io
    description: Production
security:
  - BearerAuth: []
paths:
  /api/v1/sessions/{session_id}/turns:
    get:
      tags:
        - sessions
      summary: Get session turns
      description: >-
        **Auth:** organization API key (`read` scope or higher) or a signed-in
        user.


        Turns `from` to `to` of a session with their steps, at most 50 per call,
        for a long session whose detail returns only a window of turns. Set
        `whole=true` to get every step of a long request rather than only its
        ends.
      operationId: get_session_turns_route_api_v1_sessions__session_id__turns_get
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            title: Session Id
        - name: from
          in: query
          required: true
          schema:
            type: integer
            minimum: 0
            title: From
        - name: to
          in: query
          required: true
          schema:
            type: integer
            minimum: 0
            title: To
        - name: whole
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Whole
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SessionTurn'
                title: >-
                  Response Get Session Turns Route Api V1 Sessions  Session Id 
                  Turns Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    SessionTurn:
      properties:
        id:
          type: string
          title: Id
        index:
          type: integer
          title: Index
        status:
          $ref: '#/components/schemas/SessionStatus'
        started_at:
          type: string
          format: date-time
          title: Started At
        ended_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ended At
        agent:
          anyOf:
            - $ref: '#/components/schemas/AgentRef'
            - type: 'null'
        flows:
          items:
            $ref: '#/components/schemas/SessionFlow'
          type: array
          title: Flows
        steps:
          items:
            $ref: '#/components/schemas/SessionStep'
          type: array
          title: Steps
        step_count:
          type: integer
          title: Step Count
          default: 0
        steps_loaded:
          type: boolean
          title: Steps Loaded
          default: true
        steps_omitted:
          type: integer
          title: Steps Omitted
          default: 0
      type: object
      required:
        - id
        - index
        - status
        - started_at
      title: SessionTurn
      description: >-
        One agent's turn. The runtime numbers turns per session, so when

        several agents share a session (an orchestrator's X-Xenovia-Session-Id)

        their requests can share a turn number; each agent's requests under that

        number are a turn of their own, and the id then names the agent

        (``{session_id}:{index}:{agent_id}``; ``{session_id}:{index}``
        otherwise).

        A turn's tool-result continuations are further requests of it: ``flows``

        says who made each.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SessionStatus:
      type: string
      enum:
        - allowed
        - blocked
        - escalated
        - error
        - running
        - incomplete
      title: SessionStatus
    AgentRef:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        deleted:
          type: boolean
          title: Deleted
          default: false
        unknown:
          type: boolean
          title: Unknown
          default: false
      type: object
      required:
        - id
        - name
      title: AgentRef
      description: |-
        An agent named on a telemetry read: the agent a turn ran on, or the
        agent that called it. A deleted agent keeps its name (its row stays) and
        says it is deleted; an id that names no agent of the organisation reads
        its id as the name and says it is unknown (there is no agent to open).
    SessionFlow:
      properties:
        trace_id:
          type: string
          title: Trace Id
        sub_agent:
          anyOf:
            - type: string
            - type: 'null'
          title: Sub Agent
        caller_agent:
          anyOf:
            - $ref: '#/components/schemas/AgentRef'
            - type: 'null'
        caller_sub_agent:
          anyOf:
            - type: string
            - type: 'null'
          title: Caller Sub Agent
        workflow_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Workflow Id
        agent_depth:
          type: integer
          title: Agent Depth
          default: 0
      type: object
      required:
        - trace_id
      title: SessionFlow
      description: >-
        Who made requests of a turn: the inline sub-agent and, on a linked

        call, the calling agent and its inline sub-agent, with the requests'

        trace id. One entry per distinct identity under a trace id, read from

        each row's own identity, so two identities are never merged. The trace
        id

        is not unique among a turn's flows: with a session id and no trace flow

        id the runtime names every request under a turn number

        ``{session_id}:{turn}``, and two requests with the same identity there

        read as one flow (docs/sub-agents.md).
    SessionStep:
      properties:
        id:
          type: string
          title: Id
        kind:
          $ref: '#/components/schemas/SessionStepKind'
        name:
          type: string
          title: Name
        status:
          $ref: '#/components/schemas/SessionStatus'
        started_at:
          type: string
          format: date-time
          title: Started At
        ended_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ended At
        duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ms
        parent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Id
        attributes:
          additionalProperties: true
          type: object
          title: Attributes
      type: object
      required:
        - id
        - kind
        - name
        - status
        - started_at
      title: SessionStep
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    SessionStepKind:
      type: string
      enum:
        - received
        - intent
        - policy
        - llm
        - tool
        - retrieval
        - embedding
        - guardrail
        - finished
        - escalation
        - other
      title: SessionStepKind
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token: an organization API key (`ak_…`) created under Settings →
        API Keys, or a dashboard user session token. Agent keys (`xe_…`) are not
        accepted here. Endpoints marked as user-only in their description reject
        organization keys with `403`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.