> ## 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.

# Buscar turnos

> A camada guardada, do mais novo para o mais antigo, por conversa, agente, período e marcas; o id da conversa vai no corpo.



## OpenAPI

````yaml openapi/pt/cell.json POST /v1/turns/search
openapi: 3.1.0
info:
  title: API de dados da Niadra
  version: '1'
  description: >-
    Escrita, contexto, histórico, objetos, identidade, privacidade e governança
    de um espaço. Cada espaço tem um endereço estável, com o espaço e a região
    no nome.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: O espaço, que vem na chave de fonte.
      region:
        default: us-east-2
        description: A região do espaço, que também vem na chave.
security: []
paths:
  /v1/turns/search:
    post:
      tags:
        - turns
      summary: Buscar turnos
      description: >-
        A camada guardada, do mais novo para o mais antigo, por conversa,
        agente, período e marcas.


        **Autenticação.** Chave de fonte com o escopo `replay`, ou token de
        pessoa do Console com o papel `integration`, `security` (ou admin). Só
        responde num espaço com a funcionalidade `turns` ligada (o documento
        `features`); num espaço sem ela, 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: Resposta de sucesso.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: O pedido não bate com o contrato.
      security:
        - sourceKey: []
        - personToken: []
components:
  schemas:
    TurnSearchRequest:
      additionalProperties: false
      description: >-
        Uma busca na camada guardada. O id da conversa viaja no corpo, nunca na
        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: >-
        Detalhes do problema no formato da RFC 9457; `code` vem do catálogo de
        erros versionado.
      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

````