---
title: "Set the email sending domain"
---

> 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.

# Set the email sending domain

Path: Nicer API › identity

`PUT /identity/email-domain`

URL: `https://api.nicer.travel/identity/email-domain`

Starts sending the agency's emails from its own domain: registers the domain with the email service under a sender identity of the agency's own and returns the three DKIM records to add. Emails keep coming from Nicer's domain until they verify. A different domain replaces the current one; the same domain again changes nothing. Agency admins only.

## Authentication

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

## Header parameters

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

## Request body

_Required._

- `domain` (`identity.emailDomain.update.domain`; string, required)
  - maxLength: `253` · pattern: `^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$`

## Example request

```json
{
  "domain": "string"
}
```

## 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.emailDomain.update({
  "domain": "string"
});
```

### Nicer CLI

```bash
nicer identity email-domain update --company "$NICER_COMPANY" --input - <<'JSON'
{
  "domain": "string"
}
JSON
```

### cURL

```bash
curl --request PUT \
  --url https://api.nicer.travel/identity/email-domain \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-nicer-company: string' \
  --data '
{
  "domain": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.nicer.travel/identity/email-domain';
const options = {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
    'x-nicer-company': 'string',
    Authorization: 'Bearer <token>'
  },
  body: JSON.stringify({domain: 'string'})
};

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/email-domain"

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

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

print(response.text)
```

## Responses

### 200

OK

#### Example

```json
{
  "domain": "string",
  "from": "string",
  "records": [
    {
      "name": "string",
      "type": "CNAME",
      "value": "string"
    }
  ],
  "status": "NONE"
}
```

- `domain` (`identity.emailDomain.update.response.200.domain`; any of, required)
  - any of the following: `string`, `null`
- `from` (`identity.emailDomain.update.response.200.from`; any of, required)
  - any of the following: `string`, `null`
- `records` (`identity.emailDomain.update.response.200.records`; array of object, required)
  - `name` (`identity.emailDomain.update.response.200.records.name`; string, required)
  - `type` (`identity.emailDomain.update.response.200.records.type`; string, required)
  - `value` (`identity.emailDomain.update.response.200.records.value`; string, required)
- `status` (`identity.emailDomain.update.response.200.status`; string, required)
  - one of `"NONE"`, `"PENDING"`, `"VERIFIED"`, `"FAILED"`

### 400

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

#### Example

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

- `errorCode` (`identity.emailDomain.update.response.400.errorCode`; string, required)
- `errorMessage` (`identity.emailDomain.update.response.400.errorMessage`; string, required)

### 401

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

#### Example

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

- `errorCode` (`identity.emailDomain.update.response.401.errorCode`; string, required)
- `errorMessage` (`identity.emailDomain.update.response.401.errorMessage`; string, required)

### 403

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

#### Example

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

- `errorCode` (`identity.emailDomain.update.response.403.errorCode`; string, required)
- `errorMessage` (`identity.emailDomain.update.response.403.errorMessage`; string, required)


Source: https://docs.nicer.travel/api/identity/identity.emailDomain.update/index.md
