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

# Search turns

> The kept tier, newest first, by conversation, agent, time and flags; the conversation id travels in the body.



## OpenAPI

````yaml openapi/en/cell.json POST /v1/turns/search
openapi: 3.1.0
info:
  title: Niadra data API
  version: '1'
  description: >-
    Writing, context, history, objects, identity, privacy and governance of one
    space. Every space has a stable address, with the space and the region in
    its name.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: The space, which comes in the source key.
      region:
        default: us-east-2
        description: The region of the space, which also comes in the key.
security: []
paths:
  /v1/turns/search:
    post:
      tags:
        - turns
      summary: Search turns
      description: >-
        The kept tier, newest first, by conversation, agent, time and flags.


        **Authentication.** Source key with the `replay` scope, or a Console
        person token with the `integration`, `security` role (or admin). It
        answers only in a space with the `turns` feature on (the `features`
        document); in a space without it, 404.
      operationId: search_turns_v1_turns_search_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TurnSearchRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TurnSearchResponse'
          description: Successful Response
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request does not match the contract.
      security:
        - sourceKey: []
        - personToken: []
components:
  schemas:
    TurnSearchRequest:
      additionalProperties: false
      description: >-
        A search over the kept tier. The conversation id travels in the body,
        never in the URL.
      properties:
        agent:
          anyOf:
            - maxLength: 256
              minLength: 1
              type: string
            - type: 'null'
          title: Agent
        conversation_id:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          title: Conversation Id
        cursor:
          anyOf:
            - maxLength: 200
              type: string
            - type: 'null'
          title: Cursor
        flags:
          items:
            enum:
              - error
              - guard_acted
              - guard_budget_exceeded
              - handoff
              - assertion_failed
              - synthetic
              - incomplete
              - negative_feedback
              - truncated
            type: string
          maxItems: 20
          title: Flags
          type: array
        limit:
          default: 50
          maximum: 200
          minimum: 1
          title: Limit
          type: integer
        since:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Since
        until:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Until
      title: TurnSearchRequest
      type: object
    TurnSearchResponse:
      additionalProperties: false
      properties:
        items:
          items:
            $ref: '#/components/schemas/TurnSummary'
          title: Items
          type: array
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Cursor
      required:
        - items
      title: TurnSearchResponse
      type: object
    Problem:
      additionalProperties: false
      description: RFC 9457 problem details; `code` comes from the versioned error catalog.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    TurnSummary:
      additionalProperties: false
      properties:
        agent:
          maxLength: 256
          minLength: 1
          title: Agent
          type: string
        completeness:
          enum:
            - complete
            - partial
            - incomplete
            - unknown
          title: Completeness
          type: string
        fidelity:
          enum:
            - bronze
            - silver
            - gold
          title: Fidelity
          type: string
        flags:
          items:
            enum:
              - error
              - guard_acted
              - guard_budget_exceeded
              - handoff
              - assertion_failed
              - synthetic
              - incomplete
              - negative_feedback
              - truncated
            type: string
          title: Flags
          type: array
        kind:
          enum:
            - message
            - action
            - event
            - timer
          title: Kind
          type: string
        replayable:
          title: Replayable
          type: boolean
        started_at:
          format: date-time
          title: Started At
          type: string
        tier:
          enum:
            - short
            - kept
          title: Tier
          type: string
        turn_id:
          pattern: ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$
          title: Turn Id
          type: string
      required:
        - turn_id
        - agent
        - kind
        - started_at
        - tier
        - fidelity
        - completeness
        - replayable
      title: TurnSummary
      type: object
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````