List tenant accounts
Lists all Cloudflare accounts across this tenant’s hierarchy using the legacy Account
response shape. Use GET /organizations/{organization_id}/accounts to list only accounts
immediately attached to a specific Organization using the modern Account response shape.
Use page_token and page_size for cursor pagination.
Security
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
Whether to calculate and return the exact result_info.total_size for cursor
pagination. Defaults to true. When false, total_size is omitted.
Field to order results by. Currently supported values: account_name.
List tenant accounts
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted
api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted
)
page = client.tenants.accounts.list(
tenant_id="tenant_id",
)
page = page.result[0]
print(page.account_pubname){
"errors": [],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": [
{
"account_pubname": "account_pubname",
"account_tag": "account_tag",
"account_type": "standard",
"created_on": "2019-12-27T18:11:19.117Z",
"settings": {
"access_approval_expiry": "2019-12-27T18:11:19.117Z",
"api_access_enabled": true,
"enforce_two_factor": true,
"use_account_custom_ns_by_default": true
}
}
],
"result_info": {
"next_page_token": "next_page_token",
"total_size": 0
},
"success": true
}Returns Examples
{
"errors": [],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": [
{
"account_pubname": "account_pubname",
"account_tag": "account_tag",
"account_type": "standard",
"created_on": "2019-12-27T18:11:19.117Z",
"settings": {
"access_approval_expiry": "2019-12-27T18:11:19.117Z",
"api_access_enabled": true,
"enforce_two_factor": true,
"use_account_custom_ns_by_default": true
}
}
],
"result_info": {
"next_page_token": "next_page_token",
"total_size": 0
},
"success": true
}