# LDAP endpoints (Client API: account)

> 3 FeatherPanel Client API: account endpoints from user/ldap.php: methods, paths, auth, permissions, rate limits, parameters and responses.

Source: https://featherpanel.com/docs/api/reference/user/ldap/

Defined in [`backend/app/routes/user/ldap.php`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ldap.php). Authentication used here: **Public**, **Signed-in user**. 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

### PUT `/api/user/auth/ldap/login`

- Auth: Public
- Default rate limit: 10 / minute (`user-auth`)
- Route name: `user-ldap-login`
- Controller: [`LdapController::login`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Auth/LdapController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ldap.php#L26)

**Login via LDAP** Authenticate user against LDAP directory. Supports auto-provisioning if enabled.

Request body: [`LdapLoginRequest`](https://featherpanel.com/docs/api/schemas/#schema-ldaploginrequest) (application/json) · Response data: [`LoginResponse`](https://featherpanel.com/docs/api/schemas/#schema-loginresponse)

| Body field | Type | Required | Description |
| --- | --- | --- | --- |
| `provider_uuid` | string | yes | LDAP provider UUID |
| `username` | string | yes | LDAP username |
| `password` | string | yes | LDAP password |
| `turnstile_token` | string | no | CloudFlare Turnstile token (required if Turnstile is enabled) |

| Response `data` field | Type | Description |
| --- | --- | --- |
| `user` | object | User information |
| `preferences` | object | User preferences |
| `message` | string | Success message |

```bash
curl -X PUT "$PANEL_URL/api/user/auth/ldap/login" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"provider_uuid":"","username":"","password":"","turnstile_token":""}'
```

Plugin events: [`featherpanel:auth:login:failed`](https://featherpanel.com/docs/plugins/events/auth/#auth-login-failed)

Responses: `200` User logged in successfully · `400` Bad request - Missing required fields or invalid data · `401` Unauthorized - Invalid credentials or LDAP authentication failed · `403` Forbidden - Provider disabled or auto-provisioning disabled · `404` Not found - Provider not found · `500` Internal server error

### PUT `/api/user/auth/ldap/link`

- Auth: Signed-in user
- Route name: `user-ldap-link`
- Controller: [`LdapController::link`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Auth/LdapController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ldap.php#L38)

```bash
curl -X PUT "$PANEL_URL/api/user/auth/ldap/link" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```

### DELETE `/api/user/auth/ldap/unlink`

- Auth: Signed-in user
- Route name: `user-ldap-unlink`
- Controller: [`LdapController::unlink`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/User/Auth/LdapController.php)
- [route source](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/routes/user/ldap.php#L48)

```bash
curl -X DELETE "$PANEL_URL/api/user/auth/ldap/unlink" \
  -H "Authorization: Bearer $FEATHERPANEL_API_KEY" \
  -H "Accept: application/json"
```
