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

# Corrigir a memória

> Retirar ou corrigir um fato, resolver uma pendência ou registrar o desfecho de uma conversa.



## OpenAPI

````yaml openapi/pt/cell.json POST /v1/feedback
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-1
        description: A região do espaço, que também vem na chave.
security: []
paths:
  /v1/feedback:
    post:
      tags:
        - ingest
      summary: Corrigir a memória
      description: >-
        Retira ou corrige um fato, resolve uma pendência ou registra o desfecho
        de uma conversa. Cada ação pede os próprios campos, senão a resposta é
        422: `retract_fact` pede `fact_id`, `correct_fact` pede `fact_id` e
        `value`, `resolve_open_item` pede `open_item_id`, e
        `conversation_outcome` pede `conversation_id` e `value`. Toda correção
        vira um evento, e a memória derivada é recalculada a partir dele.


        **Autenticação.** Chave de fonte: `Authorization: Bearer nia_sk_...`.
        Escopo exigido: `track`.
      operationId: feedback_v1_feedback_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FeedbackRequest'
            example:
              idempotency_key: fb-2026-09-22-0001
              subject:
                type: phone_e164
                value: '+14155550123'
              action: resolve_open_item
              open_item_id: oi_01J8ZK
              reason: Visit rescheduled and confirmed by the customer
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchResponse'
              example:
                accepted: 1
                duplicates: 0
                errors: []
          description: >-
            A correção foi gravada como evento, informada como resultado de
            lote.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: >-
            422 `invalid_input`, `verification_not_allowed` ou
            `about_without_link`.
      security:
        - sourceKey: []
      x-codeSamples:
        - lang: python
          label: Python
          source: |-
            niadra.feedback(
                "resolve_open_item",
                phone("+14155550123"),
                open_item_id="oi_01J8ZK",
                reason="Visit rescheduled and confirmed by the customer",
            )
        - lang: typescript
          label: TypeScript
          source: |-
            await niadra.feedback({
              action: "resolve_open_item",
              subject: handles.phone("+14155550123"),
              open_item_id: "oi_01J8ZK",
              reason: "Visit rescheduled and confirmed by the customer",
            });
components:
  schemas:
    FeedbackRequest:
      additionalProperties: false
      description: 'Correções viram eventos: a memória nunca edita o passado no lugar.'
      properties:
        action:
          enum:
            - retract_fact
            - correct_fact
            - resolve_open_item
            - conversation_outcome
          title: Action
          type: string
        conversation_id:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          title: Conversation Id
        fact_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Fact Id
        idempotency_key:
          maxLength: 512
          minLength: 1
          title: Idempotency Key
          type: string
        open_item_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Open Item Id
        reason:
          anyOf:
            - maxLength: 500
              type: string
            - type: 'null'
          title: Reason
        subject:
          $ref: '#/components/schemas/Handle'
        value:
          anyOf:
            - maxLength: 2000
              type: string
            - type: 'null'
          title: Value
      required:
        - idempotency_key
        - subject
        - action
      title: FeedbackRequest
      type: object
    BatchResponse:
      additionalProperties: false
      properties:
        accepted:
          title: Accepted
          type: integer
        duplicates:
          title: Duplicates
          type: integer
          description: Itens cuja chave de idempotência já estava gravada.
        errors:
          items:
            $ref: '#/components/schemas/ItemError'
          title: Errors
          type: array
      required:
        - accepted
        - duplicates
        - errors
      title: BatchResponse
      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
    Handle:
      additionalProperties: false
      description: >-
        Um identificador de um sujeito num canal ou sistema: um telefone, um
        e-mail, um id do CRM.
      properties:
        scope:
          anyOf:
            - maxLength: 256
              minLength: 1
              type: string
            - type: 'null'
          description: >-
            Espaço de nomes dos identificadores com escopo: a conta do WhatsApp
            Business para `wa_bsuid`, o sistema para `system_id`, o país para
            `gov_id_hmac`.
          title: Scope
        subject_kind:
          anyOf:
            - $ref: '#/components/schemas/SubjectKind'
            - type: 'null'
          description: >-
            O padrão é `person`, exceto nos tipos de handle que só identificam
            organizações.
        type:
          $ref: '#/components/schemas/HandleType'
        value:
          maxLength: 320
          minLength: 1
          title: Value
          type: string
          description: >-
            O identificador. Normalizado no servidor: E.164 para telefone,
            minúsculas para e-mail.
      required:
        - type
        - value
      title: Handle
      type: object
    ItemError:
      additionalProperties: false
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
        index:
          title: Index
          type: integer
          description: A posição do item em `items`.
      required:
        - index
        - code
      title: ItemError
      type: object
    SubjectKind:
      enum:
        - person
        - account
        - partner
      title: SubjectKind
      type: string
      description: >-
        Uma pessoa, uma organização cliente (`account`) ou uma organização que
        participa sem ser cliente (`partner`).
    HandleType:
      enum:
        - phone_e164
        - wa_id
        - wa_jid
        - wa_lid
        - wa_bsuid
        - email
        - gov_id_hmac
        - app_user_id
        - system_id
        - org_registry_hmac
        - email_domain
        - anon_id
      title: HandleType
      type: string
      description: >-
        O tipo de identificador. O valor é classificado pelo formato, nunca pelo
        campo de onde veio.
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...

````