{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/telnyx/main/json-schema/telnyx-mdr-detailed-request-schema.json",
  "title": "MdrDetailedRequest",
  "description": "Request object for MDR detailed report",
  "x-generated": "2026-10-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/telnyx-mdr-detailed-reports-api-openapi.yml#/components/schemas/MdrDetailedRequest",
  "properties": {
    "connections": {
      "description": "List of connections to filter by",
      "items": {
        "format": "int64",
        "type": "integer"
      },
      "type": "array"
    },
    "directions": {
      "description": "List of directions to filter by (Inbound = 1, Outbound = 2)",
      "items": {
        "format": "int32",
        "type": "integer"
      },
      "type": "array"
    },
    "end_time": {
      "description": "End time in ISO format. Note: If end time includes the last 4 hours, some MDRs might not appear in this report, due to wait time for downstream message delivery confirmation",
      "format": "date-time",
      "type": "string"
    },
    "filters": {
      "description": "List of filters to apply",
      "items": {
        "$ref": "#/$defs/Filter"
      },
      "type": "array"
    },
    "include_message_body": {
      "description": "Whether to include message body in the report",
      "type": "boolean"
    },
    "managed_accounts": {
      "description": "List of managed accounts to include",
      "items": {
        "format": "uuid",
        "type": "string"
      },
      "type": "array"
    },
    "profiles": {
      "description": "List of messaging profile IDs to filter by",
      "items": {
        "format": "uuid",
        "type": "string"
      },
      "type": "array"
    },
    "record_types": {
      "description": "List of record types to filter by (Complete = 1, Incomplete = 2, Errors = 3)",
      "items": {
        "format": "int32",
        "type": "integer"
      },
      "type": "array"
    },
    "report_name": {
      "description": "Name of the report",
      "type": "string"
    },
    "select_all_managed_accounts": {
      "description": "Whether to select all managed accounts",
      "type": "boolean"
    },
    "start_time": {
      "description": "Start time in ISO format",
      "format": "date-time",
      "type": "string"
    },
    "timezone": {
      "description": "Timezone for the report",
      "type": "string"
    }
  },
  "required": [
    "start_time",
    "end_time"
  ],
  "type": "object",
  "$defs": {
    "Filter": {
      "description": "Query filter criteria. Note: The first filter object must specify filter_type as 'and'. You cannot follow an 'or' with another 'and'.",
      "properties": {
        "billing_group": {
          "description": "Billing group UUID to filter by",
          "type": "string"
        },
        "cld": {
          "description": "Called line identification (destination number)",
          "type": "string"
        },
        "cld_filter": {
          "description": "Filter type for CLD matching",
          "enum": [
            "contains",
            "starts_with",
            "ends_with"
          ],
          "type": "string"
        },
        "cli": {
          "description": "Calling line identification (caller ID)",
          "type": "string"
        },
        "cli_filter": {
          "description": "Filter type for CLI matching",
          "enum": [
            "contains",
            "starts_with",
            "ends_with"
          ],
          "type": "string"
        },
        "filter_type": {
          "description": "Logical operator for combining filters",
          "enum": [
            "and",
            "or"
          ],
          "type": "string"
        },
        "tags_list": {
          "description": "Tag name to filter by",
          "type": "string"
        }
      },
      "type": "object"
    }
  }
}