{
  "$id": "https://intentschema.org/intents/productivity/notes/note/update/v1.json",
  "fqdn": "org.intentschema.productivity.notes.note.update.v1",
  "title": "Update note",
  "description": "Update fields on an existing note. Either send a full `object` replace or an RFC 6902 `patch`.",
  "payload": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "required": [
      "target"
    ],
    "properties": {
      "target": {
        "allOf": [
          {
            "$ref": "https://intentschema.org/common/target/v1.json"
          },
          {
            "required": [
              "external_id"
            ]
          }
        ]
      },
      "object": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "body": {
            "type": "string",
            "description": "Note body \u2014 Markdown by convention."
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "folder": {
            "type": "string",
            "description": "Optional folder/parent path or container id."
          }
        }
      },
      "patch": {
        "type": "array",
        "items": {
          "type": "object",
          "required": [
            "op",
            "path"
          ],
          "properties": {
            "op": {
              "enum": [
                "add",
                "remove",
                "replace",
                "move",
                "copy",
                "test"
              ]
            },
            "path": {
              "type": "string"
            },
            "value": {},
            "from": {
              "type": "string"
            }
          }
        }
      },
      "idempotency_key": {
        "type": "string"
      }
    },
    "anyOf": [
      {
        "required": [
          "object"
        ]
      },
      {
        "required": [
          "patch"
        ]
      }
    ]
  },
  "result": {
    "type": "object",
    "properties": {
      "external_id": {
        "type": "string"
      },
      "updated_at": {
        "type": "string",
        "format": "date-time"
      },
      "etag": {
        "type": "string"
      }
    }
  },
  "examples": [
    {
      "name": "append to body",
      "value": {
        "target": {
          "system": "obsidian",
          "external_id": "vault/inbox/standup-2026-04-22.md"
        },
        "patch": [
          {
            "op": "add",
            "path": "/body",
            "value": "Existing body...\n- New item appended\n"
          }
        ]
      }
    }
  ]
}
