---
title: "Send a test email"
---

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

# Send a test email

Path: Nicer API › identity

`POST /identity/email-test`

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

Sends one of the agency's traveler emails, with its brand and sample data, to the caller's own email address. Agency admins only.

## Authentication

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

## Header parameters

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

## Request body

_Required._

- `templateName` (`identity.emailTest.templateName`; string, required)
  - one of `"hotel-confirmation"`, `"flight-confirmation"`, `"car-rental-confirmation"`, `"payment-receipt"`, `"card-request"`, `"itinerary-shared"`, `"trip-invitation"`, `"sign-in-code"`, `"hold-pending"`, `"payment-declined"`, `"booking-cancelled"`, `"welcome-traveler"`, `"traveler-profile-request"`

## Example request

```json
{
  "templateName": "hotel-confirmation"
}
```

## 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.emailTest({
  "templateName": "hotel-confirmation"
});
```

### Nicer CLI

```bash
nicer identity email-test --company "$NICER_COMPANY" --input - <<'JSON'
{
  "templateName": "hotel-confirmation"
}
JSON
```

### cURL

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

### TypeScript

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

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-test"

payload = { "templateName": "hotel-confirmation" }
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
{
  "sentTo": "user@example.com"
}
```

- `sentTo` (`identity.emailTest.response.200.sentTo`; string, required)
  - format: `email` · pattern: `^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$`

### 400

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

#### Example

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

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

### 401

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

#### Example

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

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

### 403

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

#### Example

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

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


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