[Goto Home](/docs/index.html)

# 🔐 GET `/admin/misc/whitelist-emails`

## Description

- Returns all whitelist emails stored in the misc collection (document id: `common`).
- Admin only (Bearer token required).

## Response Body

```json
{
  "whitelistEmails": ["admin@example.com", "support@example.com"]
}
```

# 🔐 POST `/admin/misc/whitelist-emails`

## Description

- Adds one email to the whitelist emails list in the misc collection.
- Admin only. If the email is already in the list, returns 409.

## Request Body

```json
{
  "email": "newuser@example.com"
}
```

- **email** – string, required, valid email format.

## Response Body

```json
{
  "message": "whitelist email added",
  "whitelistEmails": ["admin@example.com", "support@example.com", "newuser@example.com"]
}
```

# 🔐 DELETE `/admin/misc/whitelist-emails`

## Description

- Removes one email from the whitelist emails list.
- Admin only. Request body must contain the email to remove. Returns 404 if email is not in the list.

## Request Body

```json
{
  "email": "olduser@example.com"
}
```

- **email** – string, required, valid email format.

## Response Body

```json
{
  "message": "whitelist email removed",
  "whitelistEmails": ["admin@example.com", "support@example.com"]
}
```

# 🔐 GET `/admin/misc/whitelist-email-domains`

## Description

- Returns all whitelist email domains stored in the misc collection (e.g. `gmail.com`, `example.com`).
- Admin only.

## Response Body

```json
{
  "whitelistEmailDomains": ["gmail.com", "example.com"]
}
```

# 🔐 POST `/admin/misc/whitelist-email-domains`

## Description

- Adds one domain to the whitelist email domains list.
- Admin only. If the domain is already in the list, returns 409.

## Request Body

```json
{
  "domain": "company.com"
}
```

- **domain** – string, required, min 3, max 253 characters.

## Response Body

```json
{
  "message": "whitelist email domain added",
  "whitelistEmailDomains": ["gmail.com", "example.com", "company.com"]
}
```

# 🔐 DELETE `/admin/misc/whitelist-email-domains`

## Description

- Removes one domain from the whitelist email domains list.
- Admin only. Request body must contain the domain to remove. Returns 404 if domain is not in the list.

## Request Body

```json
{
  "domain": "oldcompany.com"
}
```

- **domain** – string, required, min 3, max 253 characters.

## Response Body

```json
{
  "message": "whitelist email domain removed",
  "whitelistEmailDomains": ["gmail.com", "example.com"]
}
```

# Links

[Goto Home](/docs/index.html)
