コンテンツにスキップ

始める

Cloudflareのプロビジョニング機能にアクセスすることで、Cloudflareアカウントをより簡単に作成および管理できます。以下の手順に従って、アカウント、ユーザー、およびサービスをプロビジョニングするためのAPI呼び出しを開始します。

始める前に

チャンネルおよびアライアンスパートナーアカウントの設定

テナントAPIを使用する前に、アカウントを作成メールアドレスを確認、および請求情報を追加する必要があります。

Cloudflareとのパートナー契約に署名した後、Cloudflareは特定の権利をあなたのアカウントに追加し、カスタムアカウントをプロビジョニングおよび管理できるようにします。パートナー契約に署名したが、アカウントがまだ有効化されていない場合は、partners@cloudflare.comに連絡してください。

APIアクセス

テナントAPIへのリクエストを認証するために、APIキーを取得する必要があります。

Cloudflare APIの使用に関する詳細は、API概要を参照してください。

ステップ1 - アカウントを作成

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:

  1. Log into the Cloudflare dashboard.
  2. Go to Tenants > Managed Accounts.
  3. Select Create Account.
  4. Enter the Account Name, Account Description, and Tenant Unit.
  5. Choose the appropriate account subscription.
  6. Select Add Account.

ステップ2 - ユーザーアクセスを付与

アカウントを作成したので、顧客にCloudflareへの直接アクセスを提供するか、顧客が操作できるインターフェースを構築する必要があります。

最初の方法では、顧客がCloudflareのすべての側面を制御できるようになりますが、後者の方法では、顧客のCloudflare体験をあなたが制御するダッシュボードに統合できます。

オプション1 - Cloudflareへの直接アクセス

アカウントにユーザーアクセスを付与すると、Cloudflareはユーザーに招待状を送信し、アカウントにアクセスできるようにします。すでにCloudflareユーザーを持っていない場合、Cloudflareはユーザー作成のプロセスを案内します。作成後、アカウントおよびすでに作成されたゾーンにアクセスできるようになります。

ダッシュボードを使用する

顧客に個別のアカウントへのアクセスを提供したい場合は、チームメンバーを招待するのときと同じです。

APIを使用する

APIを使用してCloudflareダッシュボードへのアクセスを付与することもできます。

リクエスト
curl 'https://api.cloudflare.com/client/v4/accounts/<CUSTOMER_ACCOUNT_ID>/members' \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"email": "<CUSTOMER_EMAIL>",
"roles": ["<USER_ROLE>"]
}'

ほとんどの場合、Administratorの役割を持つ新しいユーザーを作成することをお勧めします。この役割は常にID 05784afa30c1afe1440e79d9351c7430を持ちます。

顧客がエンタープライズプランに加入している場合、より広範なユーザー役割にアクセスできます。利用可能な役割の完全なリストを取得するには、APIにGETリクエストを送信してください。

オプション2 - インターフェースを介したアクセス

顧客がCloudflareを使用する方法をより制御したい場合や、顧客がすでに知っている既存のダッシュボードを使用させたい場合は、Cloudflare APIを使用してこの体験を構築してください。

これは、顧客の代理でCloudflareにAPI呼び出しを行うことを意味します。APIによってレート制限を受けないようにするために、Cloudflareは各顧客のためにアカウントとユーザーを作成することを推奨します。顧客Aによって行われた変更はユーザーAを通じて、顧客Bによって行われた変更はユーザーBを通じて行われるべきです。

インターフェースを介してアクセスを付与するには、サービスユーザーを作成する必要があります。誰もダッシュボードにログインしないためです。この方法を使用する予定がある場合、CloudflareはこのユーザーとしてAPI呼び出しを行うためにAPIキーを表示できるようにします。

リクエスト
curl "https://api.cloudflare.com/client/v4/users" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"email": "<ID@example.com>"
}'
レスポンス
{
"result": {
"id": "60758bd48392a06215ae817bc35084b6",
"email": "<ID@example.com>",
"first_name": null,
"last_name": null,
"username": "17bd2796b374cec14976ac3bced85c05",
"telephone": null,
"country": null,
"created_on": "2019-02-21T23:20:28.645256Z",
"modified_on": "2019-02-21T23:20:28.645256Z",
"two_factor_authentication": {
"enabled": false,
"locked": false
},
"api_key": "xxx"
},
"success": true,
"errors": [],
"messages": []
}

ステップ3 - ゾーンを作成

顧客アカウントと顧客ユーザー(またはサービスユーザー)を持っているので、ゾーンを作成する必要があります。

これを行うには、/zonesエンドポイントにPOSTリクエストを送信します(ステップ1で受け取った顧客アカウントIDを含めます)。

リクエスト
curl "https://api.cloudflare.com/client/v4/zones" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"name": "example.com",
"account": {
"id": "<CUSTOMER_ACCOUNT_ID>"
}
}'

ステップ4 - ゾーンプランのサブスクリプションを作成

顧客のためにゾーンがプロビジョニングされたので、リセラー契約に基づいて適切なゾーンプランを追加できます。

To create a zone subscription, typically used to upgrade a zone’s plan from PARTNERS_FREE to a paid Zone plan, send a POST request to the /zones/{zone_id}/subscription endpoint and include the following values:

  • rate_plan object

    • Contains the zone plan corresponding to what customers would order in the dashboard. For a list of available values, refer to Zone subscriptions.
  • component_values array

    • Additional services depending on your reseller agreement, such as additional page_rules.
  • frequency string

    • How often the subscription is renewed automatically (defaults to "monthly").
Request (without `component_values`)
curl 'https://api.cloudflare.com/client/v4/zones/{zone_id}/subscription' \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"rate_plan": {
"id": "<RATE_PLAN>"
},
"frequency": "annual"
}'
Request (with `component_values`)
curl 'https://api.cloudflare.com/client/v4/zones/{zone_id}/subscription' \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"rate_plan": {
"id": "PARTNERS_BIZ"
},
"component_values": [
{
"name": "page_rules",
"value": 50
}
]
}

ステップ5 - その他のサブスクリプションを作成

契約に応じて、他のアドオンサービスを再販することが許可される場合があります。これらはアカウントレベルのサブスクリプションとしてプロビジョニングされます。

To create an account subscription, send a POST request to the /accounts/{account_id}/subscriptions endpoint and include the following values:

  • rate_plan object

    • Contains the account subscription corresponding to a specific add-on service. For a list of available values, refer to Available subscriptions.
  • component_values array

    • Additional services depending on your reseller agreement, such as additional endpoints for load balancing or additional seats for Cloudflare Zero Trust. If not included, the subscription includes the default values associated with each purchase.
  • frequency string

    • How often the subscription is renewed automatically (defaults to "monthly").
Request
curl 'https://api.cloudflare.com/client/v4/accounts/{account_id}/subscriptions' \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{
"rate_plan": {
"id": "<RATE_PLAN_NAME>"
}
}'

ステップ6 - ゾーンとサービスを構成

必要なサブスクリプションを追加したら、あなたまたは顧客はさまざまなサービスを構成し、アカウントおよびゾーン設定を微調整できます。

構成は、アカウントにアクセスできる人(および正しいユーザー権限を持つ人)によって行うことができます。このプロセスは、他のCloudflareアカウントの構成と異なりません。追加のガイダンスについては、製品ドキュメントを参照してください。