# Tenants ## Get tenant `client.tenants.get(stringtenantId, RequestOptionsoptions?): Tenant` **get** `/tenants/{tenant_id}` Retrieves a Tenant by Tenant ID. ### Parameters - `tenantId: string` ### Returns - `Tenant` - `cdate: string` - `edate: string` - `tenant_contacts: TenantContacts` - `email?: string` - `website?: string` - `tenant_labels: Array` - `tenant_metadata: TenantMetadata` - `dns?: DNS` - `ns_pool: NSPool` - `primary?: string` - `secondary?: string` - `tenant_name: string` - `tenant_network: unknown` - `tenant_status: string` - `tenant_tag: string` - `tenant_type: string` - `tenant_units: Array` - `unit_memberships: Array` - `unit_metadata: unknown` - `unit_name: string` - `unit_status: string` - `unit_tag: string` - `customer_id?: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const tenant = await client.tenants.get('tenant_id'); console.log(tenant.customer_id); ``` #### 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 - `Tenant` - `cdate: string` - `edate: string` - `tenant_contacts: TenantContacts` - `email?: string` - `website?: string` - `tenant_labels: Array` - `tenant_metadata: TenantMetadata` - `dns?: DNS` - `ns_pool: NSPool` - `primary?: string` - `secondary?: string` - `tenant_name: string` - `tenant_network: unknown` - `tenant_status: string` - `tenant_tag: string` - `tenant_type: string` - `tenant_units: Array` - `unit_memberships: Array` - `unit_metadata: unknown` - `unit_name: string` - `unit_status: string` - `unit_tag: string` - `customer_id?: string` # Account Types ## Get tenant account types `client.tenants.accountTypes.list(stringtenantId, RequestOptionsoptions?): SinglePage` **get** `/tenants/{tenant_id}/account_types` List of account types available for the Tenant to provision accounts. ### Parameters - `tenantId: string` ### Returns - `AccountTypeListResponse = string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const accountTypeListResponse of client.tenants.accountTypes.list('tenant_id')) { console.log(accountTypeListResponse); } ``` #### Response ```json { "errors": [], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ "string" ], "success": true } ``` ## Domain Types ### Account Type List Response - `AccountTypeListResponse = string` # Accounts ## List tenant accounts `client.tenants.accounts.list(stringtenantId, RequestOptionsoptions?): SinglePage` **get** `/tenants/{tenant_id}/accounts` List of accounts for the Tenant. ### Parameters - `tenantId: string` ### Returns - `TenantAccount` - `id: string` - `created_on: string` - `name: string | null` - `settings: Settings` - `abuse_contact_email: string | null` - `access_approval_expiry: string | null` - `api_access_enabled: boolean | null` - `default_nameservers: string | null` Use [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-list-dns-settings) instead. Deprecated. - `enforce_twofactor: boolean | null` - `use_account_custom_ns_by_default: boolean | null` Use [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-list-dns-settings) instead. Deprecated. - `type: "standard" | "enterprise"` - `"standard"` - `"enterprise"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const tenantAccount of client.tenants.accounts.list('tenant_id')) { console.log(tenantAccount.id); } ``` #### 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 - `TenantAccount` - `id: string` - `created_on: string` - `name: string | null` - `settings: Settings` - `abuse_contact_email: string | null` - `access_approval_expiry: string | null` - `api_access_enabled: boolean | null` - `default_nameservers: string | null` Use [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-list-dns-settings) instead. Deprecated. - `enforce_twofactor: boolean | null` - `use_account_custom_ns_by_default: boolean | null` Use [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-list-dns-settings) instead. Deprecated. - `type: "standard" | "enterprise"` - `"standard"` - `"enterprise"` # Entitlements ## List tenant entitlements `client.tenants.entitlements.get(stringtenantId, RequestOptionsoptions?): TenantEntitlements` **get** `/tenants/{tenant_id}/entitlements` List of innate entitlements available for the Tenant. ### Parameters - `tenantId: string` ### Returns - `TenantEntitlements` - `allow_add_subdomain: AllowAddSubdomain` - `type: "bool"` - `"bool"` - `value: boolean` - `allow_auto_accept_invites: AllowAutoAcceptInvites` - `type: "bool"` - `"bool"` - `value: boolean` - `cname_setup_allowed: CNAMESetupAllowed` - `type: "bool"` - `"bool"` - `value: boolean` - `custom_entitlements: Array | null` - `allocation: OrganizationsAPIMaxCountAllocation | OrganizationsAPIBoolAllocation | OrganizationsAPINullAllocation` - `OrganizationsAPIMaxCountAllocation` - `type: "max_count"` - `"max_count"` - `value: number` - `OrganizationsAPIBoolAllocation` - `type: "bool"` - `"bool"` - `value: boolean` - `OrganizationsAPINullAllocation` - `type: ""` - `""` - `value?: unknown` - `feature: Feature` - `key: string` - `mhs_certificate_count: MhsCertificateCount` - `type: "max_count"` - `"max_count"` - `value: number` - `partial_setup_allowed: PartialSetupAllowed` - `type: "bool"` - `"bool"` - `value: boolean` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const tenantEntitlements = await client.tenants.entitlements.get('tenant_id'); console.log(tenantEntitlements.allow_add_subdomain); ``` #### 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 - `TenantEntitlements` - `allow_add_subdomain: AllowAddSubdomain` - `type: "bool"` - `"bool"` - `value: boolean` - `allow_auto_accept_invites: AllowAutoAcceptInvites` - `type: "bool"` - `"bool"` - `value: boolean` - `cname_setup_allowed: CNAMESetupAllowed` - `type: "bool"` - `"bool"` - `value: boolean` - `custom_entitlements: Array | null` - `allocation: OrganizationsAPIMaxCountAllocation | OrganizationsAPIBoolAllocation | OrganizationsAPINullAllocation` - `OrganizationsAPIMaxCountAllocation` - `type: "max_count"` - `"max_count"` - `value: number` - `OrganizationsAPIBoolAllocation` - `type: "bool"` - `"bool"` - `value: boolean` - `OrganizationsAPINullAllocation` - `type: ""` - `""` - `value?: unknown` - `feature: Feature` - `key: string` - `mhs_certificate_count: MhsCertificateCount` - `type: "max_count"` - `"max_count"` - `value: number` - `partial_setup_allowed: PartialSetupAllowed` - `type: "bool"` - `"bool"` - `value: boolean` # Memberships ## List tenant memberships `client.tenants.memberships.list(stringtenantId, RequestOptionsoptions?): SinglePage` **get** `/tenants/{tenant_id}/memberships` List of active members (Cloudflare users) for the Tenant. ### Parameters - `tenantId: string` ### Returns - `TenantMembership` - `user_email: string` - `user_name: string` - `user_tag: string` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const tenantMembership of client.tenants.memberships.list('tenant_id')) { console.log(tenantMembership.user_email); } ``` #### 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 - `TenantMembership` - `user_email: string` - `user_name: string` - `user_tag: string`