{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usewrit-app/json-schema/usewrit-app-stored-file-schema.json",
  "title": "StoredFile",
  "description": "OpenAI-style file handle (`api/v1/files.rs::WireStoredFile`). Note `bytes` (not `size_bytes`) and `created_at` as UNIX epoch SECONDS (not RFC3339).",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/usewrit-app-files-api-openapi.yml#/components/schemas/StoredFile",
  "type": "object",
  "required": [
    "id",
    "object",
    "filename",
    "content_type",
    "bytes",
    "created_at",
    "status",
    "source",
    "purpose"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "`file_<hex>` handle id."
    },
    "object": {
      "type": "string",
      "const": "file"
    },
    "filename": {
      "type": "string"
    },
    "content_type": {
      "type": "string"
    },
    "bytes": {
      "type": "integer",
      "format": "int64",
      "description": "Size in bytes."
    },
    "created_at": {
      "type": "integer",
      "format": "int64",
      "description": "UNIX epoch seconds (0 when the stored timestamp is malformed)."
    },
    "status": {
      "type": "string"
    },
    "source": {
      "type": "string",
      "enum": [
        "upload",
        "api",
        "workflow_output"
      ]
    },
    "purpose": {
      "type": "string",
      "description": "Defaults to `user_data`."
    }
  }
}