# DNS Hosts endpoints (Admin API)

> 6 FeatherPanel Admin API endpoints from admin/dns-hosts.php: methods, paths, auth, permissions, rate limits, parameters and responses.

Source: https://featherpanel.com/docs/api/reference/admin/dns-hosts/

Defined in [`backend/app/routes/admin/dns-hosts.php`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/dns-hosts.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/dns-hosts`

- Auth: Admin
- Permission: `admin.webspaces.view`
- Route name: `admin-dns-hosts`
- Controller: [`DnsHostsController::index`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/DnsHostsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/dns-hosts.php#L26)

**List DNS hosts**

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

### GET `/api/admin/dns-hosts/{id}`

- Auth: Admin
- Permission: `admin.webspaces.view`
- Route name: `admin-dns-hosts-show`
- Controller: [`DnsHostsController::show`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/DnsHostsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/dns-hosts.php#L36)

**Show DNS host**

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

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

### PUT `/api/admin/dns-hosts`

- Auth: Admin
- Permission: `admin.webspaces.create`
- Route name: `admin-dns-hosts-create`
- Controller: [`DnsHostsController::create`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/DnsHostsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/dns-hosts.php#L51)

**Create DNS host**

```bash
curl -X PUT "$PANEL_URL/api/admin/dns-hosts" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Plugin events: [`featherpanel:admin:dns_hosts:host:created`](https://featherpanel.com/docs/plugins/events/dns-hosts/#dns-host-created)

### PATCH `/api/admin/dns-hosts/{id}`

- Auth: Admin
- Permission: `admin.webspaces.edit`
- Route name: `admin-dns-hosts-update`
- Controller: [`DnsHostsController::update`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/DnsHostsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/dns-hosts.php#L62)

**Update DNS host**

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

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

Plugin events: [`featherpanel:admin:dns_hosts:host:updated`](https://featherpanel.com/docs/plugins/events/dns-hosts/#dns-host-updated)

### DELETE `/api/admin/dns-hosts/{id}`

- Auth: Admin
- Permission: `admin.webspaces.delete`
- Route name: `admin-dns-hosts-delete`
- Controller: [`DnsHostsController::delete`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/DnsHostsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/dns-hosts.php#L78)

**Delete DNS host**

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

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

Plugin events: [`featherpanel:admin:dns_hosts:host:deleted`](https://featherpanel.com/docs/plugins/events/dns-hosts/#dns-host-deleted)

### POST `/api/admin/dns-hosts/{id}/test`

- Auth: Admin
- Permission: `admin.webspaces.view`
- Route name: `admin-dns-hosts-test`
- Controller: [`DnsHostsController::test`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/DnsHostsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/dns-hosts.php#L94)

**Test PowerDNS on DNS host web node**

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

```bash
curl -X POST "$PANEL_URL/api/admin/dns-hosts/$ID/test" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```
