# DEX ## Domain Types ### Digital Experience Monitor - `class DigitalExperienceMonitor: …` - `id: str` API Resource UUID tag. - `default: bool` Whether the policy is the default for the account. - `name: str` ### Network Path - `class NetworkPath: …` - `slots: List[Slot]` - `id: str` API Resource UUID tag. - `client_to_app_rtt_ms: Optional[int]` Round trip time in ms of the client to app mile - `client_to_cf_egress_rtt_ms: Optional[int]` Round trip time in ms of the client to Cloudflare egress mile - `client_to_cf_ingress_rtt_ms: Optional[int]` Round trip time in ms of the client to Cloudflare ingress mile - `timestamp: str` - `client_to_isp_rtt_ms: Optional[int]` Round trip time in ms of the client to ISP mile - `sampling: Optional[Sampling]` Specifies the sampling applied, if any, to the slots response. When sampled, results shown represent the first test run to the start of each sampling interval. - `unit: Literal["hours"]` - `"hours"` - `value: int` ### Network Path Response - `class NetworkPathResponse: …` - `id: str` API Resource UUID tag. - `device_name: Optional[str]` Name of the device that ran the test. - `interval: Optional[str]` The interval at which the Traceroute synthetic application test is set to run. - `kind: Optional[Literal["traceroute"]]` - `"traceroute"` - `name: Optional[str]` - `network_path: Optional[NetworkPath]` - `slots: List[Slot]` - `id: str` API Resource UUID tag. - `client_to_app_rtt_ms: Optional[int]` Round trip time in ms of the client to app mile - `client_to_cf_egress_rtt_ms: Optional[int]` Round trip time in ms of the client to Cloudflare egress mile - `client_to_cf_ingress_rtt_ms: Optional[int]` Round trip time in ms of the client to Cloudflare ingress mile - `timestamp: str` - `client_to_isp_rtt_ms: Optional[int]` Round trip time in ms of the client to ISP mile - `sampling: Optional[Sampling]` Specifies the sampling applied, if any, to the slots response. When sampled, results shown represent the first test run to the start of each sampling interval. - `unit: Literal["hours"]` - `"hours"` - `value: int` - `url: Optional[str]` The host of the Traceroute synthetic application test. ### Percentiles - `class Percentiles: …` - `p50: Optional[float]` p50 observed in the time period. - `p90: Optional[float]` p90 observed in the time period. - `p95: Optional[float]` p95 observed in the time period. - `p99: Optional[float]` p99 observed in the time period. # WARP Change Events ## List WARP change events. `zero_trust.dex.warp_change_events.get(WARPChangeEventGetParams**kwargs) -> WARPChangeEventGetResponse` **get** `/accounts/{account_id}/dex/warp-change-events` List WARP configuration and enablement toggle change events by device. ### Parameters - `account_id: str` Unique identifier linked to an account. - `from_: str` Start time for the query in ISO (RFC3339 - ISO 8601) format. - `page: float` Page number of paginated results. - `per_page: float` Number of results per page. - `to: str` End time for the query in ISO (RFC3339 - ISO 8601) format. - `account_name: Optional[str]` Filter events by account name. - `config_name: Optional[str]` Filter events by WARP configuration name changed from or to. Applicable to type='config' events only. - `sort_order: Optional[Literal["ASC", "DESC"]]` Sort response by event timestamp. - `"ASC"` - `"DESC"` - `toggle: Optional[Literal["on", "off"]]` Filter events by type toggle value. Applicable to type='toggle' events only. - `"on"` - `"off"` - `type: Optional[Literal["config", "toggle"]]` Filter events by type 'config' or 'toggle'. - `"config"` - `"toggle"` ### Returns - `List[WARPChangeEventGetResponseItem]` - `class WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPToggleChangeEvent: …` - `account_name: Optional[str]` The account name. - `account_tag: Optional[str]` The public account identifier. - `device_id: Optional[str]` The device ID. - `device_registration: Optional[str]` Deprecated: use registration_id. The device registration ID. - `hostname: Optional[str]` The hostname of the machine the event is from. - `registration_id: Optional[str]` The device registration ID. - `serial_number: Optional[str]` The serial number of the machine the event is from. - `timestamp: Optional[datetime]` The event time. - `toggle: Optional[Literal["on", "off"]]` The state of the WARP toggle. - `"on"` - `"off"` - `user_email: Optional[str]` Email tied to the device. - `class WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEvent: …` - `device_id: Optional[str]` The device ID. - `device_registration: Optional[str]` Deprecated: use registration_id. The device registration ID. - `from_: Optional[WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEventFrom]` The details for the WARP configuration that was switched from. - `account_name: Optional[str]` The account name. - `account_tag: Optional[str]` The public account identifier. - `config_name: Optional[str]` The name of the WARP configuration. - `hostname: Optional[str]` The hostname of the machine the event is from. - `registration_id: Optional[str]` The device registration ID. - `serial_number: Optional[str]` The serial number of the machine the event is from. - `timestamp: Optional[datetime]` The event time. - `to: Optional[WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEventTo]` The details for the WARP configuration that was switched to. - `account_name: Optional[str]` The account name. - `account_tag: Optional[str]` The public account identifier. - `config_name: Optional[str]` The name of the WARP configuration. - `user_email: Optional[str]` Email tied to the device. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) warp_change_events = client.zero_trust.dex.warp_change_events.get( account_id="01a7362d577a6c3019a474fd6f485823", from_="2023-09-20T17:00:00Z", page=1, per_page=10, to="2023-09-20T17:00:00Z", ) print(warp_change_events) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "account_name": "account_name", "account_tag": "account_tag", "device_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "device_registration": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "hostname": "hostname", "registration_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "serial_number": "serial_number", "timestamp": "2023-10-11T00:00:00Z", "toggle": "on", "user_email": "user_email" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Domain Types ### WARP Change Event Get Response - `List[WARPChangeEventGetResponseItem]` - `class WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPToggleChangeEvent: …` - `account_name: Optional[str]` The account name. - `account_tag: Optional[str]` The public account identifier. - `device_id: Optional[str]` The device ID. - `device_registration: Optional[str]` Deprecated: use registration_id. The device registration ID. - `hostname: Optional[str]` The hostname of the machine the event is from. - `registration_id: Optional[str]` The device registration ID. - `serial_number: Optional[str]` The serial number of the machine the event is from. - `timestamp: Optional[datetime]` The event time. - `toggle: Optional[Literal["on", "off"]]` The state of the WARP toggle. - `"on"` - `"off"` - `user_email: Optional[str]` Email tied to the device. - `class WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEvent: …` - `device_id: Optional[str]` The device ID. - `device_registration: Optional[str]` Deprecated: use registration_id. The device registration ID. - `from_: Optional[WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEventFrom]` The details for the WARP configuration that was switched from. - `account_name: Optional[str]` The account name. - `account_tag: Optional[str]` The public account identifier. - `config_name: Optional[str]` The name of the WARP configuration. - `hostname: Optional[str]` The hostname of the machine the event is from. - `registration_id: Optional[str]` The device registration ID. - `serial_number: Optional[str]` The serial number of the machine the event is from. - `timestamp: Optional[datetime]` The event time. - `to: Optional[WARPChangeEventGetResponseItemDigitalExperienceMonitoringWARPConfigChangeEventTo]` The details for the WARP configuration that was switched to. - `account_name: Optional[str]` The account name. - `account_tag: Optional[str]` The public account identifier. - `config_name: Optional[str]` The name of the WARP configuration. - `user_email: Optional[str]` Email tied to the device. # Commands ## List account commands `zero_trust.dex.commands.list(CommandListParams**kwargs) -> SyncV4PagePagination[Optional[CommandListResponse]]` **get** `/accounts/{account_id}/dex/commands` Retrieves a paginated list of commands issued to devices under the specified account, optionally filtered by time range, device, or other parameters ### Parameters - `account_id: str` Unique identifier linked to an account. - `page: float` Page number of paginated results. - `per_page: float` Number of results per page. - `command_type: Optional[Literal["pcap", "speed-test", "warp-diag"]]` Optionally filter executed commands by command type. - `"pcap"` - `"speed-test"` - `"warp-diag"` - `device_id: Optional[str]` Unique identifier for a device. - `from_: Optional[Union[str, datetime]]` Start time for the query in ISO (RFC3339 - ISO 8601) format. - `status: Optional[Literal["PENDING_EXEC", "PENDING_UPLOAD", "SUCCESS", "FAILED"]]` Optionally filter executed commands by status. - `"PENDING_EXEC"` - `"PENDING_UPLOAD"` - `"SUCCESS"` - `"FAILED"` - `to: Optional[Union[str, datetime]]` End time for the query in ISO (RFC3339 - ISO 8601) format. - `user_email: Optional[str]` Email tied to the device. ### Returns - `class CommandListResponse: …` - `commands: Optional[List[Command]]` - `id: Optional[str]` - `completed_date: Optional[datetime]` - `created_date: Optional[datetime]` - `device_id: Optional[str]` - `filename: Optional[str]` - `registration_id: Optional[str]` Unique identifier for the device registration - `status: Optional[str]` - `type: Optional[str]` - `user_email: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.dex.commands.list( account_id="01a7362d577a6c3019a474fd6f485823", page=1, per_page=10, ) page = page.result.items[0] print(page.commands) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "commands": [ { "id": "id", "completed_date": "2019-12-27T18:11:19.117Z", "created_date": "2019-12-27T18:11:19.117Z", "device_id": "device_id", "filename": "filename", "registration_id": "registration_id", "status": "status", "type": "type", "user_email": "user_email" } ] }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Create account commands `zero_trust.dex.commands.create(CommandCreateParams**kwargs) -> CommandCreateResponse` **post** `/accounts/{account_id}/dex/commands` Initiate commands for up to 10 devices per account. ### Parameters - `account_id: str` Unique identifier linked to an account. - `commands: Iterable[Command]` List of device-level commands to execute - `device_id: str` Unique identifier for the physical device - `type: Literal["pcap", "speed-test", "warp-diag"]` Type of command to execute on the device - `"pcap"` - `"speed-test"` - `"warp-diag"` - `user_email: str` Email tied to the device - `args: Optional[CommandArgs]` Command arguments. Allowed fields depend on `type`. - `class CommandArgsWARPDiagArgs: …` - `test_all_routes: Optional[bool]` Test an IP address from all included or excluded ranges. Essentially the same as running 'route get ' and collecting the results. This option may increase the time taken to collect the warp-diag. - `class CommandArgsPCAPArgs: …` - `max_file_size_mb: Optional[float]` Maximum file size (in MB) for the capture file. If the capture artifact exceeds the specified max file size, it will NOT be uploaded. - `packet_size_bytes: Optional[float]` Maximum number of bytes to save for each packet - `time_limit_min: Optional[float]` Limit on capture duration (in minutes) - `class CommandArgsSpeedTestArgs: …` - `interfaces: Optional[List[Literal["default", "tunnel"]]]` List of interfaces to run the speed test on - `"default"` - `"tunnel"` - `registration_id: Optional[str]` Unique identifier for the device registration. Required for multi-user devices to target the correct user session. ### Returns - `class CommandCreateResponse: …` - `commands: Optional[List[Command]]` List of created commands - `id: Optional[str]` Unique identifier for the command - `args: Optional[Dict[str, str]]` Command arguments - `device_id: Optional[str]` Identifier for the device associated with the command - `registration_id: Optional[str]` Unique identifier for the device registration - `status: Optional[Literal["PENDING_EXEC", "PENDING_UPLOAD", "SUCCESS", "FAILED"]]` Current status of the command - `"PENDING_EXEC"` - `"PENDING_UPLOAD"` - `"SUCCESS"` - `"FAILED"` - `type: Optional[str]` Type of the command (e.g., "pcap", "speed-test", or "warp-diag") ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) command = client.zero_trust.dex.commands.create( account_id="01a7362d577a6c3019a474fd6f485823", commands=[{ "device_id": "device_id", "type": "pcap", "user_email": "user_email", }], ) print(command.commands) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "commands": [ { "id": "id", "args": { "foo": "string" }, "device_id": "device_id", "registration_id": "registration_id", "status": "PENDING_EXEC", "type": "type" } ] }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Domain Types ### Command List Response - `class CommandListResponse: …` - `commands: Optional[List[Command]]` - `id: Optional[str]` - `completed_date: Optional[datetime]` - `created_date: Optional[datetime]` - `device_id: Optional[str]` - `filename: Optional[str]` - `registration_id: Optional[str]` Unique identifier for the device registration - `status: Optional[str]` - `type: Optional[str]` - `user_email: Optional[str]` ### Command Create Response - `class CommandCreateResponse: …` - `commands: Optional[List[Command]]` List of created commands - `id: Optional[str]` Unique identifier for the command - `args: Optional[Dict[str, str]]` Command arguments - `device_id: Optional[str]` Identifier for the device associated with the command - `registration_id: Optional[str]` Unique identifier for the device registration - `status: Optional[Literal["PENDING_EXEC", "PENDING_UPLOAD", "SUCCESS", "FAILED"]]` Current status of the command - `"PENDING_EXEC"` - `"PENDING_UPLOAD"` - `"SUCCESS"` - `"FAILED"` - `type: Optional[str]` Type of the command (e.g., "pcap", "speed-test", or "warp-diag") # Devices ## List devices eligible for remote captures `zero_trust.dex.commands.devices.list(DeviceListParams**kwargs) -> SyncV4PagePagination[Optional[DeviceListResponse]]` **get** `/accounts/{account_id}/dex/commands/devices` List devices with WARP client support for remote captures which have been connected in the last 1 hour. ### Parameters - `account_id: str` Unique identifier linked to an account. - `page: float` Page number of paginated results. - `per_page: float` Number of results per page. - `search: Optional[str]` Filter devices by name or email. ### Returns - `class DeviceListResponse: …` - `devices: Optional[List[Device]]` List of eligible devices - `device_id: Optional[str]` Device identifier (UUID v4) - `device_name: Optional[str]` Device identifier (human readable) - `eligible: Optional[bool]` Whether the device is eligible for remote captures - `ineligible_reason: Optional[str]` If the device is not eligible, the reason why. - `person_email: Optional[str]` User contact email address - `platform: Optional[str]` Operating system. - `registration_id: Optional[str]` Device registration identifier (UUID v4). On multi-user devices, this uniquely identifies a user's registration on the device. - `status: Optional[str]` Network status. - `timestamp: Optional[str]` - `version: Optional[str]` WARP client version. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.dex.commands.devices.list( account_id="01a7362d577a6c3019a474fd6f485823", page=1, per_page=10, ) page = page.result.items[0] print(page.devices) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "devices": [ { "deviceId": "deviceId", "deviceName": "deviceName", "eligible": true, "ineligibleReason": "ineligibleReason", "personEmail": "personEmail", "platform": "windows", "registrationId": "registrationId", "status": "connected", "timestamp": "2023-10-11 00:00:00+00", "version": "1.0.0" } ] }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Domain Types ### Device List Response - `class DeviceListResponse: …` - `devices: Optional[List[Device]]` List of eligible devices - `device_id: Optional[str]` Device identifier (UUID v4) - `device_name: Optional[str]` Device identifier (human readable) - `eligible: Optional[bool]` Whether the device is eligible for remote captures - `ineligible_reason: Optional[str]` If the device is not eligible, the reason why. - `person_email: Optional[str]` User contact email address - `platform: Optional[str]` Operating system. - `registration_id: Optional[str]` Device registration identifier (UUID v4). On multi-user devices, this uniquely identifies a user's registration on the device. - `status: Optional[str]` Network status. - `timestamp: Optional[str]` - `version: Optional[str]` WARP client version. # Downloads ## Download command output file `zero_trust.dex.commands.downloads.get(strfilename, DownloadGetParams**kwargs) -> BinaryResponseContent` **get** `/accounts/{account_id}/dex/commands/{command_id}/downloads/{filename}` Downloads artifacts for an executed command. Bulk downloads are not supported ### Parameters - `account_id: str` Unique identifier linked to an account. - `command_id: str` Unique identifier for a command - `filename: str` ### Returns - `BinaryResponseContent` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) download = client.zero_trust.dex.commands.downloads.get( filename="filename", account_id="01a7362d577a6c3019a474fd6f485823", command_id="5758fefe-ae7e-4538-a39b-1fef6abcb909", ) print(download) content = download.read() print(content) ``` # Quota ## Returns account commands usage, quota, and reset time `zero_trust.dex.commands.quota.get(QuotaGetParams**kwargs) -> QuotaGetResponse` **get** `/accounts/{account_id}/dex/commands/quota` Retrieves the current quota usage and limits for device commands within a specific account, including the time when the quota will reset ### Parameters - `account_id: str` Unique identifier linked to an account. ### Returns - `class QuotaGetResponse: …` - `quota: float` The total number of commands that can be initiated for an account. - `quota_usage: float` The number of commands that have been initiated for an account. - `reset_time: datetime` The time when the quota resets. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) quota = client.zero_trust.dex.commands.quota.get( account_id="01a7362d577a6c3019a474fd6f485823", ) print(quota.quota) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "quota": 0, "quota_usage": 0, "reset_time": "2019-12-27T18:11:19.117Z" }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Domain Types ### Quota Get Response - `class QuotaGetResponse: …` - `quota: float` The total number of commands that can be initiated for an account. - `quota_usage: float` The number of commands that have been initiated for an account. - `reset_time: datetime` The time when the quota resets. # Colos ## List Cloudflare colos `zero_trust.dex.colos.list(ColoListParams**kwargs) -> SyncSinglePage[ColoListResponse]` **get** `/accounts/{account_id}/dex/colos` List Cloudflare colos that account's devices were connected to during a time period, sorted by usage starting from the most used colo. Colos without traffic are also returned and sorted alphabetically. ### Parameters - `account_id: str` Unique identifier linked to an account. - `from_: str` Start time for connection period in ISO (RFC3339 - ISO 8601) format. - `to: str` End time for connection period in ISO (RFC3339 - ISO 8601) format. - `sort_by: Optional[Literal["fleet-status-usage", "application-tests-usage"]]` Type of usage that colos should be sorted by. If unspecified, returns all Cloudflare colos sorted alphabetically. - `"fleet-status-usage"` - `"application-tests-usage"` ### Returns - `class ColoListResponse: …` - `airport_code: str` Airport code - `city: str` City - `country_code: str` Country code ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.dex.colos.list( account_id="01a7362d577a6c3019a474fd6f485823", from_="2023-08-20T20:45:00Z", to="2023-08-24T20:45:00Z", ) page = page.result[0] print(page.airport_code) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "airportCode": "SFO", "city": "San Francisco", "countryCode": "US" } ] } ``` ## Domain Types ### Colo List Response - `class ColoListResponse: …` - `airport_code: str` Airport code - `city: str` City - `country_code: str` Country code # Fleet Status ## Get live aggregate device details by dimension `zero_trust.dex.fleet_status.live(FleetStatusLiveParams**kwargs) -> FleetStatusLiveResponse` **get** `/accounts/{account_id}/dex/fleet-status/live` Get details for live (up to 60 minutes) devices using WARP. ### Parameters - `account_id: str` Unique identifier linked to an account. - `since_minutes: float` Number of minutes before current time. ### Returns - `class FleetStatusLiveResponse: …` - `device_stats: Optional[DeviceStats]` - `by_colo: Optional[List[LiveStat]]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `by_mode: Optional[List[LiveStat]]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `by_platform: Optional[List[LiveStat]]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `by_status: Optional[List[LiveStat]]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `by_version: Optional[List[LiveStat]]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `unique_devices_total: Optional[float]` Number of unique devices ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.zero_trust.dex.fleet_status.live( account_id="01a7362d577a6c3019a474fd6f485823", since_minutes=10, ) print(response.device_stats) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "deviceStats": { "byColo": [ { "uniqueDevicesTotal": 0, "value": "value" } ], "byMode": [ { "uniqueDevicesTotal": 0, "value": "value" } ], "byPlatform": [ { "uniqueDevicesTotal": 0, "value": "value" } ], "byStatus": [ { "uniqueDevicesTotal": 0, "value": "value" } ], "byVersion": [ { "uniqueDevicesTotal": 0, "value": "value" } ], "uniqueDevicesTotal": 0 } } } ``` ## Get over time aggregate details for devices by dimension `zero_trust.dex.fleet_status.over_time(FleetStatusOverTimeParams**kwargs) -> FleetStatusOverTimeResponse` **get** `/accounts/{account_id}/dex/fleet-status/over-time` Get aggregate details for devices using WARP, up to 7 days. ### Parameters - `account_id: str` Unique identifier linked to an account. - `from_: str` Start of the time range to query. Timestamp can be provided in ISO 8601 datetime format or milliseconds since epoch. - `to: str` End of the time range to query. Timestamp can be provided in ISO 8601 datetime format or milliseconds since epoch. - `colo: Optional[str]` Cloudflare colo airport code. - `device_id: Optional[str]` Device-specific ID, given as UUID. ### Returns - `class FleetStatusOverTimeResponse: …` - `device_stats: Optional[DeviceStats]` - `by_mode: Optional[List[DeviceStatsByMode]]` - `timestamp: Optional[str]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `by_status: Optional[List[DeviceStatsByStatus]]` - `timestamp: Optional[str]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `unique_devices_total: Optional[float]` Number of unique devices ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.zero_trust.dex.fleet_status.over_time( account_id="01a7362d577a6c3019a474fd6f485823", from_="2023-10-11 00:00:00+00", to="2023-10-11 00:00:00+00", ) print(response.device_stats) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "deviceStats": { "byMode": [ { "timestamp": "2023-10-11 00:00:00+00", "uniqueDevicesTotal": 0, "value": "value" } ], "byStatus": [ { "timestamp": "2023-10-11 00:00:00+00", "uniqueDevicesTotal": 0, "value": "value" } ], "uniqueDevicesTotal": 0 } } } ``` ## Domain Types ### Live Stat - `class LiveStat: …` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` ### Fleet Status Live Response - `class FleetStatusLiveResponse: …` - `device_stats: Optional[DeviceStats]` - `by_colo: Optional[List[LiveStat]]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `by_mode: Optional[List[LiveStat]]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `by_platform: Optional[List[LiveStat]]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `by_status: Optional[List[LiveStat]]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `by_version: Optional[List[LiveStat]]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `unique_devices_total: Optional[float]` Number of unique devices ### Fleet Status Over Time Response - `class FleetStatusOverTimeResponse: …` - `device_stats: Optional[DeviceStats]` - `by_mode: Optional[List[DeviceStatsByMode]]` - `timestamp: Optional[str]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `by_status: Optional[List[DeviceStatsByStatus]]` - `timestamp: Optional[str]` - `unique_devices_total: Optional[float]` Number of unique devices - `value: Optional[str]` - `unique_devices_total: Optional[float]` Number of unique devices # Devices ## List details of devices using WARP. `zero_trust.dex.fleet_status.devices.list(DeviceListParams**kwargs) -> SyncV4PagePaginationArray[DeviceListResponse]` **get** `/accounts/{account_id}/dex/fleet-status/devices` List details of devices using WARP. ### Parameters - `account_id: str` Unique identifier linked to an account. - `from_: str` Start of the time range to query. Timestamp can be provided in ISO 8601 datetime format or milliseconds since epoch. - `page: float` Page number of paginated results. - `per_page: float` Number of results per page. - `to: str` End of the time range to query. Timestamp can be provided in ISO 8601 datetime format or milliseconds since epoch. - `colo: Optional[str]` Cloudflare colo airport code. - `device_id: Optional[str]` Device-specific ID, given as UUID. - `mode: Optional[str]` The mode under which the WARP client is run. - `platform: Optional[str]` Operating system. - `sort_by: Optional[Literal["colo", "device_id", "mode", 4 more]]` Dimension to sort results by. - `"colo"` - `"device_id"` - `"mode"` - `"platform"` - `"status"` - `"timestamp"` - `"version"` - `source: Optional[Literal["last_seen", "hourly", "raw"]]` Source: * `hourly` - device details aggregated hourly, up to 7 days prior * `last_seen` - device details, up to 60 minutes prior. Time windows exceeding 60 minutes will be rejected from June 1st, 2026. Please use 'hourly' or 'raw' instead for longer time ranges. * `raw` - device details, up to 7 days prior - `"last_seen"` - `"hourly"` - `"raw"` - `status: Optional[str]` Network status. - `version: Optional[str]` WARP client version. ### Returns - `class DeviceListResponse: …` - `colo: str` Cloudflare colo airport code. - `device_id: str` Device identifier (UUID v4) - `mode: str` The mode under which the WARP client is run. - `platform: str` Operating system. - `status: str` Network status. - `timestamp: str` - `version: str` WARP client version. - `always_on: Optional[bool]` - `battery_charging: Optional[bool]` - `battery_cycles: Optional[int]` - `battery_pct: Optional[float]` - `connection_type: Optional[str]` - `cpu_pct: Optional[float]` - `cpu_pct_by_app: Optional[List[CPUPctByApp]]` - `cpu_pct: Optional[float]` CPU usage percentage, on a scale of 0 to 100. - `name: Optional[str]` Application name. - `device_ipv4: Optional[DeviceIPV4]` - `address: Optional[str]` - `asn: Optional[int]` - `aso: Optional[str]` - `location: Optional[DeviceIPV4Location]` - `city: Optional[str]` - `country_iso: Optional[str]` - `state_iso: Optional[str]` - `zip: Optional[str]` - `name: Optional[str]` - `netmask: Optional[str]` - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `device_ipv6: Optional[DeviceIPV6]` - `address: Optional[str]` - `asn: Optional[int]` - `aso: Optional[str]` - `location: Optional[DeviceIPV6Location]` - `city: Optional[str]` - `country_iso: Optional[str]` - `state_iso: Optional[str]` - `zip: Optional[str]` - `name: Optional[str]` - `netmask: Optional[str]` - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `device_name: Optional[str]` Device identifier (human readable). - `device_registration: Optional[str]` Deprecated: use registrationId. Device registration identifier (UUID). - `disk_read_bps: Optional[int]` - `disk_usage_pct: Optional[float]` - `disk_write_bps: Optional[int]` - `doh_subdomain: Optional[str]` - `estimated_loss_pct: Optional[float]` - `firewall_enabled: Optional[bool]` - `gateway_ipv4: Optional[GatewayIPV4]` - `address: Optional[str]` - `asn: Optional[int]` - `aso: Optional[str]` - `location: Optional[GatewayIPV4Location]` - `city: Optional[str]` - `country_iso: Optional[str]` - `state_iso: Optional[str]` - `zip: Optional[str]` - `name: Optional[str]` - `netmask: Optional[str]` - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `gateway_ipv6: Optional[GatewayIPV6]` - `address: Optional[str]` - `asn: Optional[int]` - `aso: Optional[str]` - `location: Optional[GatewayIPV6Location]` - `city: Optional[str]` - `country_iso: Optional[str]` - `state_iso: Optional[str]` - `zip: Optional[str]` - `name: Optional[str]` - `netmask: Optional[str]` - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `handshake_latency_ms: Optional[float]` - `isp_ipv4: Optional[ISPIPV4]` - `address: Optional[str]` - `asn: Optional[int]` - `aso: Optional[str]` - `location: Optional[ISPIPV4Location]` - `city: Optional[str]` - `country_iso: Optional[str]` - `state_iso: Optional[str]` - `zip: Optional[str]` - `name: Optional[str]` - `netmask: Optional[str]` - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `isp_ipv6: Optional[ISPIPV6]` - `address: Optional[str]` - `asn: Optional[int]` - `aso: Optional[str]` - `location: Optional[ISPIPV6Location]` - `city: Optional[str]` - `country_iso: Optional[str]` - `state_iso: Optional[str]` - `zip: Optional[str]` - `name: Optional[str]` - `netmask: Optional[str]` - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `metal: Optional[str]` - `network_rcvd_bps: Optional[int]` - `network_sent_bps: Optional[int]` - `network_ssid: Optional[str]` - `person_email: Optional[str]` User contact email address - `ram_available_kb: Optional[int]` - `ram_used_pct: Optional[float]` - `ram_used_pct_by_app: Optional[List[RamUsedPctByApp]]` - `name: Optional[str]` Application name. - `ram_used_pct: Optional[float]` RAM usage percentage, on a scale of 0 to 100. - `registration_id: Optional[str]` Device registration identifier (UUID v4). On multi-user devices, this uniquely identifies a user's registration on the device. - `rtt: Optional[RTT]` Round-trip time statistics for the WARP tunnel. - `min_rtt_us: Optional[RTTMinRTTUs]` Minimum round-trip time in microseconds. - `downstream: Optional[int]` - `upstream: Optional[int]` - `rtt_us: Optional[RTTRTTUs]` Round-trip time in microseconds. - `downstream: Optional[int]` - `upstream: Optional[int]` - `rtt_var_us: Optional[RTTRTTVarUs]` Round-trip time variance in microseconds. - `downstream: Optional[int]` - `upstream: Optional[int]` - `switch_locked: Optional[bool]` - `tunnel_stats: Optional[TunnelStats]` WARP tunnel packet and byte counters. - `bytes_lost: Optional[TunnelStatsBytesLost]` Number of bytes lost, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `bytes_received: Optional[TunnelStatsBytesReceived]` Number of bytes received, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `bytes_retransmitted: Optional[TunnelStatsBytesRetransmitted]` Number of bytes retransmitted, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `bytes_sent: Optional[TunnelStatsBytesSent]` Number of bytes sent, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `packets_lost: Optional[TunnelStatsPacketsLost]` Number of packets lost, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `packets_received: Optional[TunnelStatsPacketsReceived]` Number of packets received, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `packets_retransmitted: Optional[TunnelStatsPacketsRetransmitted]` Number of packets retransmitted, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `packets_sent: Optional[TunnelStatsPacketsSent]` Number of packets sent, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `stats_window_ms: Optional[int]` The measurement window duration in milliseconds. - `tunnel_type: Optional[str]` - `wifi_strength_dbm: Optional[int]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.dex.fleet_status.devices.list( account_id="01a7362d577a6c3019a474fd6f485823", from_="2023-10-11 00:00:00+00", page=1, per_page=10, to="2023-10-11 00:00:00+00", ) page = page.result[0] print(page.network_ssid) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "colo": "SJC", "deviceId": "deviceId", "mode": "proxy", "platform": "windows", "status": "connected", "timestamp": "2023-10-11 00:00:00+00", "version": "1.0.0", "alwaysOn": true, "batteryCharging": true, "batteryCycles": 0, "batteryPct": 0, "connectionType": "connectionType", "cpuPct": 0, "cpuPctByApp": [ { "cpu_pct": 0, "name": "name" } ], "deviceIpv4": { "address": "address", "asn": 0, "aso": "aso", "location": { "city": "city", "country_iso": "country_iso", "state_iso": "state_iso", "zip": "zip" }, "name": "name", "netmask": "netmask", "version": 1 }, "deviceIpv6": { "address": "address", "asn": 0, "aso": "aso", "location": { "city": "city", "country_iso": "country_iso", "state_iso": "state_iso", "zip": "zip" }, "name": "name", "netmask": "netmask", "version": 1 }, "deviceName": "deviceName", "deviceRegistration": "deviceRegistration", "diskReadBps": 0, "diskUsagePct": 0, "diskWriteBps": 0, "dohSubdomain": "dohSubdomain", "estimatedLossPct": 0, "firewallEnabled": true, "gatewayIpv4": { "address": "address", "asn": 0, "aso": "aso", "location": { "city": "city", "country_iso": "country_iso", "state_iso": "state_iso", "zip": "zip" }, "name": "name", "netmask": "netmask", "version": 1 }, "gatewayIpv6": { "address": "address", "asn": 0, "aso": "aso", "location": { "city": "city", "country_iso": "country_iso", "state_iso": "state_iso", "zip": "zip" }, "name": "name", "netmask": "netmask", "version": 1 }, "handshakeLatencyMs": 0, "ispIpv4": { "address": "address", "asn": 0, "aso": "aso", "location": { "city": "city", "country_iso": "country_iso", "state_iso": "state_iso", "zip": "zip" }, "name": "name", "netmask": "netmask", "version": 1 }, "ispIpv6": { "address": "address", "asn": 0, "aso": "aso", "location": { "city": "city", "country_iso": "country_iso", "state_iso": "state_iso", "zip": "zip" }, "name": "name", "netmask": "netmask", "version": 1 }, "metal": "metal", "networkRcvdBps": 0, "networkSentBps": 0, "networkSsid": "networkSsid", "personEmail": "personEmail", "ramAvailableKb": 0, "ramUsedPct": 0, "ramUsedPctByApp": [ { "name": "name", "ram_used_pct": 0 } ], "registrationId": "registrationId", "rtt": { "minRttUs": { "downstream": 0, "upstream": 0 }, "rttUs": { "downstream": 0, "upstream": 0 }, "rttVarUs": { "downstream": 0, "upstream": 0 } }, "switchLocked": true, "tunnelStats": { "bytesLost": { "downstream": 0, "upstream": 0 }, "bytesReceived": { "downstream": 0, "upstream": 0 }, "bytesRetransmitted": { "downstream": 0, "upstream": 0 }, "bytesSent": { "downstream": 0, "upstream": 0 }, "packetsLost": { "downstream": 0, "upstream": 0 }, "packetsReceived": { "downstream": 0, "upstream": 0 }, "packetsRetransmitted": { "downstream": 0, "upstream": 0 }, "packetsSent": { "downstream": 0, "upstream": 0 }, "statsWindowMs": 0 }, "tunnelType": "tunnelType", "wifiStrengthDbm": 0 } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Domain Types ### Device List Response - `class DeviceListResponse: …` - `colo: str` Cloudflare colo airport code. - `device_id: str` Device identifier (UUID v4) - `mode: str` The mode under which the WARP client is run. - `platform: str` Operating system. - `status: str` Network status. - `timestamp: str` - `version: str` WARP client version. - `always_on: Optional[bool]` - `battery_charging: Optional[bool]` - `battery_cycles: Optional[int]` - `battery_pct: Optional[float]` - `connection_type: Optional[str]` - `cpu_pct: Optional[float]` - `cpu_pct_by_app: Optional[List[CPUPctByApp]]` - `cpu_pct: Optional[float]` CPU usage percentage, on a scale of 0 to 100. - `name: Optional[str]` Application name. - `device_ipv4: Optional[DeviceIPV4]` - `address: Optional[str]` - `asn: Optional[int]` - `aso: Optional[str]` - `location: Optional[DeviceIPV4Location]` - `city: Optional[str]` - `country_iso: Optional[str]` - `state_iso: Optional[str]` - `zip: Optional[str]` - `name: Optional[str]` - `netmask: Optional[str]` - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `device_ipv6: Optional[DeviceIPV6]` - `address: Optional[str]` - `asn: Optional[int]` - `aso: Optional[str]` - `location: Optional[DeviceIPV6Location]` - `city: Optional[str]` - `country_iso: Optional[str]` - `state_iso: Optional[str]` - `zip: Optional[str]` - `name: Optional[str]` - `netmask: Optional[str]` - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `device_name: Optional[str]` Device identifier (human readable). - `device_registration: Optional[str]` Deprecated: use registrationId. Device registration identifier (UUID). - `disk_read_bps: Optional[int]` - `disk_usage_pct: Optional[float]` - `disk_write_bps: Optional[int]` - `doh_subdomain: Optional[str]` - `estimated_loss_pct: Optional[float]` - `firewall_enabled: Optional[bool]` - `gateway_ipv4: Optional[GatewayIPV4]` - `address: Optional[str]` - `asn: Optional[int]` - `aso: Optional[str]` - `location: Optional[GatewayIPV4Location]` - `city: Optional[str]` - `country_iso: Optional[str]` - `state_iso: Optional[str]` - `zip: Optional[str]` - `name: Optional[str]` - `netmask: Optional[str]` - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `gateway_ipv6: Optional[GatewayIPV6]` - `address: Optional[str]` - `asn: Optional[int]` - `aso: Optional[str]` - `location: Optional[GatewayIPV6Location]` - `city: Optional[str]` - `country_iso: Optional[str]` - `state_iso: Optional[str]` - `zip: Optional[str]` - `name: Optional[str]` - `netmask: Optional[str]` - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `handshake_latency_ms: Optional[float]` - `isp_ipv4: Optional[ISPIPV4]` - `address: Optional[str]` - `asn: Optional[int]` - `aso: Optional[str]` - `location: Optional[ISPIPV4Location]` - `city: Optional[str]` - `country_iso: Optional[str]` - `state_iso: Optional[str]` - `zip: Optional[str]` - `name: Optional[str]` - `netmask: Optional[str]` - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `isp_ipv6: Optional[ISPIPV6]` - `address: Optional[str]` - `asn: Optional[int]` - `aso: Optional[str]` - `location: Optional[ISPIPV6Location]` - `city: Optional[str]` - `country_iso: Optional[str]` - `state_iso: Optional[str]` - `zip: Optional[str]` - `name: Optional[str]` - `netmask: Optional[str]` - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). - `metal: Optional[str]` - `network_rcvd_bps: Optional[int]` - `network_sent_bps: Optional[int]` - `network_ssid: Optional[str]` - `person_email: Optional[str]` User contact email address - `ram_available_kb: Optional[int]` - `ram_used_pct: Optional[float]` - `ram_used_pct_by_app: Optional[List[RamUsedPctByApp]]` - `name: Optional[str]` Application name. - `ram_used_pct: Optional[float]` RAM usage percentage, on a scale of 0 to 100. - `registration_id: Optional[str]` Device registration identifier (UUID v4). On multi-user devices, this uniquely identifies a user's registration on the device. - `rtt: Optional[RTT]` Round-trip time statistics for the WARP tunnel. - `min_rtt_us: Optional[RTTMinRTTUs]` Minimum round-trip time in microseconds. - `downstream: Optional[int]` - `upstream: Optional[int]` - `rtt_us: Optional[RTTRTTUs]` Round-trip time in microseconds. - `downstream: Optional[int]` - `upstream: Optional[int]` - `rtt_var_us: Optional[RTTRTTVarUs]` Round-trip time variance in microseconds. - `downstream: Optional[int]` - `upstream: Optional[int]` - `switch_locked: Optional[bool]` - `tunnel_stats: Optional[TunnelStats]` WARP tunnel packet and byte counters. - `bytes_lost: Optional[TunnelStatsBytesLost]` Number of bytes lost, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `bytes_received: Optional[TunnelStatsBytesReceived]` Number of bytes received, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `bytes_retransmitted: Optional[TunnelStatsBytesRetransmitted]` Number of bytes retransmitted, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `bytes_sent: Optional[TunnelStatsBytesSent]` Number of bytes sent, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `packets_lost: Optional[TunnelStatsPacketsLost]` Number of packets lost, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `packets_received: Optional[TunnelStatsPacketsReceived]` Number of packets received, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `packets_retransmitted: Optional[TunnelStatsPacketsRetransmitted]` Number of packets retransmitted, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `packets_sent: Optional[TunnelStatsPacketsSent]` Number of packets sent, split by direction. - `downstream: Optional[int]` - `upstream: Optional[int]` - `stats_window_ms: Optional[int]` The measurement window duration in milliseconds. - `tunnel_type: Optional[str]` - `wifi_strength_dbm: Optional[int]` # HTTP Tests ## Get details and aggregate metrics for an http test `zero_trust.dex.http_tests.get(strtest_id, HTTPTestGetParams**kwargs) -> HTTPDetails` **get** `/accounts/{account_id}/dex/http-tests/{test_id}` Get test details and aggregate performance metrics for an http test for a given time period between 1 hour and 7 days. ### Parameters - `account_id: str` Unique identifier linked to an account. - `test_id: str` API Resource UUID tag. - `from_: str` Start time for aggregate metrics in ISO ms. - `interval: Literal["minute", "hour"]` Time interval for aggregate time slots. - `"minute"` - `"hour"` - `to: str` End time for aggregate metrics in ISO ms. - `colo: Optional[str]` Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. - `device_id: Optional[Sequence[str]]` Optionally filter result stats to a specific device(s). Cannot be used in combination with colo param. ### Returns - `class HTTPDetails: …` - `host: Optional[str]` The url of the HTTP synthetic application test. - `http_stats: Optional[HTTPStats]` - `availability_pct: HTTPStatsAvailabilityPct` - `slots: List[HTTPStatsAvailabilityPctSlot]` - `timestamp: str` - `value: float` - `avg: Optional[float]` average observed in the time period. - `max: Optional[float]` highest observed in the time period. - `min: Optional[float]` lowest observed in the time period. - `dns_response_time_ms: TestStatOverTime` - `slots: List[Slot]` - `timestamp: str` - `value: int` - `avg: Optional[int]` average observed in the time period. - `max: Optional[int]` highest observed in the time period. - `min: Optional[int]` lowest observed in the time period. - `http_status_code: List[HTTPStatsHTTPStatusCode]` - `status200: int` - `status300: int` - `status400: int` - `status500: int` - `timestamp: str` - `resource_fetch_time_ms: TestStatOverTime` - `server_response_time_ms: TestStatOverTime` - `unique_devices_total: int` Count of unique devices that have run this test in the given time period. - `http_stats_by_colo: Optional[List[HTTPStatsByColo]]` - `availability_pct: HTTPStatsByColoAvailabilityPct` - `slots: List[HTTPStatsByColoAvailabilityPctSlot]` - `timestamp: str` - `value: float` - `avg: Optional[float]` average observed in the time period. - `max: Optional[float]` highest observed in the time period. - `min: Optional[float]` lowest observed in the time period. - `colo: str` - `dns_response_time_ms: TestStatOverTime` - `http_status_code: List[HTTPStatsByColoHTTPStatusCode]` - `status200: int` - `status300: int` - `status400: int` - `status500: int` - `timestamp: str` - `resource_fetch_time_ms: TestStatOverTime` - `server_response_time_ms: TestStatOverTime` - `unique_devices_total: int` Count of unique devices that have run this test in the given time period. - `interval: Optional[str]` The interval at which the HTTP synthetic application test is set to run. - `kind: Optional[Literal["http"]]` - `"http"` - `method: Optional[str]` The HTTP method to use when running the test. - `name: Optional[str]` The name of the HTTP synthetic application test. - `target_policies: Optional[List[DigitalExperienceMonitor]]` - `id: str` API Resource UUID tag. - `default: bool` Whether the policy is the default for the account. - `name: str` - `targeted: Optional[bool]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) http_details = client.zero_trust.dex.http_tests.get( test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", from_="1689520412000", interval="minute", to="1689606812000", ) print(http_details.host) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "host": "http://example.com", "httpStats": { "availabilityPct": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "dnsResponseTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "httpStatusCode": [ { "status200": 0, "status300": 0, "status400": 0, "status500": 0, "timestamp": "2023-07-16 15:00:00+00" } ], "resourceFetchTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "serverResponseTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "uniqueDevicesTotal": 57 }, "httpStatsByColo": [ { "availabilityPct": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "colo": "DFW", "dnsResponseTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "httpStatusCode": [ { "status200": 0, "status300": 0, "status400": 0, "status500": 0, "timestamp": "2023-07-16 15:00:00+00" } ], "resourceFetchTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "serverResponseTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "uniqueDevicesTotal": 57 } ], "interval": "0h5m0s", "kind": "http", "method": "GET", "name": "Atlassian Sign In Page", "target_policies": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "default": true, "name": "name" } ], "targeted": true } } ``` ## Domain Types ### HTTP Details - `class HTTPDetails: …` - `host: Optional[str]` The url of the HTTP synthetic application test. - `http_stats: Optional[HTTPStats]` - `availability_pct: HTTPStatsAvailabilityPct` - `slots: List[HTTPStatsAvailabilityPctSlot]` - `timestamp: str` - `value: float` - `avg: Optional[float]` average observed in the time period. - `max: Optional[float]` highest observed in the time period. - `min: Optional[float]` lowest observed in the time period. - `dns_response_time_ms: TestStatOverTime` - `slots: List[Slot]` - `timestamp: str` - `value: int` - `avg: Optional[int]` average observed in the time period. - `max: Optional[int]` highest observed in the time period. - `min: Optional[int]` lowest observed in the time period. - `http_status_code: List[HTTPStatsHTTPStatusCode]` - `status200: int` - `status300: int` - `status400: int` - `status500: int` - `timestamp: str` - `resource_fetch_time_ms: TestStatOverTime` - `server_response_time_ms: TestStatOverTime` - `unique_devices_total: int` Count of unique devices that have run this test in the given time period. - `http_stats_by_colo: Optional[List[HTTPStatsByColo]]` - `availability_pct: HTTPStatsByColoAvailabilityPct` - `slots: List[HTTPStatsByColoAvailabilityPctSlot]` - `timestamp: str` - `value: float` - `avg: Optional[float]` average observed in the time period. - `max: Optional[float]` highest observed in the time period. - `min: Optional[float]` lowest observed in the time period. - `colo: str` - `dns_response_time_ms: TestStatOverTime` - `http_status_code: List[HTTPStatsByColoHTTPStatusCode]` - `status200: int` - `status300: int` - `status400: int` - `status500: int` - `timestamp: str` - `resource_fetch_time_ms: TestStatOverTime` - `server_response_time_ms: TestStatOverTime` - `unique_devices_total: int` Count of unique devices that have run this test in the given time period. - `interval: Optional[str]` The interval at which the HTTP synthetic application test is set to run. - `kind: Optional[Literal["http"]]` - `"http"` - `method: Optional[str]` The HTTP method to use when running the test. - `name: Optional[str]` The name of the HTTP synthetic application test. - `target_policies: Optional[List[DigitalExperienceMonitor]]` - `id: str` API Resource UUID tag. - `default: bool` Whether the policy is the default for the account. - `name: str` - `targeted: Optional[bool]` # Percentiles ## Get percentiles for an http test `zero_trust.dex.http_tests.percentiles.get(strtest_id, PercentileGetParams**kwargs) -> HTTPDetailsPercentiles` **get** `/accounts/{account_id}/dex/http-tests/{test_id}/percentiles` Get percentiles for an http test for a given time period between 1 hour and 7 days. ### Parameters - `account_id: str` Unique identifier linked to an account. - `test_id: str` API Resource UUID tag. - `from_: str` Start time for the query in ISO (RFC3339 - ISO 8601) format. - `to: str` End time for the query in ISO (RFC3339 - ISO 8601) format. - `colo: Optional[str]` Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. - `device_id: Optional[Sequence[str]]` Optionally filter result stats to a specific device(s). Cannot be used in combination with colo param. ### Returns - `class HTTPDetailsPercentiles: …` - `dns_response_time_ms: Optional[Percentiles]` - `p50: Optional[float]` p50 observed in the time period. - `p90: Optional[float]` p90 observed in the time period. - `p95: Optional[float]` p95 observed in the time period. - `p99: Optional[float]` p99 observed in the time period. - `resource_fetch_time_ms: Optional[Percentiles]` - `server_response_time_ms: Optional[Percentiles]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) http_details_percentiles = client.zero_trust.dex.http_tests.percentiles.get( test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", from_="2023-09-20T17:00:00Z", to="2023-09-20T17:00:00Z", ) print(http_details_percentiles.dns_response_time_ms) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "dnsResponseTimeMs": { "p50": 0, "p90": 0, "p95": 0, "p99": 0 }, "resourceFetchTimeMs": { "p50": 0, "p90": 0, "p95": 0, "p99": 0 }, "serverResponseTimeMs": { "p50": 0, "p90": 0, "p95": 0, "p99": 0 } } } ``` ## Domain Types ### HTTP Details Percentiles - `class HTTPDetailsPercentiles: …` - `dns_response_time_ms: Optional[Percentiles]` - `p50: Optional[float]` p50 observed in the time period. - `p90: Optional[float]` p90 observed in the time period. - `p95: Optional[float]` p95 observed in the time period. - `p99: Optional[float]` p99 observed in the time period. - `resource_fetch_time_ms: Optional[Percentiles]` - `server_response_time_ms: Optional[Percentiles]` ### Test Stat Over Time - `class TestStatOverTime: …` - `slots: List[Slot]` - `timestamp: str` - `value: int` - `avg: Optional[int]` average observed in the time period. - `max: Optional[int]` highest observed in the time period. - `min: Optional[int]` lowest observed in the time period. # Tests ## List DEX test analytics `zero_trust.dex.tests.list(TestListParams**kwargs) -> SyncV4PagePagination[Optional[Tests]]` **get** `/accounts/{account_id}/dex/tests/overview` List DEX tests with overview metrics. ### Parameters - `account_id: str` Unique identifier linked to an account. - `colo: Optional[str]` Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. - `device_id: Optional[Sequence[str]]` Optionally filter result stats to a specific device(s). Cannot be used in combination with colo param. - `kind: Optional[Literal["http", "traceroute"]]` Filter by test type. - `"http"` - `"traceroute"` - `page: Optional[float]` Page number of paginated results - `per_page: Optional[float]` Number of items per page - `registration_id: Optional[str]` Optionally filter results to a specific device registration. Must be used in combination with a single deviceId. - `test_name: Optional[str]` Optionally filter results by test name. ### Returns - `class Tests: …` - `overview_metrics: OverviewMetrics` - `tests_total: int` number of tests. - `avg_http_availability_pct: Optional[float]` percentage availability for all HTTP test results in response. - `avg_traceroute_availability_pct: Optional[float]` percentage availability for all traceroutes results in response. - `tests: List[Test]` array of test results objects. - `id: str` API Resource UUID tag. - `created: str` date the test was created. - `description: str` the test description defined during configuration - `enabled: bool` if true, then the test will run on targeted devices. Else, the test will not run. - `host: str` - `interval: str` The interval at which the synthetic application test is set to run. - `kind: Literal["http", "traceroute"]` test type, http or traceroute - `"http"` - `"traceroute"` - `name: str` name given to this test - `updated: str` - `http_results: Optional[TestHTTPResults]` - `resource_fetch_time: TestHTTPResultsResourceFetchTime` - `history: List[TestHTTPResultsResourceFetchTimeHistory]` - `time_period: AggregateTimePeriod` - `units: Literal["hours", "days", "testRuns"]` - `"hours"` - `"days"` - `"testRuns"` - `value: int` - `avg_ms: Optional[int]` - `delta_pct: Optional[float]` - `avg_ms: Optional[int]` - `over_time: Optional[TestHTTPResultsResourceFetchTimeOverTime]` - `time_period: AggregateTimePeriod` - `values: List[TestHTTPResultsResourceFetchTimeOverTimeValue]` - `avg_ms: int` - `timestamp: str` - `http_results_by_colo: Optional[List[TestHTTPResultsByColo]]` - `colo: str` Cloudflare colo - `resource_fetch_time: TestHTTPResultsByColoResourceFetchTime` - `history: List[TestHTTPResultsByColoResourceFetchTimeHistory]` - `time_period: AggregateTimePeriod` - `avg_ms: Optional[int]` - `delta_pct: Optional[float]` - `avg_ms: Optional[int]` - `over_time: Optional[TestHTTPResultsByColoResourceFetchTimeOverTime]` - `time_period: AggregateTimePeriod` - `values: List[TestHTTPResultsByColoResourceFetchTimeOverTimeValue]` - `avg_ms: int` - `timestamp: str` - `method: Optional[str]` for HTTP, the method to use when running the test - `target_policies: Optional[List[DigitalExperienceMonitor]]` - `id: str` API Resource UUID tag. - `default: bool` Whether the policy is the default for the account. - `name: str` - `targeted: Optional[bool]` - `traceroute_results: Optional[TestTracerouteResults]` - `round_trip_time: TestTracerouteResultsRoundTripTime` - `history: List[TestTracerouteResultsRoundTripTimeHistory]` - `time_period: AggregateTimePeriod` - `avg_ms: Optional[int]` - `delta_pct: Optional[float]` - `avg_ms: Optional[int]` - `over_time: Optional[TestTracerouteResultsRoundTripTimeOverTime]` - `time_period: AggregateTimePeriod` - `values: List[TestTracerouteResultsRoundTripTimeOverTimeValue]` - `avg_ms: int` - `timestamp: str` - `traceroute_results_by_colo: Optional[List[TestTracerouteResultsByColo]]` - `colo: str` Cloudflare colo - `round_trip_time: TestTracerouteResultsByColoRoundTripTime` - `history: List[TestTracerouteResultsByColoRoundTripTimeHistory]` - `time_period: AggregateTimePeriod` - `avg_ms: Optional[int]` - `delta_pct: Optional[float]` - `avg_ms: Optional[int]` - `over_time: Optional[TestTracerouteResultsByColoRoundTripTimeOverTime]` - `time_period: AggregateTimePeriod` - `values: List[TestTracerouteResultsByColoRoundTripTimeOverTimeValue]` - `avg_ms: int` - `timestamp: str` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.dex.tests.list( account_id="01a7362d577a6c3019a474fd6f485823", ) page = page.result.items[0] print(page.overview_metrics) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "overviewMetrics": { "testsTotal": 0, "avgHttpAvailabilityPct": 0, "avgTracerouteAvailabilityPct": 0 }, "tests": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created": "created", "description": "description", "enabled": true, "host": "host", "interval": "interval", "kind": "http", "name": "name", "updated": "updated", "httpResults": { "resourceFetchTime": { "history": [ { "timePeriod": { "units": "hours", "value": 0 }, "avgMs": 0, "deltaPct": 0 } ], "avgMs": 0, "overTime": { "timePeriod": { "units": "hours", "value": 0 }, "values": [ { "avgMs": 0, "timestamp": "timestamp" } ] } } }, "httpResultsByColo": [ { "colo": "SJC", "resourceFetchTime": { "history": [ { "timePeriod": { "units": "hours", "value": 0 }, "avgMs": 0, "deltaPct": 0 } ], "avgMs": 0, "overTime": { "timePeriod": { "units": "hours", "value": 0 }, "values": [ { "avgMs": 0, "timestamp": "timestamp" } ] } } } ], "method": "method", "target_policies": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "default": true, "name": "name" } ], "targeted": true, "tracerouteResults": { "roundTripTime": { "history": [ { "timePeriod": { "units": "hours", "value": 0 }, "avgMs": 0, "deltaPct": 0 } ], "avgMs": 0, "overTime": { "timePeriod": { "units": "hours", "value": 0 }, "values": [ { "avgMs": 0, "timestamp": "timestamp" } ] } } }, "tracerouteResultsByColo": [ { "colo": "SJC", "roundTripTime": { "history": [ { "timePeriod": { "units": "hours", "value": 0 }, "avgMs": 0, "deltaPct": 0 } ], "avgMs": 0, "overTime": { "timePeriod": { "units": "hours", "value": 0 }, "values": [ { "avgMs": 0, "timestamp": "timestamp" } ] } } } ] } ] } } ``` ## Domain Types ### Aggregate Time Period - `class AggregateTimePeriod: …` - `units: Literal["hours", "days", "testRuns"]` - `"hours"` - `"days"` - `"testRuns"` - `value: int` ### Tests - `class Tests: …` - `overview_metrics: OverviewMetrics` - `tests_total: int` number of tests. - `avg_http_availability_pct: Optional[float]` percentage availability for all HTTP test results in response. - `avg_traceroute_availability_pct: Optional[float]` percentage availability for all traceroutes results in response. - `tests: List[Test]` array of test results objects. - `id: str` API Resource UUID tag. - `created: str` date the test was created. - `description: str` the test description defined during configuration - `enabled: bool` if true, then the test will run on targeted devices. Else, the test will not run. - `host: str` - `interval: str` The interval at which the synthetic application test is set to run. - `kind: Literal["http", "traceroute"]` test type, http or traceroute - `"http"` - `"traceroute"` - `name: str` name given to this test - `updated: str` - `http_results: Optional[TestHTTPResults]` - `resource_fetch_time: TestHTTPResultsResourceFetchTime` - `history: List[TestHTTPResultsResourceFetchTimeHistory]` - `time_period: AggregateTimePeriod` - `units: Literal["hours", "days", "testRuns"]` - `"hours"` - `"days"` - `"testRuns"` - `value: int` - `avg_ms: Optional[int]` - `delta_pct: Optional[float]` - `avg_ms: Optional[int]` - `over_time: Optional[TestHTTPResultsResourceFetchTimeOverTime]` - `time_period: AggregateTimePeriod` - `values: List[TestHTTPResultsResourceFetchTimeOverTimeValue]` - `avg_ms: int` - `timestamp: str` - `http_results_by_colo: Optional[List[TestHTTPResultsByColo]]` - `colo: str` Cloudflare colo - `resource_fetch_time: TestHTTPResultsByColoResourceFetchTime` - `history: List[TestHTTPResultsByColoResourceFetchTimeHistory]` - `time_period: AggregateTimePeriod` - `avg_ms: Optional[int]` - `delta_pct: Optional[float]` - `avg_ms: Optional[int]` - `over_time: Optional[TestHTTPResultsByColoResourceFetchTimeOverTime]` - `time_period: AggregateTimePeriod` - `values: List[TestHTTPResultsByColoResourceFetchTimeOverTimeValue]` - `avg_ms: int` - `timestamp: str` - `method: Optional[str]` for HTTP, the method to use when running the test - `target_policies: Optional[List[DigitalExperienceMonitor]]` - `id: str` API Resource UUID tag. - `default: bool` Whether the policy is the default for the account. - `name: str` - `targeted: Optional[bool]` - `traceroute_results: Optional[TestTracerouteResults]` - `round_trip_time: TestTracerouteResultsRoundTripTime` - `history: List[TestTracerouteResultsRoundTripTimeHistory]` - `time_period: AggregateTimePeriod` - `avg_ms: Optional[int]` - `delta_pct: Optional[float]` - `avg_ms: Optional[int]` - `over_time: Optional[TestTracerouteResultsRoundTripTimeOverTime]` - `time_period: AggregateTimePeriod` - `values: List[TestTracerouteResultsRoundTripTimeOverTimeValue]` - `avg_ms: int` - `timestamp: str` - `traceroute_results_by_colo: Optional[List[TestTracerouteResultsByColo]]` - `colo: str` Cloudflare colo - `round_trip_time: TestTracerouteResultsByColoRoundTripTime` - `history: List[TestTracerouteResultsByColoRoundTripTimeHistory]` - `time_period: AggregateTimePeriod` - `avg_ms: Optional[int]` - `delta_pct: Optional[float]` - `avg_ms: Optional[int]` - `over_time: Optional[TestTracerouteResultsByColoRoundTripTimeOverTime]` - `time_period: AggregateTimePeriod` - `values: List[TestTracerouteResultsByColoRoundTripTimeOverTimeValue]` - `avg_ms: int` - `timestamp: str` # Unique Devices ## Get count of devices targeted `zero_trust.dex.tests.unique_devices.list(UniqueDeviceListParams**kwargs) -> UniqueDevices` **get** `/accounts/{account_id}/dex/tests/unique-devices` Returns unique count of devices that have run synthetic application monitoring tests in the past 7 days. ### Parameters - `account_id: str` Unique identifier linked to an account. - `device_id: Optional[Sequence[str]]` Optionally filter result stats to a specific device(s). Cannot be used in combination with colo param. - `test_name: Optional[str]` Optionally filter results by test name. ### Returns - `class UniqueDevices: …` - `unique_devices_total: int` total number of unique devices ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) unique_devices = client.zero_trust.dex.tests.unique_devices.list( account_id="01a7362d577a6c3019a474fd6f485823", ) print(unique_devices.unique_devices_total) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "uniqueDevicesTotal": 0 } } ``` ## Domain Types ### Unique Devices - `class UniqueDevices: …` - `unique_devices_total: int` total number of unique devices # Traceroute Test Results # Network Path ## Get details for a specific traceroute test run `zero_trust.dex.traceroute_test_results.network_path.get(strtest_result_id, NetworkPathGetParams**kwargs) -> NetworkPathGetResponse` **get** `/accounts/{account_id}/dex/traceroute-test-results/{test_result_id}/network-path` Get a breakdown of hops and performance metrics for a specific traceroute test run ### Parameters - `account_id: str` Unique identifier linked to an account. - `test_result_id: str` API Resource UUID tag. ### Returns - `class NetworkPathGetResponse: …` - `hops: List[Hop]` An array of the hops taken by the device to reach the end destination. - `ttl: int` - `asn: Optional[int]` - `aso: Optional[str]` - `ip_address: Optional[str]` - `location: Optional[HopLocation]` - `city: Optional[str]` - `state: Optional[str]` - `zip: Optional[str]` - `mile: Optional[Literal["client-to-app", "client-to-cf-egress", "client-to-cf-ingress", "client-to-isp"]]` - `"client-to-app"` - `"client-to-cf-egress"` - `"client-to-cf-ingress"` - `"client-to-isp"` - `name: Optional[str]` - `packet_loss_pct: Optional[float]` - `rtt_ms: Optional[int]` - `result_id: str` API Resource UUID tag. - `colo: Optional[str]` Cloudflare colo airport code. - `device_name: Optional[str]` Name of the device associated with this network path response. - `execution_context: Optional[Literal["EXECUTION_CONTEXT_INVALID", "OUT_OF_TUNNEL", "IN_TUNNEL"]]` Whether the test was run inside or outside of the WARP tunnel. - `"EXECUTION_CONTEXT_INVALID"` - `"OUT_OF_TUNNEL"` - `"IN_TUNNEL"` - `test_id: Optional[str]` API Resource UUID tag. - `test_name: Optional[str]` Name of the traceroute test. - `time_start: Optional[str]` Timestamp indicating when the traceroute test execution began. - `tunnel_type: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) network_path = client.zero_trust.dex.traceroute_test_results.network_path.get( test_result_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", ) print(network_path.hops) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "hops": [ { "ttl": 0, "asn": 0, "aso": "aso", "ipAddress": "ipAddress", "location": { "city": "city", "state": "state", "zip": "zip" }, "mile": "client-to-app", "name": "name", "packetLossPct": 0, "rttMs": 0 } ], "resultId": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "colo": "SJC", "deviceName": "deviceName", "execution_context": "EXECUTION_CONTEXT_INVALID", "testId": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "testName": "testName", "time_start": "2023-07-16 15:00:00+00", "tunnel_type": "tunnel_type" } } ``` ## Domain Types ### Network Path Get Response - `class NetworkPathGetResponse: …` - `hops: List[Hop]` An array of the hops taken by the device to reach the end destination. - `ttl: int` - `asn: Optional[int]` - `aso: Optional[str]` - `ip_address: Optional[str]` - `location: Optional[HopLocation]` - `city: Optional[str]` - `state: Optional[str]` - `zip: Optional[str]` - `mile: Optional[Literal["client-to-app", "client-to-cf-egress", "client-to-cf-ingress", "client-to-isp"]]` - `"client-to-app"` - `"client-to-cf-egress"` - `"client-to-cf-ingress"` - `"client-to-isp"` - `name: Optional[str]` - `packet_loss_pct: Optional[float]` - `rtt_ms: Optional[int]` - `result_id: str` API Resource UUID tag. - `colo: Optional[str]` Cloudflare colo airport code. - `device_name: Optional[str]` Name of the device associated with this network path response. - `execution_context: Optional[Literal["EXECUTION_CONTEXT_INVALID", "OUT_OF_TUNNEL", "IN_TUNNEL"]]` Whether the test was run inside or outside of the WARP tunnel. - `"EXECUTION_CONTEXT_INVALID"` - `"OUT_OF_TUNNEL"` - `"IN_TUNNEL"` - `test_id: Optional[str]` API Resource UUID tag. - `test_name: Optional[str]` Name of the traceroute test. - `time_start: Optional[str]` Timestamp indicating when the traceroute test execution began. - `tunnel_type: Optional[str]` # Traceroute Tests ## Get details and aggregate metrics for a traceroute test `zero_trust.dex.traceroute_tests.get(strtest_id, TracerouteTestGetParams**kwargs) -> Traceroute` **get** `/accounts/{account_id}/dex/traceroute-tests/{test_id}` Get test details and aggregate performance metrics for a traceroute test for a given time period between 1 hour and 7 days. ### Parameters - `account_id: str` Unique identifier linked to an account. - `test_id: str` API Resource UUID tag. - `from_: str` Start time for aggregate metrics in ISO ms. - `interval: Literal["minute", "hour"]` Time interval for aggregate time slots. - `"minute"` - `"hour"` - `to: str` End time for aggregate metrics in ISO ms. - `colo: Optional[str]` Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. - `device_id: Optional[Sequence[str]]` Optionally filter result stats to a specific device(s). Cannot be used in combination with colo param. ### Returns - `class Traceroute: …` - `host: str` The host of the Traceroute synthetic application test. - `interval: str` The interval at which the Traceroute synthetic application test is set to run. - `kind: Literal["traceroute"]` - `"traceroute"` - `name: str` The name of the Traceroute synthetic application test. - `target_policies: Optional[List[DigitalExperienceMonitor]]` - `id: str` API Resource UUID tag. - `default: bool` Whether the policy is the default for the account. - `name: str` - `targeted: Optional[bool]` - `traceroute_stats: Optional[TracerouteStats]` - `availability_pct: TracerouteStatsAvailabilityPct` - `slots: List[TracerouteStatsAvailabilityPctSlot]` - `timestamp: str` - `value: float` - `avg: Optional[float]` average observed in the time period. - `max: Optional[float]` highest observed in the time period. - `min: Optional[float]` lowest observed in the time period. - `hops_count: TestStatOverTime` - `slots: List[Slot]` - `timestamp: str` - `value: int` - `avg: Optional[int]` average observed in the time period. - `max: Optional[int]` highest observed in the time period. - `min: Optional[int]` lowest observed in the time period. - `packet_loss_pct: TracerouteStatsPacketLossPct` - `slots: List[TracerouteStatsPacketLossPctSlot]` - `timestamp: str` - `value: float` - `avg: Optional[float]` average observed in the time period. - `max: Optional[float]` highest observed in the time period. - `min: Optional[float]` lowest observed in the time period. - `round_trip_time_ms: TestStatOverTime` - `unique_devices_total: int` Count of unique devices that have run this test in the given time period. - `traceroute_stats_by_colo: Optional[List[TracerouteStatsByColo]]` - `availability_pct: TracerouteStatsByColoAvailabilityPct` - `slots: List[TracerouteStatsByColoAvailabilityPctSlot]` - `timestamp: str` - `value: float` - `avg: Optional[float]` average observed in the time period. - `max: Optional[float]` highest observed in the time period. - `min: Optional[float]` lowest observed in the time period. - `colo: str` - `hops_count: TestStatOverTime` - `packet_loss_pct: TracerouteStatsByColoPacketLossPct` - `slots: List[TracerouteStatsByColoPacketLossPctSlot]` - `timestamp: str` - `value: float` - `avg: Optional[float]` average observed in the time period. - `max: Optional[float]` highest observed in the time period. - `min: Optional[float]` lowest observed in the time period. - `round_trip_time_ms: TestStatOverTime` - `unique_devices_total: int` Count of unique devices that have run this test in the given time period. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) traceroute = client.zero_trust.dex.traceroute_tests.get( test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", from_="1689520412000", interval="minute", to="1689606812000", ) print(traceroute.host) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "host": "1.1.1.1", "interval": "0h5m0s", "kind": "traceroute", "name": "Atlassian Sign In Page", "target_policies": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "default": true, "name": "name" } ], "targeted": true, "tracerouteStats": { "availabilityPct": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "hopsCount": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "packetLossPct": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "roundTripTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "uniqueDevicesTotal": 57 }, "tracerouteStatsByColo": [ { "availabilityPct": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "colo": "DFW", "hopsCount": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "packetLossPct": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "roundTripTimeMs": { "slots": [ { "timestamp": "2023-07-16 15:00:00+00", "value": 0 } ], "avg": 0, "max": 0, "min": 0 }, "uniqueDevicesTotal": 57 } ] } } ``` ## Get percentiles for a traceroute test `zero_trust.dex.traceroute_tests.percentiles(strtest_id, TracerouteTestPercentilesParams**kwargs) -> TracerouteTestPercentilesResponse` **get** `/accounts/{account_id}/dex/traceroute-tests/{test_id}/percentiles` Get percentiles for a traceroute test for a given time period between 1 hour and 7 days. ### Parameters - `account_id: str` Unique identifier linked to an account. - `test_id: str` API Resource UUID tag. - `from_: str` Start time for the query in ISO (RFC3339 - ISO 8601) format. - `to: str` End time for the query in ISO (RFC3339 - ISO 8601) format. - `colo: Optional[str]` Optionally filter result stats to a Cloudflare colo. Cannot be used in combination with deviceId param. - `device_id: Optional[Sequence[str]]` Optionally filter result stats to a specific device(s). Cannot be used in combination with colo param. ### Returns - `class TracerouteTestPercentilesResponse: …` - `hops_count: Optional[Percentiles]` - `p50: Optional[float]` p50 observed in the time period. - `p90: Optional[float]` p90 observed in the time period. - `p95: Optional[float]` p95 observed in the time period. - `p99: Optional[float]` p99 observed in the time period. - `packet_loss_pct: Optional[Percentiles]` - `round_trip_time_ms: Optional[Percentiles]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.zero_trust.dex.traceroute_tests.percentiles( test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", from_="2023-09-20T17:00:00Z", to="2023-09-20T17:00:00Z", ) print(response.hops_count) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "hopsCount": { "p50": 0, "p90": 0, "p95": 0, "p99": 0 }, "packetLossPct": { "p50": 0, "p90": 0, "p95": 0, "p99": 0 }, "roundTripTimeMs": { "p50": 0, "p90": 0, "p95": 0, "p99": 0 } } } ``` ## Get network path breakdown for a traceroute test `zero_trust.dex.traceroute_tests.network_path(strtest_id, TracerouteTestNetworkPathParams**kwargs) -> NetworkPathResponse` **get** `/accounts/{account_id}/dex/traceroute-tests/{test_id}/network-path` Get a breakdown of metrics by hop for individual traceroute test runs. ### Parameters - `account_id: str` Unique identifier linked to an account. - `test_id: str` API Resource UUID tag. - `device_id: str` Device to filter traceroute result runs to. - `from_: str` Start time for aggregate metrics in ISO ms. - `interval: Literal["minute", "hour"]` Time interval for aggregate time slots. - `"minute"` - `"hour"` - `to: str` End time for aggregate metrics in ISO ms. ### Returns - `class NetworkPathResponse: …` - `id: str` API Resource UUID tag. - `device_name: Optional[str]` Name of the device that ran the test. - `interval: Optional[str]` The interval at which the Traceroute synthetic application test is set to run. - `kind: Optional[Literal["traceroute"]]` - `"traceroute"` - `name: Optional[str]` - `network_path: Optional[NetworkPath]` - `slots: List[Slot]` - `id: str` API Resource UUID tag. - `client_to_app_rtt_ms: Optional[int]` Round trip time in ms of the client to app mile - `client_to_cf_egress_rtt_ms: Optional[int]` Round trip time in ms of the client to Cloudflare egress mile - `client_to_cf_ingress_rtt_ms: Optional[int]` Round trip time in ms of the client to Cloudflare ingress mile - `timestamp: str` - `client_to_isp_rtt_ms: Optional[int]` Round trip time in ms of the client to ISP mile - `sampling: Optional[Sampling]` Specifies the sampling applied, if any, to the slots response. When sampled, results shown represent the first test run to the start of each sampling interval. - `unit: Literal["hours"]` - `"hours"` - `value: int` - `url: Optional[str]` The host of the Traceroute synthetic application test. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) network_path_response = client.zero_trust.dex.traceroute_tests.network_path( test_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", device_id="deviceId", from_="1689520412000", interval="minute", to="1689606812000", ) print(network_path_response.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "deviceName": "deviceName", "interval": "0h5m0s", "kind": "traceroute", "name": "name", "networkPath": { "slots": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "clientToAppRttMs": 0, "clientToCfEgressRttMs": 0, "clientToCfIngressRttMs": 0, "timestamp": "2023-07-16 15:00:00+00", "clientToIspRttMs": 0 } ], "sampling": { "unit": "hours", "value": 0 } }, "url": "1.1.1.1" } } ``` ## Domain Types ### Traceroute - `class Traceroute: …` - `host: str` The host of the Traceroute synthetic application test. - `interval: str` The interval at which the Traceroute synthetic application test is set to run. - `kind: Literal["traceroute"]` - `"traceroute"` - `name: str` The name of the Traceroute synthetic application test. - `target_policies: Optional[List[DigitalExperienceMonitor]]` - `id: str` API Resource UUID tag. - `default: bool` Whether the policy is the default for the account. - `name: str` - `targeted: Optional[bool]` - `traceroute_stats: Optional[TracerouteStats]` - `availability_pct: TracerouteStatsAvailabilityPct` - `slots: List[TracerouteStatsAvailabilityPctSlot]` - `timestamp: str` - `value: float` - `avg: Optional[float]` average observed in the time period. - `max: Optional[float]` highest observed in the time period. - `min: Optional[float]` lowest observed in the time period. - `hops_count: TestStatOverTime` - `slots: List[Slot]` - `timestamp: str` - `value: int` - `avg: Optional[int]` average observed in the time period. - `max: Optional[int]` highest observed in the time period. - `min: Optional[int]` lowest observed in the time period. - `packet_loss_pct: TracerouteStatsPacketLossPct` - `slots: List[TracerouteStatsPacketLossPctSlot]` - `timestamp: str` - `value: float` - `avg: Optional[float]` average observed in the time period. - `max: Optional[float]` highest observed in the time period. - `min: Optional[float]` lowest observed in the time period. - `round_trip_time_ms: TestStatOverTime` - `unique_devices_total: int` Count of unique devices that have run this test in the given time period. - `traceroute_stats_by_colo: Optional[List[TracerouteStatsByColo]]` - `availability_pct: TracerouteStatsByColoAvailabilityPct` - `slots: List[TracerouteStatsByColoAvailabilityPctSlot]` - `timestamp: str` - `value: float` - `avg: Optional[float]` average observed in the time period. - `max: Optional[float]` highest observed in the time period. - `min: Optional[float]` lowest observed in the time period. - `colo: str` - `hops_count: TestStatOverTime` - `packet_loss_pct: TracerouteStatsByColoPacketLossPct` - `slots: List[TracerouteStatsByColoPacketLossPctSlot]` - `timestamp: str` - `value: float` - `avg: Optional[float]` average observed in the time period. - `max: Optional[float]` highest observed in the time period. - `min: Optional[float]` lowest observed in the time period. - `round_trip_time_ms: TestStatOverTime` - `unique_devices_total: int` Count of unique devices that have run this test in the given time period. ### Traceroute Test Percentiles Response - `class TracerouteTestPercentilesResponse: …` - `hops_count: Optional[Percentiles]` - `p50: Optional[float]` p50 observed in the time period. - `p90: Optional[float]` p90 observed in the time period. - `p95: Optional[float]` p95 observed in the time period. - `p99: Optional[float]` p99 observed in the time period. - `packet_loss_pct: Optional[Percentiles]` - `round_trip_time_ms: Optional[Percentiles]` # Rules ## Get DEX Rule `zero_trust.dex.rules.get(strrule_id, RuleGetParams**kwargs) -> RuleGetResponse` **get** `/accounts/{account_id}/dex/rules/{rule_id}` Get details for a DEX Rule. ### Parameters - `account_id: str` Unique identifier linked to an account. - `rule_id: str` API Resource UUID tag. ### Returns - `class RuleGetResponse: …` - `id: str` API Resource UUID tag. - `created_at: str` - `match: str` - `name: str` - `description: Optional[str]` - `targeted_tests: Optional[List[TargetedTest]]` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: str` The desired endpoint to test. - `kind: Literal["http", "traceroute"]` The type of test. - `"http"` - `"traceroute"` - `method: Optional[Literal["GET"]]` The HTTP request method type. - `"GET"` - `enabled: bool` - `name: str` - `test_id: str` - `updated_at: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) rule = client.zero_trust.dex.rules.get( rule_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", ) print(rule.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2023-07-16 15:00:00+00", "match": "match", "name": "name", "description": "description", "targeted_tests": [ { "data": { "host": "https://dash.cloudflare.com", "kind": "http", "method": "GET" }, "enabled": true, "name": "name", "test_id": "test_id" } ], "updated_at": "2023-07-16 15:00:00+00" } } ``` ## Delete a DEX Rule `zero_trust.dex.rules.delete(strrule_id, RuleDeleteParams**kwargs) -> RuleDeleteResponse` **delete** `/accounts/{account_id}/dex/rules/{rule_id}` Delete a DEX Rule. ### Parameters - `account_id: str` Unique identifier linked to an account. - `rule_id: str` API Resource UUID tag. ### Returns - `Optional[bool]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) rule = client.zero_trust.dex.rules.delete( rule_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", ) print(rule) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": true } ``` ## Update a DEX Rule `zero_trust.dex.rules.update(strrule_id, RuleUpdateParams**kwargs) -> RuleUpdateResponse` **patch** `/accounts/{account_id}/dex/rules/{rule_id}` Update a DEX Rule. ### Parameters - `account_id: str` Unique identifier linked to an account. - `rule_id: str` API Resource UUID tag. - `description: Optional[str]` - `match: Optional[str]` The wirefilter expression to match. - `name: Optional[str]` The name of the Rule. ### Returns - `class RuleUpdateResponse: …` - `id: str` API Resource UUID tag. - `created_at: str` - `match: str` - `name: str` - `description: Optional[str]` - `targeted_tests: Optional[List[TargetedTest]]` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: str` The desired endpoint to test. - `kind: Literal["http", "traceroute"]` The type of test. - `"http"` - `"traceroute"` - `method: Optional[Literal["GET"]]` The HTTP request method type. - `"GET"` - `enabled: bool` - `name: str` - `test_id: str` - `updated_at: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) rule = client.zero_trust.dex.rules.update( rule_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", ) print(rule.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2023-07-16 15:00:00+00", "match": "match", "name": "name", "description": "description", "targeted_tests": [ { "data": { "host": "https://dash.cloudflare.com", "kind": "http", "method": "GET" }, "enabled": true, "name": "name", "test_id": "test_id" } ], "updated_at": "2023-07-16 15:00:00+00" } } ``` ## Create a DEX Rule `zero_trust.dex.rules.create(RuleCreateParams**kwargs) -> RuleCreateResponse` **post** `/accounts/{account_id}/dex/rules` Create a DEX Rule. ### Parameters - `account_id: str` Unique identifier linked to an account. - `match: str` The wirefilter expression to match. - `name: str` The name of the Rule. - `description: Optional[str]` ### Returns - `class RuleCreateResponse: …` - `id: str` API Resource UUID tag. - `created_at: str` - `match: str` - `name: str` - `description: Optional[str]` - `targeted_tests: Optional[List[TargetedTest]]` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: str` The desired endpoint to test. - `kind: Literal["http", "traceroute"]` The type of test. - `"http"` - `"traceroute"` - `method: Optional[Literal["GET"]]` The HTTP request method type. - `"GET"` - `enabled: bool` - `name: str` - `test_id: str` - `updated_at: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) rule = client.zero_trust.dex.rules.create( account_id="01a7362d577a6c3019a474fd6f485823", match="match", name="name", ) print(rule.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2023-07-16 15:00:00+00", "match": "match", "name": "name", "description": "description", "targeted_tests": [ { "data": { "host": "https://dash.cloudflare.com", "kind": "http", "method": "GET" }, "enabled": true, "name": "name", "test_id": "test_id" } ], "updated_at": "2023-07-16 15:00:00+00" } } ``` ## List DEX Rules `zero_trust.dex.rules.list(RuleListParams**kwargs) -> SyncV4PagePagination[Optional[RuleListResponse]]` **get** `/accounts/{account_id}/dex/rules` List DEX Rules. ### Parameters - `account_id: str` Unique identifier linked to an account. - `page: float` Page number of paginated results. - `per_page: float` Number of results per page. - `name: Optional[str]` Filter results by rule name. - `sort_by: Optional[Literal["name", "created_at", "updated_at"]]` Which property to sort results by. - `"name"` - `"created_at"` - `"updated_at"` - `sort_order: Optional[Literal["ASC", "DESC"]]` Sort direction for sort_by property. - `"ASC"` - `"DESC"` ### Returns - `class RuleListResponse: …` - `rules: Optional[List[Rule]]` - `id: str` API Resource UUID tag. - `created_at: str` - `match: str` - `name: str` - `description: Optional[str]` - `targeted_tests: Optional[List[RuleTargetedTest]]` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: str` The desired endpoint to test. - `kind: Literal["http", "traceroute"]` The type of test. - `"http"` - `"traceroute"` - `method: Optional[Literal["GET"]]` The HTTP request method type. - `"GET"` - `enabled: bool` - `name: str` - `test_id: str` - `updated_at: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.dex.rules.list( account_id="01a7362d577a6c3019a474fd6f485823", page=1, per_page=10, ) page = page.result.items[0] print(page.rules) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "rules": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2023-07-16 15:00:00+00", "match": "match", "name": "name", "description": "description", "targeted_tests": [ { "data": { "host": "https://dash.cloudflare.com", "kind": "http", "method": "GET" }, "enabled": true, "name": "name", "test_id": "test_id" } ], "updated_at": "2023-07-16 15:00:00+00" } ] }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Domain Types ### Rule Get Response - `class RuleGetResponse: …` - `id: str` API Resource UUID tag. - `created_at: str` - `match: str` - `name: str` - `description: Optional[str]` - `targeted_tests: Optional[List[TargetedTest]]` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: str` The desired endpoint to test. - `kind: Literal["http", "traceroute"]` The type of test. - `"http"` - `"traceroute"` - `method: Optional[Literal["GET"]]` The HTTP request method type. - `"GET"` - `enabled: bool` - `name: str` - `test_id: str` - `updated_at: Optional[str]` ### Rule Delete Response - `Optional[bool]` ### Rule Update Response - `class RuleUpdateResponse: …` - `id: str` API Resource UUID tag. - `created_at: str` - `match: str` - `name: str` - `description: Optional[str]` - `targeted_tests: Optional[List[TargetedTest]]` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: str` The desired endpoint to test. - `kind: Literal["http", "traceroute"]` The type of test. - `"http"` - `"traceroute"` - `method: Optional[Literal["GET"]]` The HTTP request method type. - `"GET"` - `enabled: bool` - `name: str` - `test_id: str` - `updated_at: Optional[str]` ### Rule Create Response - `class RuleCreateResponse: …` - `id: str` API Resource UUID tag. - `created_at: str` - `match: str` - `name: str` - `description: Optional[str]` - `targeted_tests: Optional[List[TargetedTest]]` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: str` The desired endpoint to test. - `kind: Literal["http", "traceroute"]` The type of test. - `"http"` - `"traceroute"` - `method: Optional[Literal["GET"]]` The HTTP request method type. - `"GET"` - `enabled: bool` - `name: str` - `test_id: str` - `updated_at: Optional[str]` ### Rule List Response - `class RuleListResponse: …` - `rules: Optional[List[Rule]]` - `id: str` API Resource UUID tag. - `created_at: str` - `match: str` - `name: str` - `description: Optional[str]` - `targeted_tests: Optional[List[RuleTargetedTest]]` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: str` The desired endpoint to test. - `kind: Literal["http", "traceroute"]` The type of test. - `"http"` - `"traceroute"` - `method: Optional[Literal["GET"]]` The HTTP request method type. - `"GET"` - `enabled: bool` - `name: str` - `test_id: str` - `updated_at: Optional[str]` # Devices # ISPs ## List device ISPs `zero_trust.dex.devices.isps.list(strdevice_id, ISPListParams**kwargs) -> SyncV4PagePagination[Optional[ISPs]]` **get** `/accounts/{account_id}/dex/devices/{device_id}/isps` List ISP information observed for a specific device during traceroute tests. ### Parameters - `account_id: str` Unique identifier linked to an account. - `device_id: str` API Resource UUID tag. - `per_page: int` Number of items per page - `cursor: Optional[str]` Cursor for cursor-based pagination. Mutually exclusive with page. - `from_: Optional[Union[str, datetime]]` Start time for the query in ISO 8601 format. - `page: Optional[int]` Page number of paginated results. Mutually exclusive with cursor. - `sort_by: Optional[Literal["time_start"]]` The field to sort results by. - `"time_start"` - `sort_order: Optional[Literal["ASC", "DESC"]]` The order to sort results. - `"ASC"` - `"DESC"` - `to: Optional[Union[str, datetime]]` End time for the query in ISO 8601 format. ### Returns - `class ISPs: …` - `isps: List[ISP]` - `test_id: str` The test that generated this result. - `test_result_id: str` The specific test result. - `time_start: datetime` Timestamp of when the ISP was observed. - `ip: Optional[ISPIP]` IP address information for the ISP hop. Fields marked as PII-gated (`name`, `address`, `netmask`, and all `location` sub-fields) will be returned as the literal string `"REDACTED"` for callers that do not have the PII permission. `asn`, `aso`, and `version` are always returned regardless of PII access. - `address: Optional[str]` IP address. Returned as `"REDACTED"` without PII permission. - `asn: Optional[int]` Autonomous System Number. - `aso: Optional[str]` Autonomous System Organization name. - `location: Optional[ISPIPLocation]` Geographic location information. All fields are returned as the literal string `"REDACTED"` for callers that do not have the PII permission. - `city: Optional[str]` City name. Returned as `"REDACTED"` without PII permission. - `country_iso: Optional[str]` Country ISO code. Returned as `"REDACTED"` without PII permission. - `state_iso: Optional[str]` State/province ISO code. Returned as `"REDACTED"` without PII permission. - `zip: Optional[str]` ZIP/postal code. Returned as `"REDACTED"` without PII permission. - `name: Optional[str]` Named IP address (reverse DNS hostname when available). Returned as `"REDACTED"` without PII permission. - `netmask: Optional[str]` Network mask. Returned as `"REDACTED"` without PII permission. - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown). ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.zero_trust.dex.devices.isps.list( device_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="01a7362d577a6c3019a474fd6f485823", per_page=10, ) page = page.result.items[0] print(page.isps) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "isps": [ { "test_id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "test_result_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "time_start": "2024-06-01T12:00:00Z", "ip": { "address": "203.0.113.1", "asn": 13335, "aso": "CLOUDFLARENET", "location": { "city": "San Francisco", "country_iso": "US", "state_iso": "CA", "zip": "94107" }, "name": "isp-gateway.example.com", "netmask": "255.255.255.0", "version": 1 } } ] }, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Domain Types ### ISPs - `class ISPs: …` - `isps: List[ISP]` - `test_id: str` The test that generated this result. - `test_result_id: str` The specific test result. - `time_start: datetime` Timestamp of when the ISP was observed. - `ip: Optional[ISPIP]` IP address information for the ISP hop. Fields marked as PII-gated (`name`, `address`, `netmask`, and all `location` sub-fields) will be returned as the literal string `"REDACTED"` for callers that do not have the PII permission. `asn`, `aso`, and `version` are always returned regardless of PII access. - `address: Optional[str]` IP address. Returned as `"REDACTED"` without PII permission. - `asn: Optional[int]` Autonomous System Number. - `aso: Optional[str]` Autonomous System Organization name. - `location: Optional[ISPIPLocation]` Geographic location information. All fields are returned as the literal string `"REDACTED"` for callers that do not have the PII permission. - `city: Optional[str]` City name. Returned as `"REDACTED"` without PII permission. - `country_iso: Optional[str]` Country ISO code. Returned as `"REDACTED"` without PII permission. - `state_iso: Optional[str]` State/province ISO code. Returned as `"REDACTED"` without PII permission. - `zip: Optional[str]` ZIP/postal code. Returned as `"REDACTED"` without PII permission. - `name: Optional[str]` Named IP address (reverse DNS hostname when available). Returned as `"REDACTED"` without PII permission. - `netmask: Optional[str]` Network mask. Returned as `"REDACTED"` without PII permission. - `version: Optional[int]` IP version (`1` for IPv4, `2` for IPv6, `0` if unknown).