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

# Apagar

> Apaga um perfil, handle ou conversa por linhagem e emite o comprovante de apagamento.



## OpenAPI

````yaml openapi/pt/cell.json POST /v1/forget
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/forget:
    post:
      tags:
        - governance
      summary: Apagar
      description: >-
        Apaga um perfil, um handle ou uma conversa por linhagem: o conteúdo dos
        eventos, os fatos que ficaram sem evidência, episódios, pendências,
        objetos cujo dono é o handle, o conteúdo pessoal das ações, padrões,
        vínculos, linhas da medição, amostras de revisão, payloads de disparo,
        contextos e arquivos, e as lápides para a exportação contínua. Apagar
        uma pessoa nunca apaga a conta a que ela está ligada. O apagamento roda
        em segundo plano; acompanhe por `GET /v1/forget/{request_id}`. Ao
        terminar, a resposta traz o hash do comprovante de apagamento e as
        execuções de exportação que já continham o dado, e o webhook
        `erasure.completed` é disparado.


        **Autenticação.** Token de pessoa do Console com o papel `security` (ou
        admin), ou chave de fonte com o escopo `admin`.
      operationId: forget_v1_forget_post
      parameters:
        - in: header
          name: Idempotency-Key
          required: true
          schema:
            maxLength: 256
            minLength: 1
            title: Idempotency-Key
            type: string
          description: >-
            Obrigatório. Fica guardado 24 horas com o hash do corpo; a mesma
            chave com outro corpo devolve 409.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ForgetRequest'
            example:
              target: handle
              handle:
                type: phone_e164
                value: '+14155550123'
        required: true
      responses:
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErasureOut'
              example:
                request_id: 0192f7b0-4c11-7e2a-9d30-1a2b3c4d5e6f
                target_kind: handle
                target_id: 0192f7a0-9f01-7a22-8b33-4c5d6e7f8091
                status: pending
                requested_at: '2026-09-22T18:00:00Z'
                completed_at: null
                erased: {}
                export_run_ids: []
                receipt_hash: null
          description: >-
            Aceito. O apagamento entra na fila; `status` vai de `pending` para
            `running` e `completed`.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: >-
            422 `invalid_input`, `verification_not_allowed` ou
            `about_without_link`.
      security:
        - sourceKey: []
        - personToken: []
components:
  schemas:
    ForgetRequest:
      additionalProperties: false
      description: Passe exatamente um entre `profile_id`, `handle` e `conversation_id`.
      properties:
        conversation_id:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          title: Conversation Id
        handle:
          anyOf:
            - $ref: '#/components/schemas/Handle'
            - type: 'null'
        profile_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          title: Profile Id
        target:
          enum:
            - profile
            - handle
            - conversation
          title: Target
          type: string
      required:
        - target
      title: ForgetRequest
      type: object
    ErasureOut:
      additionalProperties: false
      properties:
        completed_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Completed At
        erased:
          additionalProperties:
            type: integer
          description: Linhas apagadas por tabela.
          title: Erased
          type: object
        export_run_ids:
          description: Execuções da exportação contínua que já levavam linhas apagadas.
          items:
            type: string
          title: Export Run Ids
          type: array
        receipt_hash:
          anyOf:
            - type: string
            - type: 'null'
          description: SHA-256, em hexadecimal, do comprovante de apagamento.
          title: Receipt Hash
        request_id:
          title: Request Id
          type: string
        requested_at:
          format: date-time
          title: Requested At
          type: string
        status:
          enum:
            - pending
            - running
            - completed
            - failed
          title: Status
          type: string
        target_id:
          description: Id do perfil, do handle ou da conversa; nunca o valor do handle.
          title: Target Id
          type: string
        target_kind:
          enum:
            - profile
            - handle
            - conversation
          title: Target Kind
          type: string
      required:
        - request_id
        - status
        - target_kind
        - target_id
        - requested_at
      title: ErasureOut
      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
    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_...
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````