{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/acronis/main/json-schema/acronis-task-1-schema.json",
  "title": "task_1",
  "description": "The task object.",
  "x-generated": "2026-10-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/acronis-tasks-v2-openapi.json#/components/schemas/task_1",
  "type": "object",
  "required": [
    "state",
    "tenant",
    "queue",
    "id",
    "issuer",
    "cancelRequested",
    "enqueuedAt",
    "updatedAt",
    "type",
    "assignCount",
    "priority"
  ],
  "properties": {
    "state": {
      "$ref": "#/$defs/executionState"
    },
    "ackTimeout": {
      "description": "The time limit during which the executor has to confirm that it has started the task. Missing property OR 0 value will be defaulted to \"5s\".",
      "type": "string"
    },
    "queueTimeout": {
      "description": "The time limit during which the task can remain unassigned. Missing property OR 0 value means \"infinite\".",
      "type": "string"
    },
    "context": {
      "description": "A context of the task."
    },
    "tenant": {
      "$ref": "#/$defs/tenant"
    },
    "result": {
      "$ref": "#/$defs/executionResult"
    },
    "argument": {
      "description": "An argument of the task."
    },
    "queue": {
      "description": "The target queue.",
      "type": "string"
    },
    "startedAt": {
      "$ref": "#/$defs/time"
    },
    "id": {
      "description": "Server-generated unique numeric identifier for the task object.",
      "type": "integer"
    },
    "startedByUser": {
      "description": "The name of the user who created the task.",
      "type": "string"
    },
    "completedAt": {
      "$ref": "#/$defs/time"
    },
    "heartBeatInterval": {
      "description": "The interval that is required for the executor to report the current status of the task. Missing property OR 0 value means \"infinite\". Cannot be infinite for cancellable tasks.",
      "type": "string"
    },
    "resource": {
      "description": "The link to the resource which is related to the task.",
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "name": {
          "$ref": "#/$defs/string256"
        },
        "id": {
          "$ref": "#/$defs/string64"
        },
        "type": {
          "$ref": "#/$defs/string64"
        }
      }
    },
    "issuer": {
      "description": "The entity that created the task.",
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/string64"
        },
        "clusterId": {
          "$ref": "#/$defs/string64"
        }
      }
    },
    "cancelRequested": {
      "description": "Whether the task was requested to be cancelled.",
      "type": "boolean"
    },
    "uuid": {
      "description": "Universally unique identifier for the task object. If not set, it will be automatically generated by the server.",
      "type": "string",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
    },
    "tags": {
      "description": "A list of user-defined tags.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/string64"
      }
    },
    "blockers": {
      "description": "A list of reasons why the task cannot be completed without a user input.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/blocker"
      }
    },
    "progress": {
      "$ref": "#/$defs/progress"
    },
    "enqueuedAt": {
      "$ref": "#/$defs/time"
    },
    "cancellable": {
      "description": "Whether the task can be canceled. If true, the `heartBeatInterval` parameter also must be set to a non-infinite value.",
      "type": "boolean"
    },
    "updatedAt": {
      "$ref": "#/$defs/time"
    },
    "executor": {
      "description": "The identity of the executor.",
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/string64"
        },
        "clusterId": {
          "$ref": "#/$defs/string64"
        }
      }
    },
    "maxAssignCount": {
      "description": "The limit for assignment attempts. Default is 1.",
      "type": "integer"
    },
    "execTimeout": {
      "description": "The time limit during which the executor has to complete the task. Missing property OR 0 value means \"infinite\".",
      "type": "string"
    },
    "policy": {
      "description": "The link to the policy which execution requires to create the task.",
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "name": {
          "$ref": "#/$defs/string256"
        },
        "id": {
          "$ref": "#/$defs/string64"
        },
        "type": {
          "$ref": "#/$defs/string64"
        }
      }
    },
    "lifeTime": {
      "description": "The time limit during which the task can remain uncompleted. Missing property OR 0 value means \"infinite\".",
      "type": "string"
    },
    "workflowId": {
      "description": "The ID of the workflow that is related to the task.",
      "type": "integer"
    },
    "sustainable": {
      "description": "If true, the task is sustainable:\n- When the task is returned to the queue, its sustainable activities move to `enqueued` instead of failing.\n- Manual abandon does NOT consume an assignment attempt (`assignCount` unchanged).\n- Auto-abandon on missed heartbeats DOES consume an assignment attempt.\n",
      "type": "boolean"
    },
    "type": {
      "description": "The type of the task that is defined by the user.",
      "type": "string"
    },
    "assignCount": {
      "description": "Current count of the assignments.",
      "type": "integer"
    },
    "priority": {
      "$ref": "#/$defs/taskPriority"
    },
    "assignedAt": {
      "$ref": "#/$defs/time"
    },
    "affinity": {
      "description": "An object containing the information about task affinity.",
      "type": "object",
      "properties": {
        "agentId": {
          "description": "The ID of the agent that is bound to the task.",
          "type": "string"
        },
        "clusterId": {
          "description": "The ID of the cluster that is bound to the task.",
          "type": "string"
        }
      }
    }
  },
  "$defs": {
    "blob": {
      "description": "Arbitrary data."
    },
    "blocker": {
      "description": "The task blocker object.",
      "type": "object",
      "required": [
        "taskId",
        "tenant",
        "id",
        "issue"
      ],
      "properties": {
        "taskId": {
          "type": "integer"
        },
        "tenant": {
          "$ref": "#/$defs/tenant"
        },
        "id": {
          "description": "Unique numeric identifier for the task blocker object (server-generated).",
          "type": "integer"
        },
        "possibleSolutions": {
          "description": "Possible solutions of blocker.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/message"
          }
        },
        "issue": {
          "description": "A reason why the task cannot be completed without a user input.",
          "type": "object",
          "required": [
            "key"
          ],
          "properties": {
            "key": {
              "description": "Message key.",
              "type": "string"
            },
            "context": {
              "description": "Context dictionary.",
              "type": "object"
            }
          }
        },
        "uuid": {
          "description": "Universally unique identifier for the task blocker object. If not set, it will be automatically generated by the server.",
          "type": "string",
          "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
        },
        "solution": {
          "description": "A solution provided by the user.",
          "type": "object",
          "required": [
            "key"
          ],
          "properties": {
            "key": {
              "description": "Message key.",
              "type": "string"
            },
            "context": {
              "description": "Context dictionary.",
              "type": "object"
            }
          }
        },
        "activityId": {
          "type": "integer"
        }
      }
    },
    "debugInfo": {
      "description": "Error debug information (map type)",
      "type": "object"
    },
    "domainError": {
      "description": "Base error object",
      "type": "object",
      "required": [
        "domain",
        "code"
      ],
      "properties": {
        "domain": {
          "description": "Error type or category. Can be ['Licensing','Access'] or name of service (for example 'PolicyManager' or 'VaultManager')",
          "type": "string"
        },
        "code": {
          "description": "Error id or code, unique in the domain. Same as in 'reason' field",
          "type": "string"
        },
        "reason": {
          "description": "Obsolete. Error id or code, unique in the domain. Same as in 'code' field",
          "type": "string"
        },
        "context": {
          "description": "Error context dictionary",
          "type": "object"
        },
        "kbLink": {
          "$ref": "#/$defs/kbLinkInfo"
        },
        "debug": {
          "$ref": "#/$defs/debugInfo"
        }
      }
    },
    "duration": {
      "description": "Duration in the human-readable format like \"1m\", \"10s\", \"1h25m43s\" where \"m\" = \"minutes\", \"s\" = \"seconds\", \"h\" = \"hours\".",
      "type": "string"
    },
    "executionBottleneck": {
      "description": "An execution bottleneck. The sum of all field values must equal 100.",
      "type": "object",
      "properties": {
        "source": {
          "description": "Bottleneck score when reading data.",
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "destination": {
          "description": "Bottleneck score when writing data.",
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "processing": {
          "description": "Bottleneck score during data processing on executor side.",
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        }
      }
    },
    "executionResult": {
      "description": "An execution result.",
      "type": "object",
      "required": [
        "code"
      ],
      "properties": {
        "code": {
          "$ref": "#/$defs/resultCode"
        },
        "error": {
          "$ref": "#/$defs/domainError"
        },
        "warnings": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/domainError"
          }
        },
        "payload": {
          "$ref": "#/$defs/blob"
        }
      }
    },
    "executionState": {
      "description": "An execution state.",
      "enum": [
        "enqueued",
        "assigned",
        "started",
        "paused",
        "completed"
      ],
      "type": "string"
    },
    "kbLinkInfo": {
      "description": "Components for kblink",
      "type": "object",
      "required": [
        "lineTag",
        "serCode",
        "version",
        "build",
        "product",
        "os"
      ],
      "properties": {
        "lineTag": {
          "type": "string"
        },
        "serCode": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "build": {
          "type": "integer"
        },
        "product": {
          "type": "string"
        },
        "os": {
          "type": "string"
        }
      }
    },
    "message": {
      "description": "A message to pass through.",
      "type": "object",
      "required": [
        "key"
      ],
      "properties": {
        "key": {
          "description": "Message key.",
          "type": "string"
        },
        "context": {
          "description": "Context dictionary.",
          "type": "object"
        }
      }
    },
    "progress": {
      "description": "A progress value.",
      "type": "object",
      "required": [
        "total"
      ],
      "properties": {
        "current": {
          "type": "integer"
        },
        "bytesProcessed": {
          "type": "integer"
        },
        "processingSpeed": {
          "type": "number"
        },
        "leftTime": {
          "$ref": "#/$defs/duration"
        },
        "bytesSaved": {
          "type": "integer"
        },
        "bottleneck": {
          "$ref": "#/$defs/executionBottleneck"
        },
        "total": {
          "type": "integer"
        }
      }
    },
    "resultCode": {
      "enum": [
        "ok",
        "error",
        "warning",
        "cancelled",
        "abandoned",
        "timedout"
      ],
      "type": "string"
    },
    "string256": {
      "description": "A string that may contain up to 256 characters.",
      "type": "string"
    },
    "string64": {
      "description": "A string that may contain up to 64 characters.",
      "type": "string"
    },
    "taskPriority": {
      "description": "The task priority.",
      "enum": [
        "low",
        "belowNormal",
        "normal",
        "aboveNormal",
        "high"
      ],
      "type": "string"
    },
    "tenant": {
      "description": "A tenant identity.",
      "type": "object",
      "required": [
        "id",
        "uuid"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/string64"
        },
        "uuid": {
          "$ref": "#/$defs/uuid"
        },
        "name": {
          "type": "string"
        },
        "locator": {
          "description": "A hierarchical tenant identifier in the following format - `/root-id/unit-id/sub-unit-id/tenant-id/`.",
          "type": "string"
        }
      }
    },
    "time": {
      "description": "Time in RFC3339 format.",
      "type": "string"
    },
    "uuid": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
    }
  }
}