> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# カスタムドメインの設定

> ウェブサイトをカスタムドメインと連携します。5分あたり10回、24時間あたり50回の変更というレート制限があります。

**このルートを使用するには、少なくとも [Standard プラン](https://squarecloud.app/ja/pricing)が必要です。**

同一アカウントで1つのドメインを複数のアプリケーションに割り当てることができます(ロードバランシング)。Standard では最大2アプリケーション、Pro では5、Enterprise では10まで割り当て可能です。[ロードバランサーの一覧取得](/ja/api-reference/endpoint/apps/network/load-balancers)を参照してください。

<ParamField header="Authorization" type="string" placeholder="API Key" required>
  アカウントの API キーです。これは[アカウント設定](https://squarecloud.app/ja/account/security)で確認できます。
</ParamField>

### パラメータ

<ParamField path="app_id" type="string" placeholder="Application ID" required>
  アプリケーションのID。アプリケーションのダッシュボードのURLで確認できます。
</ParamField>

<ParamField body="custom" type="string" placeholder="example.com" required>
  割り当てる完全修飾ドメイン名、またはアプリケーションの現在のカスタムドメインを削除する場合は `@`。Square Cloud のドメイン(`squareweb.app`、`squarecloud.app`、...)は使用できません。
</ParamField>

### レスポンス

<ResponseField name="status" type="string">
  呼び出しが成功したかどうかを示します。成功した場合は `success`、失敗した場合は `error` です。
</ResponseField>

失敗時、レスポンスにはエラー `code` が含まれます:

| Status | Code                          | 意味                                                         |
| ------ | ----------------------------- | ---------------------------------------------------------- |
| `400`  | `REGEX_VALIDATION`            | ドメインが有効な完全修飾ドメイン名ではありません。                                  |
| `400`  | `RESERVED_DOMAIN`             | Square Cloud のドメインはカスタムドメインとして使用できません。                     |
| `403`  | `UPGRADE_REQUIRED`            | 有効なプランにカスタムドメインが含まれていません(Standard、Pro、または Enterprise が必要)。 |
| `403`  | `LOAD_BALANCER_LIMIT_REACHED` | このドメインに割り当て可能なアプリケーション数のプラン上限に達しました。                       |
| `409`  | `DOMAIN_ALREADY_EXISTS`       | このドメインは既に別のアカウントが所有するアプリケーションに割り当てられています。                  |
| `502`  | `DNS_FAILED`                  | エッジプロバイダー側でドメインの割り当てに失敗しました。                               |

<ResponseExample>
  ```json theme={null}
  {
      "status": "success"
  }
  ```
</ResponseExample>
