List all targets
Lists and sorts an account’s targets. Filters are optional and are ANDed together.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Parameters
Date and time at which the target was created after (inclusive)
Date and time at which the target was created before (inclusive)
Filters for targets whose IP addresses look like the specified string.
Supports * as a wildcard character
Filters for targets that have any of the following IP addresses. Specify
ips multiple times in query parameter to build list of candidates.
Defines an IPv4 filter range’s ending value (inclusive). Requires
ipv4_start to be specified as well.
Defines an IPv4 filter range’s starting value (inclusive). Requires
ipv4_end to be specified as well.
Defines an IPv6 filter range’s ending value (inclusive). Requires
ipv6_start to be specified as well.
Defines an IPv6 filter range’s starting value (inclusive). Requires
ipv6_end to be specified as well.
Date and time at which the target was modified after (inclusive)
Date and time at which the target was modified before (inclusive)
List all targets
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.access.infrastructure.targets.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
page = page.result[0]
print(page.id){
"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": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"created_at": "2019-08-24T14:15:22Z",
"hostname": "infra-access-target",
"ip": {
"ipv4": {
"ip_addr": "187.26.29.249",
"virtual_network_id": "c77b744e-acc8-428f-9257-6878c046ed55"
},
"ipv6": {
"ip_addr": "64c0:64e8:f0b4:8dbf:7104:72b0:ec8f:f5e0",
"virtual_network_id": "c77b744e-acc8-428f-9257-6878c046ed55"
}
},
"modified_at": "2019-08-24T14:15:22Z"
}
],
"result_info": {
"count": 1,
"page": 1,
"per_page": 20,
"total_count": 2000,
"total_pages": 100
}
}Returns Examples
{
"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": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"created_at": "2019-08-24T14:15:22Z",
"hostname": "infra-access-target",
"ip": {
"ipv4": {
"ip_addr": "187.26.29.249",
"virtual_network_id": "c77b744e-acc8-428f-9257-6878c046ed55"
},
"ipv6": {
"ip_addr": "64c0:64e8:f0b4:8dbf:7104:72b0:ec8f:f5e0",
"virtual_network_id": "c77b744e-acc8-428f-9257-6878c046ed55"
}
},
"modified_at": "2019-08-24T14:15:22Z"
}
],
"result_info": {
"count": 1,
"page": 1,
"per_page": 20,
"total_count": 2000,
"total_pages": 100
}
}