---
title: "Add a booking-site hostname"
---

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

# Add a booking-site hostname

Path: Nicer API › identity

`POST /identity/booking-site/hosts`

URL: `https://api.nicer.travel/identity/booking-site/hosts`

Adds a Nicer subdomain or a custom domain to the agency's booking site, or to an advisor's site when the agency allows advisor pages. A custom domain may instead open the agency's portal or Pay (`app`), which only its admins add. A custom domain starts in PENDING_DNS with the CNAME target to create. Admins add any hostname for the agency; an advisor adds one only for their own page, while the agency allows advisor pages.

## Authentication

- `bearerAuth`, http bearer, header `Authorization`, format `JWT`

## Header parameters

- `x-nicer-company` (`identity.bookingSite.hosts.create.header.x-nicer-company`; string, required) — Company context. Authentication and tenant membership are validated by the API.

## Request body

_Required._

Every option has:

- `kind` (`<option>.kind`; string, required)
- `advisorUserId` (`<option>.advisorUserId`; string, optional)
  - minLength: `1`

One of the following, each adding:

- `object` (`identity.bookingSite.hosts.create.1`)
  - `handle` (`identity.bookingSite.hosts.create.1.handle`; string, required)
    - pattern: `^[a-z0-9](?:[a-z0-9-]{1,38}[a-z0-9])$`
- `object` (`identity.bookingSite.hosts.create.2`)
  - `host` (`identity.bookingSite.hosts.create.2.host`; string, required)
    - maxLength: `253` · pattern: `^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.){2,}[a-z]{2,63}$`
  - `app` (`identity.bookingSite.hosts.create.2.app`; string, optional)
    - one of `"BOOKING"`, `"PORTAL"`, `"PAY"`
  - `preserveTraffic` (`identity.bookingSite.hosts.create.2.preserveTraffic`; boolean, optional)

## Example request

```json
{
  "advisorUserId": "string",
  "handle": "string",
  "kind": "SUBDOMAIN"
}
```

## Code samples

### JavaScript SDK

```javascript
import { createClient } from "@nicertravel/sdk";

const nicer = createClient({
  baseUrl: "https://api.nicer.travel",
  token: process.env.NICER_TOKEN,
  headers: { "x-nicer-company": process.env.NICER_COMPANY },
});

await nicer.identity.bookingSite.hosts.create({
  "handle": "string",
  "kind": "SUBDOMAIN"
});
```

### Nicer CLI

```bash
nicer identity booking-site hosts create --company "$NICER_COMPANY" --input - <<'JSON'
{
  "handle": "string",
  "kind": "SUBDOMAIN"
}
JSON
```

### cURL

```bash
curl --request POST \
  --url https://api.nicer.travel/identity/booking-site/hosts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-nicer-company: string' \
  --data '
{
  "advisorUserId": "string",
  "handle": "string",
  "kind": "SUBDOMAIN"
}
'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/identity/booking-site/hosts';
const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-nicer-company': 'string',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({advisorUserId: 'string', handle: 'string', kind: 'SUBDOMAIN'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.nicer.travel/identity/booking-site/hosts"

payload = {
    "advisorUserId": "string",
    "handle": "string",
    "kind": "SUBDOMAIN"
}
headers = {
    "Content-Type": "application/json",
    "x-nicer-company": "string",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "advisorUserId": "string",
  "aliasOf": "string",
  "app": "BOOKING",
  "attempt": 9007199254740991,
  "canonical": true,
  "companyName": "string",
  "createdAt": "string",
  "createdBy": "string",
  "dnsTarget": "string",
  "kind": "SUBDOMAIN",
  "lastError": "string",
  "status": "PENDING_DNS",
  "updatedAt": "string",
  "validationMode": "cloudfront",
  "validationRedirectFrom": "string",
  "validationRedirectTo": "string",
  "host": "string",
  "certificateIssued": true,
  "hasTenant": true
}
```

- `canonical` (`identity.bookingSite.hosts.create.response.200.canonical`; boolean, required)
- `companyName` (`identity.bookingSite.hosts.create.response.200.companyName`; string, required)
  - minLength: `1`
- `createdAt` (`identity.bookingSite.hosts.create.response.200.createdAt`; string, required)
- `createdBy` (`identity.bookingSite.hosts.create.response.200.createdBy`; string, required)
  - minLength: `1`
- `kind` (`identity.bookingSite.hosts.create.response.200.kind`; string, required)
  - one of `"SUBDOMAIN"`, `"CUSTOM"`, `"ALIAS"`
- `status` (`identity.bookingSite.hosts.create.response.200.status`; string, required)
  - one of `"PENDING_DNS"`, `"ISSUING"`, `"ACTIVE"`, `"FAILED_DNS"`, `"FAILED_CERT"`, `"REMOVING"`
- `updatedAt` (`identity.bookingSite.hosts.create.response.200.updatedAt`; string, required)
- `host` (`identity.bookingSite.hosts.create.response.200.host`; string, required)
  - minLength: `1`
- `certificateIssued` (`identity.bookingSite.hosts.create.response.200.certificateIssued`; boolean, required)
- `hasTenant` (`identity.bookingSite.hosts.create.response.200.hasTenant`; boolean, required)
- `advisorUserId` (`identity.bookingSite.hosts.create.response.200.advisorUserId`; string, optional)
  - minLength: `1`
- `aliasOf` (`identity.bookingSite.hosts.create.response.200.aliasOf`; string, optional)
- `app` (`identity.bookingSite.hosts.create.response.200.app`; string, optional)
  - one of `"BOOKING"`, `"PORTAL"`, `"PAY"`
- `attempt` (`identity.bookingSite.hosts.create.response.200.attempt`; integer, optional)
  - maximum: `9007199254740991` · minimum: `0`
- `dnsTarget` (`identity.bookingSite.hosts.create.response.200.dnsTarget`; string, optional)
- `lastError` (`identity.bookingSite.hosts.create.response.200.lastError`; string, optional)
- `validationMode` (`identity.bookingSite.hosts.create.response.200.validationMode`; string, optional)
  - one of `"cloudfront"`, `"self-hosted"`
- `validationRedirectFrom` (`identity.bookingSite.hosts.create.response.200.validationRedirectFrom`; string, optional)
- `validationRedirectTo` (`identity.bookingSite.hosts.create.response.200.validationRedirectTo`; string, optional)

### 400

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`identity.bookingSite.hosts.create.response.400.errorCode`; string, required)
- `errorMessage` (`identity.bookingSite.hosts.create.response.400.errorMessage`; string, required)

### 401

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`identity.bookingSite.hosts.create.response.401.errorCode`; string, required)
- `errorMessage` (`identity.bookingSite.hosts.create.response.401.errorMessage`; string, required)

### 403

Request failed. `errorCode` is stable; `errorMessage` is for humans.

#### Example

```json
{
  "errorCode": "string",
  "errorMessage": "string"
}
```

- `errorCode` (`identity.bookingSite.hosts.create.response.403.errorCode`; string, required)
- `errorMessage` (`identity.bookingSite.hosts.create.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/identity/identity.bookingSite.hosts.create/index.md
