# Allocations endpoints (Admin API)

> 11 FeatherPanel Admin API endpoints from admin/allocations.php: methods, paths, auth, permissions, rate limits, parameters and responses.

Source: https://featherpanel.com/docs/api/reference/admin/allocations/

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

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

**Get all allocations** Retrieve a paginated list of all IP allocations with optional filtering by node, server, and search query.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `page` | query | integer | no | Page number for pagination |
| `limit` | query | integer | no | Number of records per page |
| `search` | query | string | no | Search term to filter allocations by IP, port, or notes |
| `node_id` | query | integer | no | Filter allocations by node ID |
| `server_id` | query | integer | no | Filter allocations by server ID |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `allocations` | Allocation\[\] |  |
| `pagination` | Pagination |  |
| `search` | object |  |

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

Responses: `200` Allocations retrieved successfully · `401` Unauthorized · `403` Forbidden - Insufficient permissions

### PUT `/api/admin/allocations`

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

**Create new allocation(s)** Create one or more IP allocations. Supports single port or port range creation. Port ranges are limited to 1000 ports maximum.

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | integer | no | Optional allocation ID (for migrations) |
| `node_id` | integer | yes | Node ID where allocation will be created |
| `ip` | string | yes | IP address for the allocation |
| `port` | integer | string | yes |  |
| `ip_alias` | string | no | Optional IP alias |
| `server_id` | integer | no | Optional server ID to assign allocation to |
| `notes` | string | no | Optional notes for the allocation |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `allocations` | Allocation\[\] |  |
| `created_count` | integer | Number of allocations created |
| `total_requested` | integer | Total number of ports requested |
| `skipped_count` | integer | Number of ports skipped (already exist) |
| `existing_ports` | integer\[\] | List of ports that already existed |

```bash
curl -X PUT "$PANEL_URL/api/admin/allocations" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"id":0,"node_id":0,"ip":"","port":0,"ip_alias":"","server_id":0,"notes":""}'
```

