# Locations endpoints (Admin API)

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

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

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

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

**Get all locations** Retrieve a paginated list of all locations with optional search functionality.

| 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 locations by name |
| `type` | query | string | no | Filter by location purpose (game = Wings/game servers, vps = VDS/VM nodes, web = web hosting) |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `locations` | Location\[\] |  |
| `pagination` | LocationPagination |  |
| `search` | object |  |

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

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

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

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

**Get location by ID** Retrieve a specific location by its ID.

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

| Response `data` field | Type | Description |
| --- | --- | --- |
| `location` | Location |  |

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

Responses: `200` Location retrieved successfully · `400` Bad request - Invalid location ID · `401` Unauthorized · `403` Forbidden - Insufficient permissions · `404` Location not found

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

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

**Update location** Update an existing location. Only provided fields will be updated. Validates field lengths.

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

Request body: [`LocationUpdate`](https://featherpanel.com/docs/api/schemas/#schema-locationupdate) (application/json)

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | no | Location name |
| `description` | string | no | Location description |
| `flag_code` | string | no | ISO 3166-1 alpha-2 country code (e.g., "us", "ua") for flag display. Set to null to remove the flag. |
| `type` | string | no | Location purpose: game hosting, VPS/VDS, or web hosting (immutable after creation) |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `location` | Location |  |

```bash
curl -X PATCH "$PANEL_URL/api/admin/locations/$ID" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"name":"","description":"","flag_code":"","type":""}'
```

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

Responses: `200` Location updated successfully · `400` Bad request - Invalid JSON, no data provided, invalid data types, or validation errors · `401` Unauthorized · `403` Forbidden - Insufficient permissions · `404` Location not found · `500` Internal server error - Failed to update location

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

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

**Delete location** Permanently delete a location record.

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

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

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

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

Responses: `200` Location deleted successfully · `400` Bad request - Invalid location ID · `401` Unauthorized · `403` Forbidden - Insufficient permissions · `404` Location not found · `500` Internal server error - Failed to delete location

### PUT `/api/admin/locations`

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

**Create new location** Create a new location with name and optional description. Validates field lengths.

Request body: [`LocationCreate`](https://featherpanel.com/docs/api/schemas/#schema-locationcreate) (application/json)

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes | Location name |
| `description` | string | no | Location description |
| `flag_code` | string | no | ISO 3166-1 alpha-2 country code (e.g., "us", "ua") for flag display |
| `type` | string | yes | Location purpose: game hosting, VPS/VDS, or web hosting (immutable after creation) |
| `webhosting_alpha_accepted` | boolean | no | Required to be true when creating a Web Hosting location |
| `id` | integer | no | Optional location ID (useful for migrations from other platforms) |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `location` | Location |  |

```bash
curl -X PUT "$PANEL_URL/api/admin/locations" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"name":"","description":"","flag_code":"","type":"","webhosting_alpha_accepted":false,"id":0}'
```

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

Responses: `201` Location created successfully · `400` Bad request - Invalid JSON, missing required fields, invalid data types, or validation errors · `401` Unauthorized · `403` Forbidden - Insufficient permissions · `500` Internal server error - Failed to create location
