{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hjarni-com/json-schema/hjarni-com-container-schema.json",
  "title": "Container",
  "description": "A folder. `last_edited_by` and `last_edited_by_agent` appear only once someone has edited it.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hjarni-com-openapi.json#/components/schemas/Container",
  "type": "object",
  "required": [
    "id",
    "name",
    "emoji",
    "description",
    "position",
    "archived",
    "llm_instructions",
    "created_at",
    "updated_at",
    "root",
    "notes_count",
    "children_count",
    "parent"
  ],
  "properties": {
    "id": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "emoji": {
      "type": [
        "string",
        "null"
      ],
      "description": "One emoji shown as the folder's icon in place of the folder glyph; null when none is set."
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "position": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Sort position among its siblings; null when unpositioned."
    },
    "archived": {
      "type": "boolean"
    },
    "llm_instructions": {
      "type": [
        "string",
        "null"
      ],
      "description": "AI instructions that apply to the notes in this folder and below."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "root": {
      "type": "boolean",
      "description": "True for a space's root, which holds the notes filed outside any folder and refuses every change. False for an ordinary folder."
    },
    "last_edited_by": {
      "type": [
        "string",
        "null"
      ],
      "description": "Email address of whoever saved the folder last."
    },
    "last_edited_by_agent": {
      "type": [
        "string",
        "null"
      ]
    },
    "notes_count": {
      "type": "integer",
      "description": "Notes filed directly in this folder, archived included, Trash excluded."
    },
    "children_count": {
      "type": "integer",
      "description": "Sub-folders directly under this one that are not in the Trash (for an agent token, the ones it can reach)."
    },
    "parent": {
      "description": "The parent folder, or null at the top level or when the token cannot reach the parent.",
      "oneOf": [
        {
          "$ref": "#/$defs/ContainerRef"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "$defs": {
    "ContainerRef": {
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "properties": {
        "id": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        }
      }
    }
  }
}