{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cogram-com/json-schema/cogram-com-data-export-create-request-schema.json",
  "title": "DataExportCreateRequest",
  "description": "Body for ``POST /data_exports`` (both UI and external API).\n\nCap rule is **not** enforced by Pydantic — call ``validate_cap_rule()``\nexplicitly from the service so the structured ``CapRuleViolation`` can\npropagate cleanly to the router (Pydantic would otherwise wrap it in a\n``ValidationError`` and surface a 422 with the wrong shape).",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/api.cogram.com-v1-openapi.json#/components/schemas/DataExportCreateRequest",
  "properties": {
    "project_ids": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array",
          "minItems": 1
        },
        {
          "type": "null"
        }
      ],
      "title": "Project Ids",
      "description": "Project KSUIDs to scope the data_export to. Omit for an org-wide data_export, which carries the 6-month cap. Duplicates are collapsed."
    },
    "project_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Project Id",
      "description": "Deprecated single-project form of `project_ids`.",
      "deprecated": true
    },
    "time_filter": {
      "$ref": "#/$defs/TimeFilter",
      "description": "`{mode: range, start, end}` or `{mode: all_time}`. `all_time` is project-scoped only."
    },
    "document_formats": {
      "items": {
        "type": "string",
        "const": "docx"
      },
      "type": "array",
      "title": "Document Formats",
      "description": "Rendered document formats to emit per field report and observation, alongside the JSON. Empty (the default) ships metadata and raw blobs only. Does not affect `meeting.docx`, which every export includes. Rendering makes a build slower and its zip larger."
    }
  },
  "type": "object",
  "required": [
    "time_filter"
  ],
  "$defs": {
    "AllTimeFilter": {
      "properties": {
        "mode": {
          "type": "string",
          "const": "all_time",
          "title": "Mode",
          "default": "all_time"
        }
      },
      "type": "object",
      "title": "AllTimeFilter",
      "description": "All available data, no time bound. Only valid for project-scoped\ndata_exports (one or more ``project_ids``)."
    },
    "TimeFilter": {
      "oneOf": [
        {
          "$ref": "#/$defs/TimeRangeFilter"
        },
        {
          "$ref": "#/$defs/AllTimeFilter"
        }
      ],
      "title": "TimeFilter",
      "description": "Discriminated-union wrapper so the JSONB column can use ``PydanticJsonbType``.\n\nStored shape mirrors ``root`` directly (``RootModel`` serializes without\na wrapping field), e.g. ``{\"mode\": \"range\", \"start\": ..., \"end\": ...}``."
    },
    "TimeRangeFilter": {
      "properties": {
        "mode": {
          "type": "string",
          "const": "range",
          "title": "Mode",
          "default": "range"
        },
        "start": {
          "type": "string",
          "format": "date-time",
          "title": "Start",
          "description": "Inclusive. Must be timezone-aware."
        },
        "end": {
          "type": "string",
          "format": "date-time",
          "title": "End",
          "description": "Inclusive. Must be timezone-aware."
        }
      },
      "type": "object",
      "required": [
        "start",
        "end"
      ],
      "title": "TimeRangeFilter",
      "description": "Closed time range. Both bounds timezone-aware; ``end`` must be >= ``start``."
    }
  }
}