{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/teamyou-com/json-schema/teamyou-com-project-schema.json",
  "title": "Project",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/teamyou-com-openapi.json#/components/schemas/Project",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "key": {
      "type": "string",
      "readOnly": true,
      "pattern": "^PROJ-[1-9][0-9]*$",
      "description": "The project's numbered key, e.g. `PROJ-2`: unique within the owner's account, assigned when the project is created, never reused and never changed. Accepted wherever a request takes this project's id, in a path or a field, and resolved within your own account. The `id` is still what every reference stores and what a response echoes back."
    },
    "userId": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "goal": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "waiting",
        "done",
        "archived"
      ]
    },
    "waitingOn": {
      "type": [
        "string",
        "null"
      ]
    },
    "preset": {
      "type": [
        "string",
        "null"
      ]
    },
    "notes": {
      "type": [
        "string",
        "null"
      ],
      "description": "Narrative markdown body: what this project is, in prose. Stored and returned verbatim; the server does not parse or render it."
    },
    "dueDate": {
      "type": [
        "string",
        "null"
      ],
      "format": "date",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Calendar day (YYYY-MM-DD) the project is aimed at. A soft target: it does not affect status and drives no behavior. Note the shape differs from `Task.dueDate`, which is a date-time instant."
    },
    "completedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "readOnly": true,
      "description": "When the project status became `done`. Set by the server on that transition and cleared when the status leaves `done`; not client-writable."
    },
    "templateKey": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true,
      "description": "The template this project was created from (`starter`, `run-a-ramble`, `get-to-know-you`), or null. Server-written; no request accepts it. An account holds at most one project per template, or one per agent for a per-agent template."
    },
    "templateAgentId": {
      "type": [
        "string",
        "null"
      ],
      "readOnly": true,
      "description": "For a project made from a per-agent template, the agent that created it; null on every other project. Server-written; no request accepts it."
    },
    "templateVersion": {
      "type": [
        "integer",
        "null"
      ],
      "readOnly": true,
      "description": "The version of `templateKey` this project was created from, or null. Server-written."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "createdBy": {
      "oneOf": [
        {
          "$ref": "#/$defs/ProvenanceActor"
        },
        {
          "type": "null"
        }
      ],
      "description": "Who created it. Null when it was created before TeamYou recorded who did."
    },
    "lastEditedBy": {
      "oneOf": [
        {
          "$ref": "#/$defs/ProvenanceActor"
        },
        {
          "type": "null"
        }
      ],
      "description": "Who last changed it. Null when nobody has changed it since history was recorded. Compare with your own agentId to see whether someone else changed it since you last read it."
    },
    "lastEditedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When lastEditedBy changed it; null alongside it."
    }
  },
  "required": [
    "id",
    "key",
    "userId",
    "name",
    "status",
    "createdAt",
    "updatedAt"
  ],
  "$defs": {
    "ProvenanceActor": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "agent",
            "owner"
          ],
          "description": "agent: a connected agent, through its key. owner: the account’s person, in the TeamYou app."
        },
        "agentId": {
          "type": [
            "string",
            "null"
          ],
          "description": "The agent (an agt_ id). Null for a key with no registered agent. Absent for the owner."
        },
        "name": {
          "type": "string",
          "description": "The agent’s display name, or \"An agent\" when it has none. Absent for the owner."
        },
        "via": {
          "type": "string",
          "enum": [
            "api",
            "mcp"
          ],
          "description": "How the agent made the change: the REST API or an MCP connector. Absent for the owner, and on a document change in GET /history, which records no channel."
        }
      },
      "required": [
        "type"
      ]
    }
  }
}