{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/frontapp/json-schema/frontapp-analytics-export-response-schema.json",
  "title": "AnalyticsExportResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/frontapp-analytics-api-openapi.yml#/components/schemas/AnalyticsExportResponse",
  "type": "object",
  "required": [
    "_links",
    "id",
    "status",
    "progress",
    "filters"
  ],
  "properties": {
    "_links": {
      "type": "object",
      "properties": {
        "self": {
          "type": "string",
          "description": "Link to analytics export"
        }
      }
    },
    "id": {
      "type": "string",
      "description": "The public ID of the analytics export"
    },
    "status": {
      "type": "string",
      "enum": [
        "running",
        "done",
        "too_big",
        "failed"
      ],
      "description": "Status of the analytics"
    },
    "progress": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100,
      "description": "Number ranging from 0 to 100 corresponding to the percentage of the analytics processed."
    },
    "url": {
      "type": "string",
      "description": "The URL from which the export data can be downloaded. Only displays after you make a GET request to the link included in the POST response."
    },
    "filename": {
      "type": "string",
      "description": "The filename of the export with extension included. Only displays after you make a GET request to the link included in the POST response."
    },
    "size": {
      "type": [
        "number",
        "null"
      ],
      "description": "Size (in bytes) of the export data. Only displays after you make a GET request to the link included in the POST response."
    },
    "created_at": {
      "type": "number",
      "description": "Timestamp (in seconds) at which the export was requested."
    },
    "filters": {
      "$ref": "#/$defs/AnalyticsFilters"
    }
  },
  "$defs": {
    "AccountIds": {
      "type": "object",
      "required": [
        "account_ids"
      ],
      "properties": {
        "account_ids": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ResourceID"
          }
        }
      }
    },
    "AnalyticsFilters": {
      "description": "Resources to compute the analytics for. Defaults to all.",
      "anyOf": [
        {
          "$ref": "#/$defs/TagIds"
        },
        {
          "$ref": "#/$defs/TeammateIds"
        },
        {
          "$ref": "#/$defs/ChannelIds"
        },
        {
          "$ref": "#/$defs/InboxIds"
        },
        {
          "$ref": "#/$defs/TeamIds"
        },
        {
          "$ref": "#/$defs/AccountIds"
        }
      ]
    },
    "ChannelIds": {
      "type": "object",
      "required": [
        "channel_ids"
      ],
      "properties": {
        "channel_ids": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ResourceID"
          }
        }
      }
    },
    "InboxIds": {
      "type": "object",
      "required": [
        "inbox_ids"
      ],
      "properties": {
        "inbox_ids": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ResourceID"
          }
        }
      }
    },
    "ResourceID": {
      "type": "string"
    },
    "TagIds": {
      "type": "object",
      "required": [
        "tag_ids"
      ],
      "properties": {
        "tag_ids": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ResourceID"
          }
        }
      }
    },
    "TeamIds": {
      "type": "object",
      "required": [
        "team_ids"
      ],
      "properties": {
        "team_ids": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ResourceID"
          }
        }
      }
    },
    "TeammateIds": {
      "type": "object",
      "required": [
        "teammate_ids"
      ],
      "properties": {
        "teammate_ids": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ResourceID"
          }
        }
      }
    }
  }
}