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

# Editar uma nota

> A mudança vira uma versão nova; a anterior fica aposentada.



## OpenAPI

````yaml openapi/pt/cell.json PATCH /v1/agent-memory/notes/{note_id}
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/agent-memory/notes/{note_id}:
    patch:
      tags:
        - agent-memory
      summary: Editar uma nota
      description: >-
        Edita uma nota: a mudança vira uma versão nova, e a versão que ela
        substitui fica aposentada. Um agente só edita as próprias notas.


        **Autenticação.** Chave de fonte com o escopo `agent_memory:write`, ou
        token de pessoa do Console com o papel `integration` (ou admin).
      operationId: update_note_v1_agent_memory_notes__note_id__patch
      parameters:
        - in: path
          name: note_id
          required: true
          schema:
            format: uuid
            title: Note Id
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAgentNoteRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentNote'
          description: A versão nova.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: O pedido não bate com o contrato.
      security:
        - sourceKey: []
        - personToken: []
components:
  schemas:
    UpdateAgentNoteRequest:
      additionalProperties: false
      description: Toda mudança gera uma versão nova; a atual fica aposentada e guardada.
      properties:
        body:
          anyOf:
            - maxLength: 2000
              minLength: 1
              type: string
            - type: 'null'
          title: Body
        kind:
          anyOf:
            - $ref: '#/components/schemas/AgentNoteKind'
            - type: 'null'
        tags:
          anyOf:
            - items:
                pattern: ^[a-z0-9][a-z0-9_.:-]{0,63}$
                type: string
              maxItems: 8
              type: array
            - type: 'null'
          title: Tags
        title:
          anyOf:
            - maxLength: 120
              minLength: 1
              type: string
            - type: 'null'
          title: Title
        valid_until:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Valid Until
        visibility:
          anyOf:
            - $ref: '#/components/schemas/AgentNoteVisibility'
            - type: 'null'
      title: UpdateAgentNoteRequest
      type: object
    AgentNote:
      additionalProperties: false
      properties:
        body:
          title: Body
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
        created_by:
          description: '`source:<id>` ou `user:<id>`.'
          title: Created By
          type: string
        evidence:
          anyOf:
            - $ref: '#/components/schemas/Evidence'
            - type: 'null'
        kind:
          $ref: '#/components/schemas/AgentNoteKind'
        note_id:
          format: uuid
          title: Note Id
          type: string
        origin:
          $ref: '#/components/schemas/AgentNoteOrigin'
        source_id:
          description: O agente dono da nota.
          format: uuid
          title: Source Id
          type: string
        status:
          $ref: '#/components/schemas/AgentNoteStatus'
        supersedes_note_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: A versão que esta substituiu; aquela fica `retired`.
          title: Supersedes Note Id
        tags:
          items:
            type: string
          title: Tags
          type: array
        title:
          title: Title
          type: string
        valid_until:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          description: Depois deste momento a nota sai do bloco e da busca.
          title: Valid Until
        version:
          minimum: 1
          title: Version
          type: integer
        visibility:
          $ref: '#/components/schemas/AgentNoteVisibility'
      required:
        - note_id
        - source_id
        - visibility
        - kind
        - title
        - body
        - origin
        - version
        - status
        - created_at
        - created_by
      title: AgentNote
      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
    AgentNoteKind:
      enum:
        - procedure
        - tool_note
        - process_note
        - pitfall
      title: AgentNoteKind
      type: string
    AgentNoteVisibility:
      enum:
        - source
        - vendor
        - space
      title: AgentNoteVisibility
      type: string
    Evidence:
      additionalProperties: false
      description: 'De onde a nota veio: só o id, nunca o texto da conversa ou da tarefa.'
      properties:
        conversation_id:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          title: Conversation Id
        task_id:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          title: Task Id
      title: Evidence
      type: object
    AgentNoteOrigin:
      enum:
        - agent
        - human
        - distilled
      title: AgentNoteOrigin
      type: string
    AgentNoteStatus:
      enum:
        - active
        - retired
      title: AgentNoteStatus
      type: string
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````