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

# Save a note

> A procedure, a tool or process note, or a pitfall. Personal data is refused with 422.



## OpenAPI

````yaml openapi/en/cell.json POST /v1/agent-memory/notes
openapi: 3.1.0
info:
  title: Niadra data API
  version: '1'
  description: >-
    Writing, context, history, objects, identity, privacy and governance of one
    space. Every space has a stable address, with the space and the region in
    its name.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: The space, which comes in the source key.
      region:
        default: us-east-2
        description: The region of the space, which also comes in the key.
security: []
paths:
  /v1/agent-memory/notes:
    post:
      tags:
        - agent-memory
      summary: Save a note
      description: >-
        422 `personal_data_in_agent_memory` when the title, body or tags carry
        personal data.


        **Authentication.** Source key with the `agent_memory:write` scope, or a
        Console person token with the `integration` role (or admin).
      operationId: create_note_v1_agent_memory_notes_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAgentNoteRequest'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RememberResult'
          description: The note, or the `proposal_id` of the proposal waiting for a person.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request does not match the contract.
      security:
        - sourceKey: []
        - personToken: []
      x-codeSamples:
        - lang: python
          label: Python
          source: >-
            # Needs the agent_memory:write scope; a note with personal data
            comes back refused

            saved = niadra.remember(
                "pitfall",
                "Scheduling API",
                "Dates without a time zone are refused; send the offset the customer's region uses.",
                tags=["scheduling"],
            )

            if saved.error == "personal_data_in_agent_memory":
                ...  # rewrite the note without the customer's data
        - lang: typescript
          label: TypeScript
          source: >-
            // Needs the agent_memory:write scope; a note with personal data
            comes back refused

            const { data, error } = await niadra.remember({
              kind: "pitfall",
              title: "Scheduling API",
              body: "Dates without a time zone are refused; send the offset the customer's region uses.",
              tags: ["scheduling"],
            });

            if (error?.code === "personal_data_in_agent_memory") {
              // rewrite the note without the customer's data
            }
components:
  schemas:
    CreateAgentNoteRequest:
      additionalProperties: false
      properties:
        body:
          maxLength: 2000
          minLength: 1
          title: Body
          type: string
        evidence:
          anyOf:
            - $ref: '#/components/schemas/Evidence'
            - type: 'null'
        kind:
          $ref: '#/components/schemas/AgentNoteKind'
        source_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: >-
            The owning agent. A source key writes its own notes and may omit it;
            a person names it.
          title: Source Id
        tags:
          items:
            pattern: ^[a-z0-9][a-z0-9_.:-]{0,63}$
            type: string
          maxItems: 8
          title: Tags
          type: array
        title:
          maxLength: 120
          minLength: 1
          title: Title
          type: string
        valid_until:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Valid Until
        visibility:
          $ref: '#/components/schemas/AgentNoteVisibility'
          default: source
      required:
        - kind
        - title
        - body
      title: CreateAgentNoteRequest
      type: object
    RememberResult:
      additionalProperties: false
      description: >-
        What `POST /v1/agent-memory/notes` answers: the note, or where it waits
        when writes need a person.
      properties:
        note:
          anyOf:
            - $ref: '#/components/schemas/AgentNote'
            - type: 'null'
        proposal_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: >-
            Set when the space takes agent notes only through a person (`writes:
            human_only`).
          title: Proposal Id
      title: RememberResult
      type: object
    Problem:
      additionalProperties: false
      description: RFC 9457 problem details; `code` comes from the versioned error catalog.
      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
    Evidence:
      additionalProperties: false
      description: >-
        Where the note came from: an id only, never the text of the conversation
        or task.
      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
    AgentNoteKind:
      enum:
        - procedure
        - tool_note
        - process_note
        - pitfall
      title: AgentNoteKind
      type: string
    AgentNoteVisibility:
      enum:
        - source
        - vendor
        - space
      title: AgentNoteVisibility
      type: string
    AgentNote:
      additionalProperties: false
      properties:
        body:
          title: Body
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
        created_by:
          description: '`source:<id>` or `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: The agent that owns the note.
          format: uuid
          title: Source Id
          type: string
        status:
          $ref: '#/components/schemas/AgentNoteStatus'
        supersedes_note_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          description: The version this one replaced; that one is `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: After this moment the note leaves the block and the search.
          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
    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

````