{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/scale-ai/json-schema/scale-ai-file-entity-schema.json",
  "title": "FileEntity",
  "description": "Represents a file in the Document Understanding Core.\nBased on https://docs.google.com/document/d/1nB0SqUGTuIBiNMzLVfLW5NWSEZrcgEaXtzRessQgAPo/edit?tab=t.0#bookmark=id.ne9tup4c49z5",
  "x-generated": "2026-10-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/scale-ai-document-understanding-openapi.yml#/components/schemas/FileEntity",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id",
      "description": "ID of the entity"
    },
    "project_id": {
      "type": "string",
      "title": "Project Id",
      "description": "ID of the project"
    },
    "object": {
      "anyOf": [
        {
          "type": "string",
          "const": "file"
        },
        {
          "type": "null"
        }
      ],
      "title": "Object",
      "default": "file"
    },
    "filename": {
      "type": "string",
      "title": "Filename"
    },
    "path": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Path"
    },
    "size_bytes": {
      "type": "integer",
      "title": "Size Bytes"
    },
    "mime_type": {
      "type": "string",
      "title": "Mime Type"
    },
    "status": {
      "$ref": "#/$defs/FileStatus"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "storage_key": {
      "type": "string",
      "title": "Storage Key"
    },
    "external_data_source_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "External Data Source Id"
    },
    "external_file_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "External File Id"
    },
    "external_etag": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "External Etag"
    },
    "external_content_hash": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "External Content Hash"
    },
    "external_deleted_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "External Deleted At"
    },
    "external_sync_status": {
      "anyOf": [
        {
          "$ref": "#/$defs/ExternalSyncStatus"
        },
        {
          "type": "null"
        }
      ]
    },
    "external_sync_error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "External Sync Error"
    }
  },
  "type": "object",
  "required": [
    "id",
    "project_id",
    "filename",
    "size_bytes",
    "mime_type",
    "status",
    "created_at",
    "storage_key"
  ],
  "$defs": {
    "ExternalSyncStatus": {
      "type": "string",
      "enum": [
        "pending",
        "processing",
        "retrying",
        "failed",
        "synced"
      ],
      "title": "ExternalSyncStatus"
    },
    "FileStatus": {
      "type": "string",
      "enum": [
        "uploading",
        "uploaded",
        "failed",
        "deleted"
      ],
      "title": "FileStatus"
    }
  }
}