Skip to content
Start here

List tenant accounts

tenants.accounts.list(strtenant_id, AccountListParams**kwargs) -> SyncV4PagePaginationArray[AccountListResponse]
GET/tenants/{tenant_id}/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, or provide page and per_page together for legacy offset pagination. Cursor pagination takes precedence when requested.

Security

API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
ParametersExpand Collapse
tenant_id: str
account_pubname: Optional[AccountPubname]
contains: Optional[str]

(case-insensitive) Filter the list of accounts to where the account_pubname contains a particular string.

ends_with: Optional[str]

(case-insensitive) Filter the list of accounts to where the account_pubname ends with a particular string.

starts_with: Optional[str]

(case-insensitive) Filter the list of accounts to where the account_pubname starts with a particular string.

direction: Optional[Literal["asc", "desc"]]

Sort direction for the order_by field. Valid values: asc, desc. Defaults to asc when order_by is specified.

One of the following:
"asc"
"desc"
include_total: Optional[bool]

Whether to calculate and return the exact result_info.total_size for cursor pagination. Defaults to true. When false, total_size is omitted. Legacy page/per_page requests always calculate total_count.

name: Optional[Name]
contains: Optional[str]

(case-insensitive) Filter the list of accounts to where the name contains a particular string.

ends_with: Optional[str]

(case-insensitive) Filter the list of accounts to where the name ends with a particular string.

starts_with: Optional[str]

(case-insensitive) Filter the list of accounts to where the name starts with a particular string.

order_by: Optional[Literal["account_name"]]

Field to order results by. Currently supported values: account_name.

page: Optional[int]

Legacy offset page number. Must be provided with per_page. Values below 1 are treated as

  1. Cursor pagination takes precedence when requested.
page_size: Optional[int]

The amount of items to return. Defaults to 10.

maximum1000
minimum0
page_token: Optional[str]

An opaque token returned from the last list response that when provided will retrieve the next page.

Parameters used to filter the retrieved list must remain in subsequent requests with a page token.

per_page: Optional[int]

Legacy offset page size. Must be provided with page. Values are clamped to the range 1-100. Cursor pagination takes precedence when requested.

status: Optional[Literal["active", "deleted"]]

Filter accounts by lifecycle status. Defaults to active.

One of the following:
"active"
"deleted"
ReturnsExpand Collapse
class AccountListResponse: …
account_pubname: Optional[str]
account_tag: str
account_type: Literal["standard", "enterprise"]
One of the following:
"standard"
"enterprise"
created_on: datetime
formatdate-time
settings: Settings
access_approval_expiry: Optional[datetime]
formatdate-time
api_access_enabled: bool
enforce_two_factor: bool
use_account_custom_ns_by_default: bool

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
}