Plugin events: [`featherpanel:admin:allocations:allocation:created`](https://featherpanel.com/docs/plugins/events/allocations/#allocation-created)

Responses: `201` Allocation(s) created successfully · `400` Bad request - Invalid data or validation errors · `401` Unauthorized · `403` Forbidden - Insufficient permissions

### GET `/api/admin/allocations/available`

- Auth: Admin
- Permission: `admin.allocations.view`
- Route name: `admin-allocations-available`
- Controller: [`AllocationsController::getAvailable`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/AllocationsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/allocations.php#L51)

**Get available allocations** Retrieve a paginated list of allocations that are not assigned to any server. Optionally filter by node.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `page` | query | integer | no | Page number for pagination |
| `limit` | query | integer | no | Number of records per page |
| `node_id` | query | integer | no | Filter available allocations to a specific node |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `allocations` | Allocation\[\] |  |
| `pagination` | object |  |

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

Responses: `200` Available allocations retrieved successfully · `401` Unauthorized · `403` Forbidden - Insufficient permissions

### DELETE `/api/admin/allocations/bulk-delete`

- Auth: Admin
- Permission: `admin.allocations.delete`
- Route name: `admin-allocations-bulk-delete`
- Controller: [`AllocationsController::bulkDelete`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/AllocationsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/allocations.php#L62)

**Bulk delete allocations** Delete multiple allocations at once by providing an array of allocation IDs. Only unassigned allocations will be deleted. Allocations assigned to servers will be skipped.

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `ids` | integer\[\] | yes | Array of allocation IDs to delete |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `deleted_count` | integer | Number of allocations deleted |
| `skipped_count` | integer | Number of allocations skipped (assigned to servers) |
| `skipped_ids` | integer\[\] | IDs of allocations that were skipped |

```bash
curl -X DELETE "$PANEL_URL/api/admin/allocations/bulk-delete" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"ids":[]}'
```

Plugin events: [`featherpanel:admin:allocations:allocation:deleted`](https://featherpanel.com/docs/plugins/events/allocations/#allocation-deleted)

Responses: `200` Allocations deleted successfully · `400` Bad request - Invalid or missing IDs · `401` Unauthorized · `403` Forbidden - Insufficient permissions

### DELETE `/api/admin/allocations/delete-unused`

- Auth: Admin
- Permission: `admin.allocations.delete`
- Route name: `admin-allocations-delete-unused`
- Controller: [`AllocationsController::deleteUnused`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/AllocationsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/allocations.php#L74)

**Delete unused allocations** Delete all allocations that are not assigned to any server. Optionally filter by node ID and/or IP address (subnet).

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `node_id` | integer | no | Optional node ID to filter deletions |
| `ip` | string | no | Optional IP address to filter deletions by subnet/IP |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `deleted_count` | integer | Number of allocations deleted |

```bash
curl -X DELETE "$PANEL_URL/api/admin/allocations/delete-unused" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"node_id":0,"ip":""}'
```

Plugin events: [`featherpanel:admin:allocations:allocation:deleted`](https://featherpanel.com/docs/plugins/events/allocations/#allocation-deleted)

Responses: `200` Unused allocations deleted successfully · `400` Bad request - Invalid node ID or IP address · `401` Unauthorized · `403` Forbidden - Insufficient permissions

### PATCH `/api/admin/allocations/bulk-address`

- Auth: Admin
- Permission: `admin.allocations.edit`
- Route name: `admin-allocations-bulk-address`
- Controller: [`AllocationsController::bulkUpdateAddress`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/AllocationsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/allocations.php#L86)

**Bulk update allocation IP or alias** Update the IP address and/or IP alias for every allocation on a node that currently uses a specific IP address.

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `node_id` | integer | yes | Node ID containing the allocations |
| `from_ip` | string | yes | Current allocation IP address |
| `to_ip` | string | no | New allocation IP address |
| `ip_alias` | string | no | New IP alias. Send null or an empty string to clear it. |

```bash
curl -X PATCH "$PANEL_URL/api/admin/allocations/bulk-address" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"node_id":0,"from_ip":"","to_ip":"","ip_alias":""}'
```

Plugin events: [`featherpanel:admin:allocations:allocation:updated`](https://featherpanel.com/docs/plugins/events/allocations/#allocation-updated)

Responses: `200` Allocations updated successfully · `400` Bad request - Invalid data · `401` Unauthorized · `403` Forbidden - Insufficient permissions · `404` Node or matching allocations not found · `409` Target IP has ports already assigned to another server

### GET `/api/admin/allocations/{id}`

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

**Get allocation by ID** Retrieve a specific allocation by its ID with associated node and server information.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Allocation ID |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `allocation` | Allocation |  |

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

Responses: `200` Allocation retrieved successfully · `400` Invalid ID format · `401` Unauthorized · `403` Forbidden - Insufficient permissions · `404` Allocation not found

### PATCH `/api/admin/allocations/{id}`

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

**Update allocation** Update an existing allocation. Only provided fields will be updated. IP and port combinations must be unique per node.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Allocation ID |

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `node_id` | integer | no | Node ID |
| `ip` | string | no | IP address |
| `port` | integer | no | Port number |
| `ip_alias` | string | no | IP alias |
| `server_id` | integer | no | Server ID to assign allocation to |
| `notes` | string | no | Allocation notes |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `allocation` | Allocation |  |

```bash
curl -X PATCH "$PANEL_URL/api/admin/allocations/$ID" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"node_id":0,"ip":"","port":0,"ip_alias":"","server_id":0,"notes":""}'
```

Plugin events: [`featherpanel:admin:allocations:allocation:updated`](https://featherpanel.com/docs/plugins/events/allocations/#allocation-updated)

Responses: `200` Allocation updated successfully · `400` Bad request - Invalid data or validation errors · `401` Unauthorized · `403` Forbidden - Insufficient permissions · `404` Allocation not found

### DELETE `/api/admin/allocations/{id}`

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

**Delete allocation** Permanently delete an allocation. This action cannot be undone. Only unassigned allocations can be deleted.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Allocation ID |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `message` | string | Success message |

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

Plugin events: [`featherpanel:admin:allocations:allocation:deleted`](https://featherpanel.com/docs/plugins/events/allocations/#allocation-deleted)

Responses: `200` Allocation deleted successfully · `400` Bad request - Failed to delete allocation · `401` Unauthorized · `403` Forbidden - Insufficient permissions · `404` Allocation not found · `409` Conflict - Allocation is assigned to a server

### POST `/api/admin/allocations/{id}/assign`

- Auth: Admin
- Permission: `admin.allocations.edit`
- Route name: `admin-allocations-assign`
- Controller: [`AllocationsController::assignToServer`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/AllocationsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/allocations.php#L149)

**Assign allocation to server** Assign an unassigned allocation to a specific server.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Allocation ID |

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `server_id` | integer | yes | Server ID to assign allocation to |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `allocation` | Allocation |  |

```bash
curl -X POST "$PANEL_URL/api/admin/allocations/$ID/assign" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"server_id":0}'
```

Responses: `200` Allocation assigned to server successfully · `400` Bad request - Invalid server ID or assignment failed · `401` Unauthorized · `403` Forbidden - Insufficient permissions · `404` Allocation not found

### POST `/api/admin/allocations/{id}/unassign`

- Auth: Admin
- Permission: `admin.allocations.edit`
- Route name: `admin-allocations-unassign`
- Controller: [`AllocationsController::unassignFromServer`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/AllocationsController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/admin/allocations.php#L166)

**Unassign allocation from server** Remove the server assignment from an allocation, making it available for reassignment.

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Allocation ID |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `allocation` | Allocation |  |

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

Responses: `200` Allocation unassigned from server successfully · `400` Bad request - Allocation not assigned or unassignment failed · `401` Unauthorized · `403` Forbidden - Insufficient permissions · `404` Allocation not found
