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

# Promover turnos

> Move turnos da camada curta para a guardada, por conversa ou por id, com o motivo: a reclamação chega dias depois do turno.



## OpenAPI

````yaml openapi/pt/cell.json POST /v1/turns/promote
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/promote:
    post:
      tags:
        - turns
      summary: Promover turnos
      description: >-
        Promover é idempotente por si: um turno promovido de novo conta como
        `already_kept`.


        **Autenticação.** Chave de fonte: `Authorization: Bearer nia_sk_...`.
        Escopo exigido: `track`. Só responde num espaço com a funcionalidade
        `turns` ligada (o documento `features`); num espaço sem ela, 404.
      operationId: promote_turns_v1_turns_promote_post
      parameters:
        - in: header
          name: Idempotency-Key
          required: true
          schema:
            maxLength: 256
            minLength: 1
            title: Idempotency-Key
            type: string
          description: >-
            Obrigatório. Guardado por 24 horas com o hash do corpo: a mesma
            chave com o mesmo corpo devolve a primeira resposta, e a mesma chave
            com outro corpo devolve 409 `conflict`.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PromoteRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PromoteResponse'
          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: []
      x-codeSamples:
        - lang: python
          label: Python
          source: >-
            from niadra.models.turns import PromoteRequest


            # A complaint arrives days later: keep the conversation's turns for
            the kept tier's retention

            niadra.api.promote_turns(PromoteRequest(conversation_id="wa-8812",
            reason="complaint"))
        - lang: typescript
          label: TypeScript
          source: >-
            // A complaint arrives days later: keep the conversation's turns for
            the kept tier's retention

            await niadra.api.promoteTurns({ conversation_id: "wa-8812", reason:
            "complaint" });
components:
  schemas:
    PromoteRequest:
      additionalProperties: false
      description: >-
        Move turnos da camada curta (todo turno, 7 dias) para a guardada, por
        conversa ou por id, com o motivo: a reclamação chega dias depois do
        turno.
      properties:
        conversation_id:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          title: Conversation Id
        reason:
          enum:
            - complaint
            - bug_report
            - review
            - other
          title: Reason
          type: string
        turn_ids:
          items:
            pattern: ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$
            type: string
          maxItems: 500
          title: Turn Ids
          type: array
      required:
        - reason
      title: PromoteRequest
      type: object
    PromoteResponse:
      additionalProperties: false
      properties:
        already_kept:
          title: Already Kept
          type: integer
        not_found:
          description: Turnos que já não estão na camada curta, ou nunca foram gravados.
          title: Not Found
          type: integer
        promoted:
          title: Promoted
          type: integer
      required:
        - promoted
        - already_kept
        - not_found
      title: PromoteResponse
      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
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...

````