# Tenants ## Get tenant `client.Tenants.Get(ctx, tenantID) (*Tenant, error)` **get** `/tenants/{tenant_id}` Retrieves a Tenant by Tenant ID. ### Parameters - `tenantID string` ### Returns - `type Tenant struct{…}` - `Cdate Time` - `Edate Time` - `TenantContacts TenantTenantContacts` - `Email string` - `Website string` - `TenantLabels []string` - `TenantMetadata TenantTenantMetadata` - `DNS TenantTenantMetadataDNS` - `NSPool TenantTenantMetadataDNSNSPool` - `Primary string` - `Secondary string` - `TenantName string` - `TenantNetwork unknown` - `TenantStatus string` - `TenantTag string` - `TenantType string` - `TenantUnits []TenantTenantUnit` - `UnitMemberships []unknown` - `UnitMetadata unknown` - `UnitName string` - `UnitStatus string` - `UnitTag string` - `CustomerID string` ### Example ```go 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"), ) tenant, err := client.Tenants.Get(context.TODO(), "tenant_id") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", tenant.CustomerID) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "cdate": "2019-12-27T18:11:19.117Z", "edate": "2019-12-27T18:11:19.117Z", "tenant_contacts": { "email": "email", "website": "website" }, "tenant_labels": [ "string" ], "tenant_metadata": { "dns": { "ns_pool": { "primary": "primary", "secondary": "secondary" } } }, "tenant_name": "tenant_name", "tenant_network": {}, "tenant_status": "tenant_status", "tenant_tag": "tenant_tag", "tenant_type": "tenant_type", "tenant_units": [ { "unit_memberships": [ {} ], "unit_metadata": {}, "unit_name": "unit_name", "unit_status": "unit_status", "unit_tag": "unit_tag" } ], "customer_id": "customer_id" }, "success": true } ``` ## Domain Types ### Tenant - `type Tenant struct{…}` - `Cdate Time` - `Edate Time` - `TenantContacts TenantTenantContacts` - `Email string` - `Website string` - `TenantLabels []string` - `TenantMetadata TenantTenantMetadata` - `DNS TenantTenantMetadataDNS` - `NSPool TenantTenantMetadataDNSNSPool` - `Primary string` - `Secondary string` - `TenantName string` - `TenantNetwork unknown` - `TenantStatus string` - `TenantTag string` - `TenantType string` - `TenantUnits []TenantTenantUnit` - `UnitMemberships []unknown` - `UnitMetadata unknown` - `UnitName string` - `UnitStatus string` - `UnitTag string` - `CustomerID string` # Account Types ## Get tenant account types `client.Tenants.AccountTypes.List(ctx, tenantID) (*SinglePage[string], error)` **get** `/tenants/{tenant_id}/account_types` List of account types available for the Tenant to provision accounts. ### Parameters - `tenantID string` ### Returns - `type AccountTypeListResponseEnvelopeResult string` ### Example ```go 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.Tenants.AccountTypes.List(context.TODO(), "tenant_id") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ "string" ], "success": true } ``` # Accounts ## List tenant accounts `client.Tenants.Accounts.List(ctx, tenantID) (*SinglePage[TenantAccount], error)` **get** `/tenants/{tenant_id}/accounts` List of accounts for the Tenant. ### Parameters - `tenantID string` ### Returns - `type TenantAccount struct{…}` - `ID string` - `CreatedOn Time` - `Name string` - `Settings TenantAccountSettings` - `AbuseContactEmail string` - `AccessApprovalExpiry Time` - `APIAccessEnabled bool` - `DefaultNameservers string` Use [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-list-dns-settings) instead. Deprecated. - `EnforceTwofactor bool` - `UseAccountCustomNSByDefault bool` Use [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-list-dns-settings) instead. Deprecated. - `Type TenantAccountType` - `const TenantAccountTypeStandard TenantAccountType = "standard"` - `const TenantAccountTypeEnterprise TenantAccountType = "enterprise"` ### Example ```go 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.Tenants.Accounts.List(context.TODO(), "tenant_id") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "id", "created_on": "2019-12-27T18:11:19.117Z", "name": "name", "settings": { "abuse_contact_email": "abuse_contact_email", "access_approval_expiry": "2019-12-27T18:11:19.117Z", "api_access_enabled": true, "default_nameservers": "default_nameservers", "enforce_twofactor": true, "use_account_custom_ns_by_default": true }, "type": "standard" } ], "success": true } ``` ## Domain Types ### Tenant Account - `type TenantAccount struct{…}` - `ID string` - `CreatedOn Time` - `Name string` - `Settings TenantAccountSettings` - `AbuseContactEmail string` - `AccessApprovalExpiry Time` - `APIAccessEnabled bool` - `DefaultNameservers string` Use [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-list-dns-settings) instead. Deprecated. - `EnforceTwofactor bool` - `UseAccountCustomNSByDefault bool` Use [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-list-dns-settings) instead. Deprecated. - `Type TenantAccountType` - `const TenantAccountTypeStandard TenantAccountType = "standard"` - `const TenantAccountTypeEnterprise TenantAccountType = "enterprise"` # Entitlements ## List tenant entitlements `client.Tenants.Entitlements.Get(ctx, tenantID) (*TenantEntitlements, error)` **get** `/tenants/{tenant_id}/entitlements` List of innate entitlements available for the Tenant. ### Parameters - `tenantID string` ### Returns - `type TenantEntitlements struct{…}` - `AllowAddSubdomain TenantEntitlementsAllowAddSubdomain` - `Type TenantEntitlementsAllowAddSubdomainType` - `const TenantEntitlementsAllowAddSubdomainTypeBool TenantEntitlementsAllowAddSubdomainType = "bool"` - `Value bool` - `AllowAutoAcceptInvites TenantEntitlementsAllowAutoAcceptInvites` - `Type TenantEntitlementsAllowAutoAcceptInvitesType` - `const TenantEntitlementsAllowAutoAcceptInvitesTypeBool TenantEntitlementsAllowAutoAcceptInvitesType = "bool"` - `Value bool` - `CNAMESetupAllowed TenantEntitlementsCNAMESetupAllowed` - `Type TenantEntitlementsCNAMESetupAllowedType` - `const TenantEntitlementsCNAMESetupAllowedTypeBool TenantEntitlementsCNAMESetupAllowedType = "bool"` - `Value bool` - `CustomEntitlements []TenantEntitlementsCustomEntitlement` - `Allocation TenantEntitlementsCustomEntitlementsAllocation` - `type TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIMaxCountAllocation struct{…}` - `Type TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIMaxCountAllocationType` - `const TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIMaxCountAllocationTypeMaxCount TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIMaxCountAllocationType = "max_count"` - `Value int64` - `type TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIBoolAllocation struct{…}` - `Type TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIBoolAllocationType` - `const TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIBoolAllocationTypeBool TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIBoolAllocationType = "bool"` - `Value bool` - `type TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPINullAllocation struct{…}` - `Type TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPINullAllocationType` - `const TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPINullAllocationTypeEmpty TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPINullAllocationType = ""` - `Value unknown` - `Feature TenantEntitlementsCustomEntitlementsFeature` - `Key string` - `MhsCertificateCount TenantEntitlementsMhsCertificateCount` - `Type TenantEntitlementsMhsCertificateCountType` - `const TenantEntitlementsMhsCertificateCountTypeMaxCount TenantEntitlementsMhsCertificateCountType = "max_count"` - `Value int64` - `PartialSetupAllowed TenantEntitlementsPartialSetupAllowed` - `Type TenantEntitlementsPartialSetupAllowedType` - `const TenantEntitlementsPartialSetupAllowedTypeBool TenantEntitlementsPartialSetupAllowedType = "bool"` - `Value bool` ### Example ```go 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"), ) tenantEntitlements, err := client.Tenants.Entitlements.Get(context.TODO(), "tenant_id") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", tenantEntitlements.AllowAddSubdomain) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "allow_add_subdomain": { "type": "bool", "value": true }, "allow_auto_accept_invites": { "type": "bool", "value": true }, "cname_setup_allowed": { "type": "bool", "value": true }, "custom_entitlements": [ { "allocation": { "type": "max_count", "value": 0 }, "feature": { "key": "key" } } ], "mhs_certificate_count": { "type": "max_count", "value": 0 }, "partial_setup_allowed": { "type": "bool", "value": true } }, "success": true } ``` ## Domain Types ### Tenant Entitlements - `type TenantEntitlements struct{…}` - `AllowAddSubdomain TenantEntitlementsAllowAddSubdomain` - `Type TenantEntitlementsAllowAddSubdomainType` - `const TenantEntitlementsAllowAddSubdomainTypeBool TenantEntitlementsAllowAddSubdomainType = "bool"` - `Value bool` - `AllowAutoAcceptInvites TenantEntitlementsAllowAutoAcceptInvites` - `Type TenantEntitlementsAllowAutoAcceptInvitesType` - `const TenantEntitlementsAllowAutoAcceptInvitesTypeBool TenantEntitlementsAllowAutoAcceptInvitesType = "bool"` - `Value bool` - `CNAMESetupAllowed TenantEntitlementsCNAMESetupAllowed` - `Type TenantEntitlementsCNAMESetupAllowedType` - `const TenantEntitlementsCNAMESetupAllowedTypeBool TenantEntitlementsCNAMESetupAllowedType = "bool"` - `Value bool` - `CustomEntitlements []TenantEntitlementsCustomEntitlement` - `Allocation TenantEntitlementsCustomEntitlementsAllocation` - `type TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIMaxCountAllocation struct{…}` - `Type TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIMaxCountAllocationType` - `const TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIMaxCountAllocationTypeMaxCount TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIMaxCountAllocationType = "max_count"` - `Value int64` - `type TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIBoolAllocation struct{…}` - `Type TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIBoolAllocationType` - `const TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIBoolAllocationTypeBool TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPIBoolAllocationType = "bool"` - `Value bool` - `type TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPINullAllocation struct{…}` - `Type TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPINullAllocationType` - `const TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPINullAllocationTypeEmpty TenantEntitlementsCustomEntitlementsAllocationOrganizationsAPINullAllocationType = ""` - `Value unknown` - `Feature TenantEntitlementsCustomEntitlementsFeature` - `Key string` - `MhsCertificateCount TenantEntitlementsMhsCertificateCount` - `Type TenantEntitlementsMhsCertificateCountType` - `const TenantEntitlementsMhsCertificateCountTypeMaxCount TenantEntitlementsMhsCertificateCountType = "max_count"` - `Value int64` - `PartialSetupAllowed TenantEntitlementsPartialSetupAllowed` - `Type TenantEntitlementsPartialSetupAllowedType` - `const TenantEntitlementsPartialSetupAllowedTypeBool TenantEntitlementsPartialSetupAllowedType = "bool"` - `Value bool` # Memberships ## List tenant memberships `client.Tenants.Memberships.List(ctx, tenantID) (*SinglePage[TenantMembership], error)` **get** `/tenants/{tenant_id}/memberships` List of active members (Cloudflare users) for the Tenant. ### Parameters - `tenantID string` ### Returns - `type TenantMembership struct{…}` - `UserEmail string` - `UserName string` - `UserTag string` ### Example ```go 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.Tenants.Memberships.List(context.TODO(), "tenant_id") if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "user_email": "user_email", "user_name": "user_name", "user_tag": "user_tag" } ], "success": true } ``` ## Domain Types ### Tenant Membership - `type TenantMembership struct{…}` - `UserEmail string` - `UserName string` - `UserTag string`