{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/conduyt-com/json-schema/conduyt-com-task-create-schema.json",
  "title": "TaskCreate",
  "description": "The POST /tasks body exactly as the route reads it (lib/validators/task.ts createTaskSchema); unknown keys are ignored. Any other shape is a 400 \"Invalid task payload\"; the health-fix fields are judged first (400 `health_fix_mismatch`).",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/conduyt-com-tasks-api-openapi.yml#/components/schemas/TaskCreate",
  "type": "object",
  "required": [
    "title"
  ],
  "properties": {
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500,
      "description": "Trimmed; blank after trimming is refused. Leading and trailing whitespace is trimmed before the length check, so a blank value is refused."
    },
    "description": {
      "type": "string",
      "maxLength": 5000
    },
    "dueDate": {
      "type": "string",
      "description": "Any parseable date: a date-only `YYYY-MM-DD` is stored as noon UTC that day; a date-time is stored as given. An ISO 8601 date or date-time the runtime can parse; anything else is refused with `Invalid dueDate`."
    },
    "priority": {
      "type": "string",
      "enum": [
        "low",
        "medium",
        "high",
        "urgent"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "todo",
        "in_progress",
        "done"
      ]
    },
    "assignedTo": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        {
          "type": "string",
          "const": "@me"
        },
        {
          "type": "string",
          "const": "@owner"
        },
        {
          "type": "null"
        }
      ],
      "description": "A member's user id, `@me` (the caller) or `@owner` (the account owner); null or absent = unassigned (the account's task assignment rules may still assign it). Assigning to someone else needs tasks.assign."
    },
    "contactId": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        {
          "type": "null"
        }
      ]
    },
    "dealId": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid",
          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
        },
        {
          "type": "null"
        }
      ]
    },
    "checkOrigin": {
      "type": "string",
      "enum": [
        "high_value_idle",
        "needs_action"
      ],
      "description": "Pipeline health quick fix (\"Set next action\"): the health check this task fixes. Needs `dealId` and `expectedDealUpdatedAt`. The task is created only while, under the deal's next-action lock, the deal is still at that version (else 409 `deal_changed`), still has no next action, i.e. no open task and no appointment booked from a day ago on (else 409 `deal_has_next_action`), and still fails this check (else 409 `deal_check_cleared`). Send an Idempotency-Key so a retry after a lost response replays the first task."
    },
    "expectedDealUpdatedAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
      "description": "With `checkOrigin` only: the deal's `updatedAt` as the health row carried it (PipelineHealthDeal.updatedAt). The pattern above is the server's rule (Zod's ISO date-time check). It also accepts minute precision without seconds (2026-12-01T10:00Z), which an RFC 3339 `format: date-time` validator refuses; send seconds for portability."
    }
  }
}