# Build the one-click apply URL for a domain

> Build the one-click apply URL for a domain: CustomDomain™ API reference in the templates group. Covers parameters, request body, responses and error codes.

Source: https://docs.customdomain.ai/docs/api-reference/templates/buildTemplateApplyUrl

## `POST https://api.customdomain.ai/v1/templates/{serviceId}/apply-url`

### Authentication

None.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceId` | path | string | yes |  |

### Request body (JSON)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `domain` | string | yes |  |
| `host` | string | no |  |
| `provider_base` | string | yes |  |
| `vars` | object | no | The template's caller-supplied variables, the same set `POST /connections/{id}/domainconnect:start` takes. `edgeIp` and `edgeIp6` are set by the server; naming one, or a variable the template does not take, answers `400 invalid_request`. An unknown template answers `404`. |

### Responses

| Status | Description |
| --- | --- |
| `200` | apply_url |
| `400` | Error envelope: {code, title, details}. |
| `404` | Error envelope: {code, title, details}. |
| `503` | Error envelope: {code, title, details}. |

### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `apply_url` | string | no |  |

The full specification is served at `GET https://api.customdomain.ai/v1/openapi.json`.
