{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/spacecontext-app/json-schema/spacecontext-app-scan-schema.json",
  "title": "Scan",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/spacecontext-app-openapi.json#/components/schemas/Scan",
  "type": "object",
  "required": [
    "object",
    "id",
    "space_id",
    "livemode",
    "status",
    "stage",
    "input",
    "charge",
    "error",
    "upload",
    "created_at",
    "started_at",
    "completed_at"
  ],
  "properties": {
    "object": {
      "type": "string",
      "const": "scan"
    },
    "id": {
      "type": "string",
      "pattern": "^scn_[0-9a-f]{32}$"
    },
    "space_id": {
      "type": "string"
    },
    "livemode": {
      "type": "boolean"
    },
    "status": {
      "type": "string",
      "enum": [
        "awaiting_upload",
        "queued",
        "processing",
        "complete",
        "failed",
        "cancelled"
      ]
    },
    "stage": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "ingesting",
        "screening",
        "observing",
        "fusing",
        "enriching",
        "saving",
        "verifying",
        null
      ]
    },
    "input": {
      "type": "object",
      "required": [
        "kind",
        "language",
        "frame_count",
        "video",
        "has_transcript"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "frames",
            "video"
          ]
        },
        "language": {
          "type": "string",
          "enum": [
            "en",
            "it",
            "es",
            "fr",
            "de",
            "pt",
            "nl"
          ],
          "description": "The language the report is written in."
        },
        "frame_count": {
          "type": [
            "integer",
            "null"
          ]
        },
        "video": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "content_type": {
              "type": "string"
            },
            "content_length": {
              "type": "integer"
            }
          }
        },
        "has_transcript": {
          "type": "boolean"
        }
      }
    },
    "charge": {
      "type": "object",
      "required": [
        "kind",
        "price_cents",
        "refunded"
      ],
      "properties": {
        "kind": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "free_scan",
            "scan_charge",
            null
          ]
        },
        "price_cents": {
          "type": "integer"
        },
        "refunded": {
          "type": "boolean"
        }
      }
    },
    "error": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    },
    "upload": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "frames",
            "video"
          ]
        },
        "method": {
          "type": "string",
          "const": "PUT"
        },
        "url": {
          "type": "string"
        },
        "url_template": {
          "type": "string"
        },
        "headers": {
          "type": "object",
          "description": "Headers the PUT must carry. Content-Length must equal the declared size (HTTP clients set it from the body).",
          "additionalProperties": {
            "type": "string"
          }
        },
        "frame_count": {
          "type": "integer"
        },
        "max_bytes": {
          "type": "integer"
        },
        "content_types": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "expires_at": {
          "type": "string",
          "format": "date-time",
          "description": "Direct upload links only: the link must be used (the PUT started) within 15 minutes; an upload begun in time completes. Past it, `GET /scans/{id}` (with `scans:write`) gives a fresh link while the scan waits for its upload."
        }
      }
    },
    "created_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "started_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "completed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    }
  }
}