{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usewrit-app/json-schema/usewrit-app-file-list-schema.json",
  "title": "FileList",
  "description": "`{data, count}` list envelope.",
  "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/FileList",
  "type": "object",
  "required": [
    "data",
    "count"
  ],
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/StoredFile"
      }
    },
    "count": {
      "type": "integer"
    }
  },
  "$defs": {
    "StoredFile": {
      "type": "object",
      "description": "OpenAI-style file handle (`api/v1/files.rs::WireStoredFile`). Note `bytes` (not `size_bytes`) and `created_at` as UNIX epoch SECONDS (not RFC3339).",
      "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`."
        }
      }
    }
  }
}