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

# Attach Custom Domain to Application

> Attaches a custom domain to an application by its ID.

<ParamField path="id" type="string" required>
  The ID of the application to attach the custom domain to.
</ParamField>

<ParamField body="custom_domain" type="string" required>
  The custom domain to attach to the application (e.g., `example.com`). Use `"@"` to remove the custom domain.
</ParamField>

### Response

<ResponseExample>
  ```json Response theme={null}
  {}
  ```
</ResponseExample>

### Error Responses

<ResponseField name="code" type="string">
  The error code indicating the reason for failure. Possible values:

  * `UNAUTHORIZED`: The user is not authenticated or lacks sufficient permissions.
  * `PLAN_RESTRICTED_FEATURE`: The user's plan does not support custom domains.
  * `INVALID_CUSTOM_DOMAIN`: No custom domain was provided.
  * `INVALID_CUSTOM_DOMAIN_FORMAT`: The provided domain format is invalid.
  * `FORBIDDEN_DOMAIN`: The provided domain is restricted.
  * `DOMAIN_ALREADY_IN_USE`: The provided domain is already in use by another application.
  * `APP_NOT_FOUND`: The specified application does not exist or does not belong to the user.
  * `USER_LIMITS_NOT_FOUND`: The user's plan limits could not be found.
  * `NO_CONFIG_FILE`: The application's configuration file is missing.
  * `INVALID_CONFIG`: The application's configuration file is invalid.
  * `INVALID_MEMORY`: The requested memory is invalid or exceeds plan limits.
  * `FAILED_TO_REBUILD_APP`: The application could not be rebuilt with the new configuration.
</ResponseField>

<ResponseField name="message" type="string">
  A descriptive message providing additional details about the error.
</ResponseField>

<ResponseExample>
  ```json Error Response (403) theme={null}
  {
    "code": "UNAUTHORIZED"
  }
  ```

  ```json Error Response (400) theme={null}
  {
    "code": "INVALID_CUSTOM_DOMAIN_FORMAT"
  }
  ```

  ```json Error Response (404) theme={null}
  {
    "code": "APP_NOT_FOUND"
  }
  ```
</ResponseExample>
