アカウントの管理
Each customer or team that uses Cloudflare should have their own account. This ensures proper security and access of resources. Each account acts as a container of zones and other resources. Depending on your needs, you may even provision multiple accounts for a single customer or team.
When you create an account with the Tenant API, your Cloudflare user owns that account from creation, ongoing management, and finally deletion.
Each customer or team that uses Cloudflare should have their own account. This ensures proper security and access of resources. Each account acts as a container of zones and other resources. Depending on your needs, you may even provision multiple accounts for a single customer or team.
When you create an account with the Tenant API, your Cloudflare user owns that account from creation, ongoing management, and finally deletion.
To create an account under your tenant using the dashboard:
- Log into the Cloudflare dashboard ↗.
- Go to Tenants > Managed Accounts.
- Select Create Account.
- Enter the Account Name, Account Description, and Tenant Unit.
- Choose the appropriate account subscription.
- Select Add Account.
To create an account using the API, make a POST request to the /accounts endpoint and include the following values:
-
namestring- The name of the account that is displayed in the Cloudflare dashboard.
-
typeenum- Valid values are
standard(default) andenterprise. For self-serve customers, usestandard. For enterprise customers, useenterprise.
- Valid values are
-
unitobject-
Information related to the tenant unit.
-
idstring- (optional) ID of the unit to create this account on. Needs to be specified if user administers multiple tenants. Unit ID is the
unit_tagfrom your tenant details.
- (optional) ID of the unit to create this account on. Needs to be specified if user administers multiple tenants. Unit ID is the
-
All KYC parameters are text fields, have a 120 character limit, and are optional unless enforced by the Tenant.
-
business_namestring- (optional) The name of the business associated with this account.
-
business_addressstring- (optional) The address of the business associated with this account.
-
business_emailstring- (optional) The email of the business associated with this account.
-
business_phonestring- (optional) The phone number of the business associated with this account.
-
external_metadatastring- (optional) External metadata for this account.
curl "https://api.cloudflare.com/client/v4/accounts" \--header "X-Auth-Email: <EMAIL>" \--header "X-Auth-Key: <API_KEY>" \--header "Content-Type: application/json" \--data '{ "name": "<ACCOUNT_NAME>", "type": "standard"}'A successful request will return an HTTP status of 200 and the following response body:
{ "result": { "id": "2bab6ace8c72ed3f09b9eca6db1396bb", "name": "<ACCOUNT_NAME>", "type": "standard", "settings": { "enforce_twofactor": false } }, "success": true, "errors": [], "messages": []}A request with a unit ID:
curl "https://api.cloudflare.com/client/v4/accounts" \--header "X-Auth-Email: <EMAIL>" \--header "X-Auth-Key: <API_KEY>" \--header "Content-Type: application/json" \--data '{ "name": "<ACCOUNT_NAME>", "type": "standard", "unit": { "id": "1a2b3c4d5e6f7g8h" }}'A request with a unit ID and KYC:
curl "https://api.cloudflare.com/client/v4/accounts" \--header "X-Auth-Email: <EMAIL>" \--header "X-Auth-Key: <API_KEY>" \--header "Content-Type: application/json" \--data '{ "name": "<ACCOUNT_NAME>", "type": "standard", "business_name": "Cloudflare", "business_email": "email@business.com", "business_address": "San Francisco", "business_phone": "1234567890", "external_metadata": "{'\''testKey'\'': '\''testValue'\''}", "unit": { "id": "1a2b3c4d5e6f7g8h" }}'テナントAPIを使用してアカウントを作成すると、Cloudflareユーザーがそのアカウントを作成から管理、最終的な削除まで所有します。
ダッシュボードを使用して、テナントが所有するアカウントを表示するには:
- Cloudflareダッシュボード ↗にログインします。
- テナント > 管理アカウントに移動します。
APIを使用してテナントが所有するアカウントを取得するには、GETリクエストを/accountsエンドポイントに送信します。
作成したすべてのアカウントと、ユーザーがすでにアクセス権を持っているアカウントのリストが返されます。
curl https://api.cloudflare.com/client/v4/accounts \--header "X-Auth-Email: <EMAIL>" \--header "X-Auth-Key: <API_KEY>"{ "result": [ { "id": "a34bd6cc645a31486aa2ef71f1b9afb6", "name": "私の個人アカウント", "settings": { "enforce_twofactor": false } }, { "id": "1b16db169c9cb7853009857198fae1b9", "name": "作成されたアカウント", "settings": { "enforce_twofactor": false } } ], "result_info": { "page": 1, "per_page": 20, "total_pages": 1, "count": 2, "total_count": 2 }, "success": true, "errors": [], "messages": []}アカウントを更新するには、PUTリクエストを/accounts/{account_id}エンドポイントに送信します。
作成したアカウントを削除するには、DELETEリクエストを/accounts/{account_id}エンドポイントに送信します。
アカウントの削除は永久的であり、そのアカウントに関連するゾーンやその他のリソースも削除されます。
curl --request DELETE \https://api.cloudflare.com/client/v4/accounts/{account_id} \--header "X-Auth-Email: <EMAIL>" \--header "X-Auth-Key: <API_KEY>"成功したリクエストは、操作を確認するためのidを返します:
{ "result": { "id": "1b16db169c9cb7853009857198fae1b9" }, "success": true, "errors": [], "messages": []}