{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/teamyou-com/json-schema/teamyou-com-create-project-request-schema.json",
  "title": "CreateProjectRequest",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/teamyou-com-openapi.json#/components/schemas/CreateProjectRequest",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "goal": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 5000
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "waiting",
        "done",
        "archived"
      ]
    },
    "waitingOn": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 1000,
      "description": "Who or what the work is blocked on — a short name or phrase (\"Bill\", \"legal review\"), not a status update. Both project surfaces render it in a narrow fixed-width slot and truncate what does not fit, so prose written here is stored but never read. Meaningful when status=waiting, though not enforced against it: a project can carry this while active.",
      "x-mcp-description": "Who or what the work is blocked on: a short name or phrase (\"Bill\", \"legal review\"), not a status update. Shown in a narrow slot that truncates, so longer prose is never read. Meant for status=waiting, though not enforced."
    },
    "preset": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 255,
      "description": "Reserved; unused in v1."
    },
    "notes": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 50000,
      "description": "Narrative markdown body: what this project is, in prose. Stored verbatim."
    },
    "dueDate": {
      "type": [
        "string",
        "null"
      ],
      "format": "date",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "Calendar day (YYYY-MM-DD) to aim at. A soft target only. Not a date-time instant, unlike a task dueDate."
    },
    "tasks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/InlineProjectTask"
      },
      "maxItems": 200,
      "description": "Optional plan to create with the project. Array order IS the plan order. Written in the same transaction as the project: all-or-nothing, so a failure anywhere creates nothing. Create-only - there is no upsert or dedupe, so two identical calls create two projects."
    },
    "todos": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/InlineProjectTask"
      },
      "maxItems": 200,
      "deprecated": true,
      "description": "Deprecated spelling of `tasks`; send `tasks` instead. Accepted on its own, or beside `tasks` when both hold identical values - both present and different is a 400 validation_error naming both."
    },
    "refs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/InlineProjectRef"
      },
      "maxItems": 100,
      "description": "Optional references to create with the project. Each entry is a FLAT target object (`{\"targetType\":\"url\",\"url\":\"https://example.com/spec\",\"title\":\"Spec\"}`), NOT the refs-add `{\"target\":{...}}` wrapper. Array order IS the order. Same transaction and all-or-nothing semantics as `tasks`. Naming the same target twice in one array is a 400. Refs cannot target the tasks created in the same call (those ids do not exist yet) - add them afterwards with refs-add.",
      "x-mcp-description": "References to create with the project, in this order. Each is a FLAT target object ({\"targetType\":\"url\",\"url\":\"…\",\"title\":\"…\"}), not the refs-add {\"target\":…} wrapper. All-or-nothing with tasks; the same target twice is a 400; cannot target tasks made in this call."
    }
  },
  "required": [
    "name"
  ],
  "$defs": {
    "InlineProjectRef": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "targetType": {
              "type": "string",
              "enum": [
                "topic",
                "task",
                "todo",
                "project",
                "doc"
              ],
              "x-deprecated-enum": [
                "todo"
              ]
            },
            "targetId": {
              "type": "string",
              "minLength": 1,
              "description": "The target's id. A task or project target may be given by its key instead (e.g. `TASK-12`, `PROJ-2`); the stored reference always holds the id."
            },
            "title": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 1000
            }
          },
          "required": [
            "targetType",
            "targetId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "targetType": {
              "type": "string",
              "enum": [
                "url"
              ]
            },
            "url": {
              "type": "string",
              "format": "uri",
              "maxLength": 2000,
              "description": "An absolute URL with scheme http, https, claude, codex or slack (e.g. `claude://claude.ai/epitaxy/<session id>`, `codex://threads/<id>`, `slack://channel?team=<team>&id=<channel>`); an app link opens in that app. Any other scheme is a 400 validation_error."
            },
            "title": {
              "type": [
                "string",
                "null"
              ],
              "maxLength": 1000
            }
          },
          "required": [
            "targetType",
            "url"
          ]
        }
      ],
      "description": "A reference created with its project. FLAT: each entry IS the target object itself - it is the AddProjectRefRequest `target` union verbatim (same accepted targetType set: topic|task|project|doc|url; `area` and `entity` are rejected), WITHOUT the `target` wrapper and without a position (the array index is the order). Send `{\"targetType\":\"url\",\"url\":\"https://example.com/spec\",\"title\":\"Spec\"}`, NOT `{\"target\":{\"targetType\":\"url\",...}}` - the wrapper is the refs-add body shape and 400s here because the discriminator ends up one level too deep. For a `url` target the optional `title` IS the display name, so pass it when you have one. Example refs array: `[{\"targetType\":\"url\",\"url\":\"https://example.com/spec\",\"title\":\"Spec\"},{\"targetType\":\"topic\",\"targetId\":\"abc123\"}]`.",
      "x-mcp-description": "A FLAT target object, without the refs-add `target` wrapper (which 400s here): {\"targetType\":\"url\",\"url\":\"…\",\"title\":\"…\"} or {\"targetType\":\"topic\",\"targetId\":\"…\"}. targetType is topic|task|project|doc|url. For a url, title is its display name."
    },
    "InlineProjectTask": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        "description": {
          "type": "string",
          "maxLength": 10000,
          "description": "Markdown: what done looks like, the context and the links. Anything longer belongs in an Agent Drive document linked from here."
        },
        "status": {
          "type": "string",
          "enum": [
            "todo",
            "in_progress",
            "done"
          ]
        },
        "priority": {
          "type": "string",
          "enum": [
            "high",
            "medium",
            "low",
            "none"
          ]
        },
        "dueDate": {
          "type": "string",
          "format": "date-time"
        },
        "topicId": {
          "type": "null",
          "deprecated": true,
          "description": "Deprecated: topics hold knowledge, not tasks, so a task can no longer be linked to a topic. Only null is accepted; any other value is a 400 validation_error. Put the task in a project instead, and add the topic to that project as a resource to keep it beside the work."
        },
        "assigneeAgentId": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "maxLength": 64,
          "description": "An agent id or slug; it gets an assigned item, which it sees when the step is next. Omitted or null: the step is your person's. 403 assignment_refused (reason escalation), creating nothing, when that agent holds scopes your key does not or has no live key."
        }
      },
      "required": [
        "title"
      ],
      "description": "A plan item created with its project. Mirrors CreateTaskRequest without projectId (the new project) or position (the array index is the plan order)."
    }
  }
}