Skip to content
Start here

List user tenants

client.User.Tenants.List(ctx) (*SinglePage[TenantListResponse], error)
GET/user/tenants

Lists the Cloudflare tenants in which the authenticated user has direct membership using the legacy Tenant response shape. Use GET /organizations to list Organizations the user can access, including through hierarchy, using the modern Organization response shape.

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
Accepted Permissions (at least one required)
User Details WriteUser Details Read
ReturnsExpand Collapse
type TenantListResponse struct{…}
Cdate Time
formatdate-time
CustomerID string
Edate Time
formatdate-time
TenantContacts TenantListResponseTenantContacts
Email stringOptional
Website stringOptional
TenantLabels []string
TenantMetadata TenantListResponseTenantMetadata
BillingAccountType stringOptional
ConfigurationAccount stringOptional
CreatedBy stringOptional
DNS TenantListResponseTenantMetadataDNSOptional
NSPool TenantListResponseTenantMetadataDNSNSPool
Primary string
Secondary string
Flags map[string, string]Optional
InnateAccountEntitlements []TenantListResponseTenantMetadataInnateAccountEntitlementOptional
Allocation TenantListResponseTenantMetadataInnateAccountEntitlementsAllocation
Type string
Value TenantListResponseTenantMetadataInnateAccountEntitlementsAllocationValueUnion
One of the following:
UnionBool
UnionFloat
UnionString
type TenantListResponseTenantMetadataInnateAccountEntitlementsAllocationValueMap map[string, unknown]
type TenantListResponseTenantMetadataInnateAccountEntitlementsAllocationValueArray []unknown
Feature TenantListResponseTenantMetadataInnateAccountEntitlementsFeature
Key string
TenantEntitlements []TenantListResponseTenantMetadataTenantEntitlementOptional
Allocation TenantListResponseTenantMetadataTenantEntitlementsAllocation
Type string
Value TenantListResponseTenantMetadataTenantEntitlementsAllocationValueUnion
One of the following:
UnionBool
UnionFloat
UnionString
type TenantListResponseTenantMetadataTenantEntitlementsAllocationValueMap map[string, unknown]
type TenantListResponseTenantMetadataTenantEntitlementsAllocationValueArray []unknown
Feature TenantListResponseTenantMetadataTenantEntitlementsFeature
Key string
TenantName string
TenantNetwork TenantListResponseTenantNetwork
Choices map[string, unknown]Optional
TenantStatus string
TenantTag string
TenantType string
TenantUnits []TenantListResponseTenantUnit
UnitMemberships []TenantListResponseTenantUnitsUnitMembership
MemberMetadata unknown
MemberStatus string
MemberTag string
UnitMetadata unknown
UnitName string
UnitStatus string
UnitTag string
UIFlags TenantListResponseUIFlags

Which top-level dashboard experiences to render for this tenant; both may be true.

ShowOrgsUI bool

Render the Organizations experience for this tenant.

ShowTenantsUI bool

Render the legacy Tenants experience for this tenant.

List user tenants

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"),
    option.WithAPIEmail("user@example.com"),
  )
  page, err := client.User.Tenants.List(context.TODO())
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "errors": [],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": [
    {
      "cdate": "2019-12-27T18:11:19.117Z",
      "customer_id": "customer_id",
      "edate": "2019-12-27T18:11:19.117Z",
      "tenant_contacts": {
        "email": "email",
        "website": "website"
      },
      "tenant_labels": [
        "string"
      ],
      "tenant_metadata": {
        "billing_account_type": "billing_account_type",
        "configuration_account": "configuration_account",
        "created_by": "created_by",
        "dns": {
          "ns_pool": {
            "primary": "primary",
            "secondary": "secondary"
          }
        },
        "flags": {
          "foo": "string"
        },
        "innate_account_entitlements": [
          {
            "allocation": {
              "type": "type",
              "value": true
            },
            "feature": {
              "key": "key"
            }
          }
        ],
        "tenant_entitlements": [
          {
            "allocation": {
              "type": "type",
              "value": true
            },
            "feature": {
              "key": "key"
            }
          }
        ]
      },
      "tenant_name": "tenant_name",
      "tenant_network": {
        "choices": {
          "foo": {}
        }
      },
      "tenant_status": "tenant_status",
      "tenant_tag": "tenant_tag",
      "tenant_type": "tenant_type",
      "tenant_units": [
        {
          "unit_memberships": [
            {
              "member_metadata": {},
              "member_status": "member_status",
              "member_tag": "member_tag"
            }
          ],
          "unit_metadata": {},
          "unit_name": "unit_name",
          "unit_status": "unit_status",
          "unit_tag": "unit_tag"
        }
      ],
      "ui_flags": {
        "show_orgs_ui": true,
        "show_tenants_ui": true
      }
    }
  ],
  "success": true
}
Returns Examples
{
  "errors": [],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": [
    {
      "cdate": "2019-12-27T18:11:19.117Z",
      "customer_id": "customer_id",
      "edate": "2019-12-27T18:11:19.117Z",
      "tenant_contacts": {
        "email": "email",
        "website": "website"
      },
      "tenant_labels": [
        "string"
      ],
      "tenant_metadata": {
        "billing_account_type": "billing_account_type",
        "configuration_account": "configuration_account",
        "created_by": "created_by",
        "dns": {
          "ns_pool": {
            "primary": "primary",
            "secondary": "secondary"
          }
        },
        "flags": {
          "foo": "string"
        },
        "innate_account_entitlements": [
          {
            "allocation": {
              "type": "type",
              "value": true
            },
            "feature": {
              "key": "key"
            }
          }
        ],
        "tenant_entitlements": [
          {
            "allocation": {
              "type": "type",
              "value": true
            },
            "feature": {
              "key": "key"
            }
          }
        ]
      },
      "tenant_name": "tenant_name",
      "tenant_network": {
        "choices": {
          "foo": {}
        }
      },
      "tenant_status": "tenant_status",
      "tenant_tag": "tenant_tag",
      "tenant_type": "tenant_type",
      "tenant_units": [
        {
          "unit_memberships": [
            {
              "member_metadata": {},
              "member_status": "member_status",
              "member_tag": "member_tag"
            }
          ],
          "unit_metadata": {},
          "unit_name": "unit_name",
          "unit_status": "unit_status",
          "unit_tag": "unit_tag"
        }
      ],
      "ui_flags": {
        "show_orgs_ui": true,
        "show_tenants_ui": true
      }
    }
  ],
  "success": true
}