{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/restivity-ai/json-schema/restivity-ai-task-schema.json",
  "title": "Task",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/restivity-ai-openapi.json#/components/schemas/Task",
  "type": "object",
  "properties": {
    "id": {
      "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)$"
    },
    "user_id": {
      "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)$"
    },
    "project_id": {
      "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)$"
        },
        {
          "type": "null"
        }
      ]
    },
    "title": {
      "type": "string"
    },
    "description": {
      "description": "The stored HTML, as the task editor writes it (sanitized). To show it to a person read `description_text`.",
      "type": "string"
    },
    "description_text": {
      "description": "The description as plain text: every tag removed, one line per block, `- ` / `N. ` before list items, entities decoded, in the same shape as a comment’s `content_text`. Show THIS to a person; `description` is the stored HTML. Read-only",
      "type": "string"
    },
    "status": {
      "$ref": "#/$defs/TaskStatus"
    },
    "priority": {
      "$ref": "#/$defs/TaskPriority"
    },
    "order": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        {
          "type": "null"
        }
      ]
    },
    "due_date": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "is_for_today": {
      "type": "boolean"
    },
    "is_important": {
      "type": "boolean"
    },
    "is_urgent": {
      "type": "boolean"
    },
    "estimated_pomodoros": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "completed_pomodoros": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "is_recurring": {
      "type": "boolean"
    },
    "recurring_frequency": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "recurring_end_date": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "recurring_days": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "parent_recurrence_id": {
      "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)$"
        },
        {
          "type": "null"
        }
      ]
    },
    "recurrence_model": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "materialized",
            "reminder_only"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "recurrence_start_date": {
      "description": "RES-115: the series anchor (\"Starts on\") of a recurring master, a civil date at UTC midnight. The deadline is only a deadline: a `reminder_only` master's `due_date` is the occurrence it is currently on (it rolls forward when the occurrence is completed or skipped), a `materialized` master has none (each child occurrence carries its own). NULL on non-recurring rows and on child occurrences.",
      "default": null,
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "completed_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "assigned_to": {
      "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)$"
        },
        {
          "type": "null"
        }
      ]
    },
    "code": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "type": "string"
    },
    "updated_at": {
      "type": "string"
    },
    "deleted_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "url": {
      "type": "string"
    },
    "subtasks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Subtask"
      }
    },
    "tags": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/TagRef"
      }
    },
    "project": {
      "anyOf": [
        {
          "$ref": "#/$defs/ProjectRef"
        },
        {
          "type": "null"
        }
      ]
    },
    "project_status": {
      "anyOf": [
        {
          "$ref": "#/$defs/ProjectStatusRef"
        },
        {
          "type": "null"
        }
      ]
    },
    "assigned_to_profile": {
      "anyOf": [
        {
          "$ref": "#/$defs/AssignedProfileRef"
        },
        {
          "type": "null"
        }
      ]
    },
    "planned_occurrences": {
      "description": "AGF-381. Only on the master of a `materialized` series, from `GET /tasks/{id}`: the next occurrences that do not exist yet (the nightly job creates each one 30 days before its day), up to the series end and at most 12, after the occurrences that already exist (those are real child tasks: `parent_recurrence_id` = this id). Absent on every other task and on list endpoints.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/PlannedOccurrence"
      }
    },
    "hidden_after": {
      "description": "RES-177: only in a list read with `recurring: 'next'`, on the first open occurrence after today of a `materialized` series: how many later open occurrences of that series the list leaves out (under the same filters). Absent on every other task.",
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "series_change": {
      "description": "AGF-391. Only when this update changed the TYPE of a `materialized` series (`is_recurring: false` stops it; `recurrence_model: 'reminder_only'` turns it into a reminder): the occurrences still to come (due today or later in the owner's zone, not completed) went to the Trash, restorable with `POST /tasks/{id}/restore`, their comments with them; the past and the completed ones stay as history, still linked to the series. Absent on every other answer.",
      "$ref": "#/$defs/SeriesChange"
    }
  },
  "required": [
    "id",
    "user_id",
    "project_id",
    "title",
    "description",
    "description_text",
    "status",
    "priority",
    "order",
    "due_date",
    "is_for_today",
    "is_important",
    "is_urgent",
    "estimated_pomodoros",
    "completed_pomodoros",
    "is_recurring",
    "recurring_frequency",
    "recurring_end_date",
    "recurring_days",
    "parent_recurrence_id",
    "recurrence_model",
    "recurrence_start_date",
    "completed_at",
    "assigned_to",
    "code",
    "created_at",
    "updated_at",
    "deleted_at"
  ],
  "additionalProperties": false,
  "$defs": {
    "AssignedProfileRef": {
      "type": "object",
      "properties": {
        "id": {
          "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)$"
        },
        "display_name": {
          "type": "string"
        },
        "photo_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "display_name",
        "photo_url"
      ],
      "additionalProperties": false
    },
    "PlannedOccurrence": {
      "type": "object",
      "properties": {
        "date": {
          "description": "The day of the occurrence (YYYY-MM-DD).",
          "type": "string"
        },
        "creates_on": {
          "description": "The day the nightly job creates it as a real task (YYYY-MM-DD): the date minus 30 days.",
          "type": "string"
        }
      },
      "required": [
        "date",
        "creates_on"
      ],
      "additionalProperties": false
    },
    "ProjectRef": {
      "type": "object",
      "properties": {
        "id": {
          "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)$"
        },
        "name": {
          "type": "string"
        },
        "color": {
          "type": "string"
        },
        "prefix": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "team_id": {
          "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)$"
            },
            {
              "type": "null"
            }
          ]
        },
        "team_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "team_slug": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "name",
        "color"
      ],
      "additionalProperties": false
    },
    "ProjectStatusCategory": {
      "description": "Lifecycle category of a custom project status.",
      "type": "string",
      "enum": [
        "todo",
        "in_progress",
        "completed"
      ]
    },
    "ProjectStatusRef": {
      "type": "object",
      "properties": {
        "id": {
          "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)$"
        },
        "name": {
          "type": "string"
        },
        "color": {
          "type": "string"
        },
        "category": {
          "$ref": "#/$defs/ProjectStatusCategory"
        }
      },
      "required": [
        "id",
        "name",
        "color",
        "category"
      ],
      "additionalProperties": false
    },
    "SeriesChange": {
      "type": "object",
      "properties": {
        "change": {
          "description": "`to_reminder`: the series is now a `reminder_only` master; `stop_repeating`: it is now a plain task.",
          "type": "string",
          "enum": [
            "to_reminder",
            "stop_repeating"
          ]
        },
        "trashed_occurrence_ids": {
          "description": "The occurrences still to come (due today or later, not completed), now in the Trash, restorable.",
          "type": "array",
          "items": {
            "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)$"
          }
        },
        "kept_occurrence_ids": {
          "description": "The past and the completed occurrences: live, still linked to the series (`parent_recurrence_id`).",
          "type": "array",
          "items": {
            "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)$"
          }
        },
        "reminder_due_date": {
          "description": "`to_reminder`: the day the reminder is due (YYYY-MM-DD), its next occurrence from today; null otherwise.",
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "change",
        "trashed_occurrence_ids",
        "kept_occurrence_ids",
        "reminder_due_date"
      ],
      "additionalProperties": false
    },
    "Subtask": {
      "type": "object",
      "properties": {
        "id": {
          "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)$"
        },
        "task_id": {
          "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)$"
        },
        "title": {
          "type": "string"
        },
        "completed": {
          "type": "boolean"
        },
        "order": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "created_at": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "task_id",
        "title",
        "completed"
      ],
      "additionalProperties": false
    },
    "TagRef": {
      "type": "object",
      "properties": {
        "id": {
          "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)$"
        },
        "user_id": {
          "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)$"
        },
        "name": {
          "type": "string"
        },
        "color": {
          "type": "string"
        },
        "usage_count": {
          "description": "How many live tasks carry the tag. A task in the Trash is not counted.",
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "deleted_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "user_id",
        "name",
        "color",
        "usage_count"
      ],
      "additionalProperties": false
    },
    "TaskPriority": {
      "type": "string",
      "enum": [
        "low",
        "medium",
        "high",
        "urgent"
      ]
    },
    "TaskStatus": {
      "description": "Lifecycle state of a task.",
      "type": "string",
      "enum": [
        "todo",
        "in_progress",
        "completed",
        "archived"
      ]
    }
  }
}