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

# session.turns.list()



## OpenAPI

````yaml /api-reference/openapi.json get /sessions/{id}/turns
openapi: 3.1.0
info:
  title: paddock API
  version: 1.0.0
  description: >-
    The paddock API. Send an API key, or a session token on its own session, as
    a bearer token.
servers:
  - url: https://api.paddock.build/v1
security:
  - bearer: []
paths:
  /sessions/{id}/turns:
    get:
      summary: session.turns.list()
      operationId: listTurns
      parameters:
        - $ref: '#/components/parameters/SessionId'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/Cursor'
      responses:
        '200':
          description: A page of turns
          headers:
            Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TurnPage'
        default:
          $ref: '#/components/responses/Error'
components:
  parameters:
    SessionId:
      name: id
      in: path
      required: true
      description: The session's ID
      schema:
        type: string
        pattern: ^ses_[0-7][0-9a-hjkmnp-tv-z]{25}$
    Limit:
      name: limit
      in: query
      required: false
      description: Page size
      schema:
        type: integer
        minimum: 1
        maximum: 200
        default: 50
    Cursor:
      name: cursor
      in: query
      required: false
      description: The nextCursor of the previous page
      schema:
        type: string
  headers:
    RequestId:
      description: The request's ID, for support and logs
      schema:
        type: string
  schemas:
    TurnPage:
      allOf:
        - $ref: '#/components/schemas/Page'
        - type: object
          properties:
            data:
              type: array
              items:
                $ref: '#/components/schemas/Turn'
    Page:
      description: >-
        Every resource list returns one page: a cursor-paged slice of items.
        Typed pages extend it.
      type: object
      required:
        - data
        - nextCursor
      properties:
        data:
          type: array
        nextCursor:
          type:
            - string
            - 'null'
    Turn:
      description: The projection of a turn's turn.started and turn.ended events.
      type: object
      required:
        - id
        - sessionId
        - status
        - origin
        - inputSeqs
        - attempt
        - error
        - retryAt
        - startedSeq
        - endedSeq
        - startedAt
        - endedAt
        - timing
      properties:
        id:
          type: string
          pattern: ^trn_[0-7][0-9a-hjkmnp-tv-z]{25}$
        sessionId:
          type: string
          pattern: ^ses_[0-7][0-9a-hjkmnp-tv-z]{25}$
        status:
          $ref: '#/components/schemas/TurnStatus'
        origin:
          $ref: '#/components/schemas/TurnOrigin'
        inputSeqs:
          description: >-
            The seqs of the user messages the turn consumed; empty for a harness
            turn.
          type: array
          items:
            $ref: '#/components/schemas/Seq'
        attempt:
          type: integer
          minimum: 1
        error:
          oneOf:
            - $ref: '#/components/schemas/TurnError'
            - type: 'null'
        retryAt:
          oneOf:
            - $ref: '#/components/schemas/Timestamp'
            - type: 'null'
        startedSeq:
          $ref: '#/components/schemas/Seq'
        endedSeq:
          oneOf:
            - $ref: '#/components/schemas/Seq'
            - type: 'null'
        startedAt:
          $ref: '#/components/schemas/Timestamp'
        endedAt:
          oneOf:
            - $ref: '#/components/schemas/Timestamp'
            - type: 'null'
        timing:
          description: >-
            Where the turn's time went; null while running and for a discarded
            turn.
          oneOf:
            - $ref: '#/components/schemas/TurnTiming'
            - type: 'null'
    ErrorBody:
      description: The body of every non-2xx response.
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
    TurnStatus:
      type: string
      enum:
        - running
        - completed
        - stopped
        - failed
        - discarded
    TurnOrigin:
      description: >-
        user: started over waiting messages; harness: started by the harness on
        its own, with no inputs, never retried.
      type: string
      enum:
        - user
        - harness
    Seq:
      description: A position in an agent's event log.
      type: integer
      minimum: 0
      maximum: 9007199254740991
    TurnError:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/TurnErrorCode'
        message:
          type: string
    Timestamp:
      description: RFC 3339 in UTC with milliseconds.
      type: string
      format: date-time
      pattern: ^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z$
      x-go-type: wire.Timestamp
      x-go-type-import:
        path: github.com/wenfengwang/paddock/internal/wire
    TurnTiming:
      description: >-
        Where a turn's time went, as phases on the turn's own timeline, in
        milliseconds.
      type: object
      required:
        - totalMs
        - phases
      properties:
        totalMs:
          description: The turn's start to its end.
          type: integer
          minimum: 0
        phases:
          description: In order of startMs.
          type: array
          items:
            $ref: '#/components/schemas/TimingPhase'
    ErrorObject:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
        details:
          type: object
    TurnErrorCode:
      type: string
      enum:
        - harness_error
        - watchdog_timeout
        - model_unavailable
        - model_auth
        - context_too_long
        - conversation_lost
        - sandbox_unavailable
        - internal
    TimingPhase:
      type: object
      required:
        - kind
        - startMs
        - durationMs
        - messageId
      properties:
        kind:
          $ref: '#/components/schemas/TimingPhaseKind'
        startMs:
          description: >-
            From the turn's start; negative for sandbox and daemon, which
            precede it.
          type: integer
        durationMs:
          description: null only for a tool call without a result when the turn ended.
          oneOf:
            - type: integer
              minimum: 0
            - type: 'null'
        messageId:
          description: >-
            reasoning, tool, and reply: the reasoning, tool_call, or assistant
            message.
          oneOf:
            - type: string
              pattern: ^msg_[0-7][0-9a-hjkmnp-tv-z]{25}$
            - type: 'null'
    ErrorCode:
      type: string
      enum:
        - invalid_request
        - unauthorized
        - forbidden
        - not_found
        - conflict
        - payload_too_large
        - unsupported
        - unavailable
        - internal
    TimingPhaseKind:
      type: string
      enum:
        - sandbox
        - daemon
        - harness
        - first_token
        - reasoning
        - tool
        - reply
  responses:
    Error:
      description: Every non-2xx response
      headers:
        Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: An API key, or a session token on its own session

````

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