# Lifecycle Hooks endpoints (Client API: game servers)

> 6 FeatherPanel Client API: game servers endpoints from user/server/lifecycle-hooks.php: methods, paths, auth, permissions, rate limits, parameters and responses.

Source: https://featherpanel.com/docs/api/reference/user/server/lifecycle-hooks/

Defined in [`backend/app/routes/user/server/lifecycle-hooks.php`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/lifecycle-hooks.php). Authentication used here: **Server access**. 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/user/servers/{uuidShort}/lifecycle-hooks`

- Auth: Server access
- Default rate limit: 30 / minute (`user-server-lifecycle-hooks`)
- Route name: `session-server-lifecycle-hooks`
- Controller: [`ServerLifecycleHookController::getHooks`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerLifecycleHookController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/lifecycle-hooks.php#L26)

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

```bash
curl -X GET "$PANEL_URL/api/user/servers/$UUID_SHORT/lifecycle-hooks" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

### PUT `/api/user/servers/{uuidShort}/lifecycle-hooks/{hookType}`

- Auth: Server access
- Default rate limit: 15 / minute (`user-server-lifecycle-hooks`)
- Route name: `session-server-lifecycle-hook-upsert`
- Controller: [`ServerLifecycleHookController::upsertHook`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerLifecycleHookController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/lifecycle-hooks.php#L49)

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | \- | yes |  |
| `hookType` | path | \- | yes |  |

```bash
curl -X PUT "$PANEL_URL/api/user/servers/$UUID_SHORT/lifecycle-hooks/$HOOK_TYPE" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Plugin events: [`featherpanel:server:update`](https://featherpanel.com/docs/plugins/events/server/#server-updated)

### POST `/api/user/servers/{uuidShort}/lifecycle-hooks/{hookType}/steps`

- Auth: Server access
- Default rate limit: 15 / minute (`user-server-lifecycle-hooks`)
- Route name: `session-server-lifecycle-hook-step-create`
- Controller: [`ServerLifecycleHookController::createStep`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerLifecycleHookController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/lifecycle-hooks.php#L73)

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | \- | yes |  |
| `hookType` | path | \- | yes |  |

```bash
curl -X POST "$PANEL_URL/api/user/servers/$UUID_SHORT/lifecycle-hooks/$HOOK_TYPE/steps" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Plugin events: [`featherpanel:server:update`](https://featherpanel.com/docs/plugins/events/server/#server-updated)

### PUT `/api/user/servers/{uuidShort}/lifecycle-hooks/{hookType}/steps/{stepId}`

- Auth: Server access
- Default rate limit: 15 / minute (`user-server-lifecycle-hooks`)
- Route name: `session-server-lifecycle-hook-step-update`
- Controller: [`ServerLifecycleHookController::updateStep`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerLifecycleHookController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/lifecycle-hooks.php#L97)

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | \- | yes |  |
| `hookType` | path | \- | yes |  |
| `stepId` | path | \- | yes |  |

```bash
curl -X PUT "$PANEL_URL/api/user/servers/$UUID_SHORT/lifecycle-hooks/$HOOK_TYPE/steps/$STEP_ID" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Plugin events: [`featherpanel:server:update`](https://featherpanel.com/docs/plugins/events/server/#server-updated)

### PUT `/api/user/servers/{uuidShort}/lifecycle-hooks/{hookType}/steps/{stepId}/sequence`

- Auth: Server access
- Default rate limit: 10 / minute (`user-server-lifecycle-hooks`)
- Route name: `session-server-lifecycle-hook-step-sequence`
- Controller: [`ServerLifecycleHookController::updateStepSequence`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerLifecycleHookController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/lifecycle-hooks.php#L122)

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | \- | yes |  |
| `hookType` | path | \- | yes |  |
| `stepId` | path | \- | yes |  |

```bash
curl -X PUT "$PANEL_URL/api/user/servers/$UUID_SHORT/lifecycle-hooks/$HOOK_TYPE/steps/$STEP_ID/sequence" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Plugin events: [`featherpanel:server:update`](https://featherpanel.com/docs/plugins/events/server/#server-updated)

### DELETE `/api/user/servers/{uuidShort}/lifecycle-hooks/{hookType}/steps/{stepId}`

- Auth: Server access
- Default rate limit: 10 / minute (`user-server-lifecycle-hooks`)
- Route name: `session-server-lifecycle-hook-step-delete`
- Controller: [`ServerLifecycleHookController::deleteStep`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Server/ServerLifecycleHookController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/server/lifecycle-hooks.php#L147)

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `uuidShort` | path | \- | yes |  |
| `hookType` | path | \- | yes |  |
| `stepId` | path | \- | yes |  |

```bash
curl -X DELETE "$PANEL_URL/api/user/servers/$UUID_SHORT/lifecycle-hooks/$HOOK_TYPE/steps/$STEP_ID" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

Plugin events: [`featherpanel:server:update`](https://featherpanel.com/docs/plugins/events/server/#server-updated)
