# Mail Components endpoints (Admin API)

> 8 FeatherPanel Admin API endpoints from admin/mail-components.php: methods, paths, auth, permissions, rate limits, parameters and responses.

Source: https://featherpanel.com/docs/api/reference/admin/mail-components/

Defined in [`backend/app/routes/admin/mail-components.php`](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/routes/admin/mail-components.php). Authentication used here: **Admin**. Read [Authentication](https://featherpanel.com/docs/api/authentication/) for how to send credentials and [Rate limits and errors](https://featherpanel.com/docs/api/rate-limits-and-errors/) for the response envelope.

Paths, methods, permissions and rate limits come from the route file. Summaries, parameters and response codes come from the OpenAPI annotations on the controllers; endpoints without annotations show only what the route file declares.

## Endpoints

### GET `/api/admin/mail-components`

- Auth: Admin
- Permission: `admin.email.templates.view`
- Route name: `admin-mail-components`
- Controller: [`MailComponentsController::index`](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/Controllers/Admin/MailComponentsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/routes/admin/mail-components.php#L26)

```bash
curl -X GET "$PANEL_URL/api/admin/mail-components" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

### POST `/api/admin/mail-components/preview`

- Auth: Admin
- Permission: `admin.email.templates.view`
- Route name: `admin-mail-components-preview`
- Controller: [`MailComponentsController::preview`](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/Controllers/Admin/MailComponentsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/routes/admin/mail-components.php#L37)

```bash
curl -X POST "$PANEL_URL/api/admin/mail-components/preview" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

### POST `/api/admin/mail-components`

- Auth: Admin
- Permission: `admin.email.templates.create`
- Route name: `admin-mail-components-create`
- Controller: [`MailComponentsController::create`](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/Controllers/Admin/MailComponentsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/routes/admin/mail-components.php#L48)

```bash
curl -X POST "$PANEL_URL/api/admin/mail-components" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

### GET `/api/admin/mail-components/{id}`

- Auth: Admin
- Permission: `admin.email.templates.view`
- Route name: `admin-mail-components-show`
- Controller: [`MailComponentsController::show`](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/Controllers/Admin/MailComponentsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/routes/admin/mail-components.php#L59)

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | \- | yes |  |

```bash
curl -X GET "$PANEL_URL/api/admin/mail-components/$ID" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

### PATCH `/api/admin/mail-components/{id}`

- Auth: Admin
- Permission: `admin.email.templates.edit`
- Route name: `admin-mail-components-update`
- Controller: [`MailComponentsController::update`](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/Controllers/Admin/MailComponentsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/routes/admin/mail-components.php#L75)

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | \- | yes |  |

```bash
curl -X PATCH "$PANEL_URL/api/admin/mail-components/$ID" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

### DELETE `/api/admin/mail-components/{id}`

- Auth: Admin
- Permission: `admin.email.templates.delete`
- Route name: `admin-mail-components-delete`
- Controller: [`MailComponentsController::delete`](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/Controllers/Admin/MailComponentsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/routes/admin/mail-components.php#L91)

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | \- | yes |  |

```bash
curl -X DELETE "$PANEL_URL/api/admin/mail-components/$ID" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

### POST `/api/admin/mail-components/{id}/duplicate`

- Auth: Admin
- Permission: `admin.email.templates.create`
- Route name: `admin-mail-components-duplicate`
- Controller: [`MailComponentsController::duplicate`](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/Controllers/Admin/MailComponentsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/routes/admin/mail-components.php#L107)

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | \- | yes |  |

```bash
curl -X POST "$PANEL_URL/api/admin/mail-components/$ID/duplicate" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

### POST `/api/admin/mail-components/{id}/reset`

- Auth: Admin
- Permission: `admin.email.templates.edit`
- Route name: `admin-mail-components-reset`
- Controller: [`MailComponentsController::reset`](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/Controllers/Admin/MailComponentsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/8318da2dee6f7facc161af39e305be7d97407929/backend/app/routes/admin/mail-components.php#L123)

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | \- | yes |  |

```bash
curl -X POST "$PANEL_URL/api/admin/mail-components/$ID/reset" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```
