{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/daytona-io/json-schema/daytona-io-job-schema.json",
  "title": "Job",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/daytona-io-jobs-api-openapi.yml#/components/schemas/Job",
  "properties": {
    "id": {
      "description": "The ID of the job",
      "type": "string"
    },
    "type": {
      "allOf": [
        {
          "$ref": "#/$defs/JobType"
        }
      ],
      "description": "The type of the job"
    },
    "status": {
      "allOf": [
        {
          "$ref": "#/$defs/JobStatus"
        }
      ],
      "description": "The status of the job"
    },
    "resourceType": {
      "description": "The type of resource this job operates on",
      "enum": [
        "SANDBOX",
        "SNAPSHOT",
        "BACKUP"
      ],
      "type": "string"
    },
    "resourceId": {
      "description": "The ID of the resource this job operates on (sandboxId, snapshotRef, etc.)",
      "type": "string"
    },
    "payload": {
      "description": "Job-specific JSON-encoded payload data (operational metadata)",
      "type": "string"
    },
    "traceContext": {
      "additionalProperties": true,
      "description": "OpenTelemetry trace context for distributed tracing (W3C Trace Context format)",
      "type": "object"
    },
    "errorMessage": {
      "description": "Error message if the job failed",
      "type": "string"
    },
    "createdAt": {
      "description": "The creation timestamp of the job",
      "type": "string"
    },
    "updatedAt": {
      "description": "The last update timestamp of the job",
      "type": "string"
    }
  },
  "required": [
    "createdAt",
    "id",
    "resourceId",
    "resourceType",
    "status",
    "type"
  ],
  "type": "object",
  "$defs": {
    "JobStatus": {
      "enum": [
        "PENDING",
        "IN_PROGRESS",
        "COMPLETED",
        "FAILED"
      ],
      "type": "string"
    },
    "JobType": {
      "description": "The type of the job",
      "enum": [
        "CREATE_SANDBOX",
        "START_SANDBOX",
        "STOP_SANDBOX",
        "DESTROY_SANDBOX",
        "RESIZE_SANDBOX",
        "CREATE_BACKUP",
        "BUILD_SNAPSHOT",
        "PULL_SNAPSHOT",
        "RECOVER_SANDBOX",
        "INSPECT_SNAPSHOT_IN_REGISTRY",
        "REMOVE_SNAPSHOT",
        "UPDATE_SANDBOX_NETWORK_SETTINGS",
        "UPDATE_SANDBOX_SECRETS",
        "SNAPSHOT_SANDBOX",
        "FORK_SANDBOX",
        "PAUSE_SANDBOX"
      ],
      "type": "string"
    }
  }
}