{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/frontapp/json-schema/frontapp-analytics-report-request-schema.json",
  "title": "AnalyticsReportRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/frontapp-analytics-api-openapi.yml#/components/schemas/AnalyticsReportRequest",
  "properties": {
    "start": {
      "type": "number",
      "description": "Start time of the data to include in the export (seconds since 1970-01-01T00:00:00+00). Will be rounded down to the start of the day."
    },
    "end": {
      "type": "number",
      "description": "End time of the data to include in the export (seconds since 1970-01-01T00:00:00+00). Will be rounded up to the end of the day."
    },
    "timezone": {
      "type": "string",
      "description": "[IANA name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) of the timezone to format the dates with. If omitted, the export will use Etc/UTC."
    },
    "filters": {
      "$ref": "#/$defs/AnalyticsFilters"
    },
    "metrics": {
      "type": "array",
      "description": "List of the metrics required.",
      "items": {
        "$ref": "#/$defs/AnalyticsMetricId"
      }
    }
  },
  "required": [
    "start",
    "end",
    "metrics"
  ],
  "$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"
        }
      ]
    },
    "AnalyticsMetricId": {
      "type": "string",
      "enum": [
        "avg_csat_survey_response",
        "avg_first_reaction_time",
        "avg_first_response_time",
        "avg_handle_time",
        "avg_reaction_time",
        "avg_replies_to_resolution",
        "avg_resolution_time",
        "avg_response_time",
        "avg_sla_breach_time",
        "avg_tag_duration",
        "avg_total_reply_time",
        "new_segments_count",
        "num_active_accounts",
        "num_active_segments_full",
        "num_active_teammates",
        "num_archived_segments",
        "num_archived_segments_with_reply",
        "num_assigned_segments",
        "num_csat_survey_response",
        "num_messages_received",
        "num_messages_sent",
        "num_new_tasks",
        "num_non_replies_sent",
        "num_replies_sent",
        "num_segments_with_outbounds",
        "num_segments_with_tag_changes",
        "num_sla_breach",
        "num_tags_added",
        "num_tags_removed",
        "num_touched_segments",
        "pct_csat_survey_satisfaction",
        "pct_messages_with_message_templates",
        "pct_resolved_on_first_reply",
        "pct_tagged_conversations",
        "num_closed_segments",
        "num_open_segments_start",
        "num_open_segments_end",
        "num_resolved_segments",
        "num_unresolved_active_segments",
        "num_workload_segments"
      ]
    },
    "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"
          }
        }
      }
    }
  }
}