{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/fleetai-com/json-schema/fleetai-com-instance-request-schema.json",
  "title": "InstanceRequest",
  "description": "Model for creating a new instance.",
  "x-generated": "2026-10-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fleetai-com-openapi.yml#/components/schemas/InstanceRequest",
  "properties": {
    "env_key": {
      "type": "string",
      "title": "Env Key"
    },
    "environment_version_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Environment Version Id",
      "description": "Exact immutable environment_versions row to execute. When set, the image and release variables are resolved from that row. Seeds default to the release unless seed_override or seed_config is supplied."
    },
    "env_version": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Env Version"
    },
    "image_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Image Url",
      "description": "Direct Docker image URL to deploy. Mutually exclusive with env_version and deprecated version."
    },
    "review_environment_version_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Review Environment Version Id",
      "description": "Exact Environment release that human reviewers should recreate this instance from, such as the unguarded parent of a guarded eval image. Recorded only; it never changes what this instance runs."
    },
    "data_key": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Data Key"
    },
    "data_version": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Data Version"
    },
    "seed_env_key": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Seed Env Key",
      "description": "Single-app seed artifact directory override for an exact image launch. It must identify the app or its configured seed directory and preserves the app's flat seed mount layout."
    },
    "exact_seed_artifact": {
      "anyOf": [
        {
          "$ref": "#/$defs/ExactSeedArtifact"
        },
        {
          "type": "null"
        }
      ],
      "description": "Fleet-internal exact dev seed materialization grant."
    },
    "multi_app_seed_versions": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Multi App Seed Versions"
    },
    "multi_app_seed_bindings": {
      "anyOf": [
        {
          "additionalProperties": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Multi App Seed Bindings"
    },
    "seed_override": {
      "anyOf": [
        {
          "$ref": "#/$defs/SeedOverride"
        },
        {
          "type": "null"
        }
      ]
    },
    "seed_config": {
      "anyOf": [
        {
          "additionalProperties": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Seed Config",
      "description": "Complete resolved component seed snapshot; null is legacy, {} is seedless."
    },
    "region": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Region",
      "description": "Accepted for backward compatibility and ignored during placement.",
      "default": "us-east-1"
    },
    "cluster_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cluster Name"
    },
    "image_type": {
      "anyOf": [
        {
          "$ref": "#/$defs/ImageType"
        },
        {
          "type": "null"
        }
      ]
    },
    "routing_mode": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Routing Mode"
    },
    "seed": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Seed"
    },
    "timestamp": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Timestamp"
    },
    "p_error": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "P Error"
    },
    "avg_latency": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Avg Latency"
    },
    "run_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Run Id"
    },
    "task_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Task Id"
    },
    "eval_task_version_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Eval Task Version Id",
      "description": "Exact immutable eval_task_versions row whose frozen seeds authorize direct-image multi_app_seed_bindings and whose finalized runtime seed files authorize seed_overlay_files, or whose reference marker pins runtime configuration. Requires task_id."
    },
    "capture_runtime_config": {
      "type": "boolean",
      "title": "Capture Runtime Config",
      "description": "Seal portable launch configuration and expose its digest receipt. Captured instances cannot be redeployed in place. An exact task runtime marker requires capture even when this flag is false.",
      "default": false
    },
    "force_pull": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Force Pull"
    },
    "env_variables": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Env Variables"
    },
    "transient_env_variables": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Transient Env Variables",
      "description": "Fleet-internal runtime variables injected into the container without being stored on the instance record or emitted in lifecycle metadata."
    },
    "profile_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Profile Id"
    },
    "runtime_class": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Runtime Class"
    },
    "created_from": {
      "anyOf": [
        {
          "$ref": "#/$defs/InstanceCreationSource"
        },
        {
          "type": "null"
        }
      ],
      "default": "api"
    },
    "ttl_seconds": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ttl Seconds"
    },
    "heartbeat_interval": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Heartbeat Interval"
    },
    "async_provision": {
      "type": "boolean",
      "title": "Async Provision",
      "default": false
    },
    "max_wait_seconds": {
      "anyOf": [
        {
          "type": "integer",
          "maximum": 3600.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Max Wait Seconds"
    },
    "seed_overlay_files": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/SeedOverlayFileRef"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Seed Overlay Files"
    },
    "restore_snapshot_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Restore Snapshot Id",
      "description": "Snapshot id to restore from while creating the instance."
    },
    "version": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Version"
    }
  },
  "type": "object",
  "required": [
    "env_key"
  ],
  "$defs": {
    "ExactSeedArtifact": {
      "properties": {
        "seed_version_id": {
          "type": "string",
          "title": "Seed Version Id"
        },
        "download_url": {
          "type": "string",
          "title": "Download Url"
        },
        "artifact_sha256": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Artifact Sha256"
        },
        "content_sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "title": "Content Sha256"
        },
        "compression": {
          "type": "string",
          "enum": [
            "none",
            "zstd"
          ],
          "title": "Compression"
        },
        "size_bytes": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 1.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Size Bytes"
        }
      },
      "type": "object",
      "required": [
        "seed_version_id",
        "download_url",
        "content_sha256",
        "compression"
      ],
      "title": "ExactSeedArtifact",
      "description": "Server-resolved immutable seed artifact for one ephemeral direct image."
    },
    "ImageType": {
      "type": "string",
      "enum": [
        "app",
        "browser",
        "computer",
        "mcp"
      ],
      "title": "ImageType"
    },
    "InstanceCreationSource": {
      "type": "string",
      "enum": [
        "sdk",
        "ui",
        "api"
      ],
      "title": "InstanceCreationSource",
      "description": "Source values accepted by PostgreSQL's instance_creation_source enum."
    },
    "SeedOverlayFileRef": {
      "properties": {
        "target_path": {
          "type": "string",
          "title": "Target Path",
          "description": "Relative path under /alloc/data/seed_overlay where file is materialized"
        },
        "s3_key": {
          "type": "string",
          "title": "S3 Key",
          "description": "S3 object key containing file bytes"
        },
        "bucket": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Bucket",
          "description": "Optional source bucket override (defaults to attachments bucket)"
        },
        "sha256": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Sha256",
          "description": "Optional expected downloaded SHA-256; a mismatch aborts startup"
        }
      },
      "type": "object",
      "required": [
        "target_path",
        "s3_key"
      ],
      "title": "SeedOverlayFileRef",
      "description": "Seed overlay artifact to apply during container startup."
    },
    "SeedOverride": {
      "properties": {
        "seed_version_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 32,
          "title": "Seed Version Ids",
          "description": "Complete seed-version selection; an empty list is valid for seedless releases."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "seed_version_ids"
      ],
      "title": "SeedOverride",
      "description": "A complete registered seed set for a pinned environment release."
    }
  }
}