# PanelAPI ↔ 3x-ui (latest)

## Auth
1. **Bearer token** (recommended): put token from panel  
   `Settings → Security → API Token` into `server_config.api_token`
2. Or username/password → `POST /login` cookie (`3x-ui=...`)

```bash
php tools/migrate_api_token.php
# then UPDATE server_config SET api_token='YOUR_TOKEN' WHERE id=1;
```

## Modern endpoints used
- GET `/panel/api/inbounds/list`
- GET `/panel/api/inbounds/get/{id}`
- POST `/panel/api/clients/add` `{client, inboundIds}`
- POST `/panel/api/clients/update/{email}`
- POST `/panel/api/clients/del/{email}`
- POST `/panel/api/clients/resetTraffic/{email}`
- GET `/panel/api/clients/traffic/{email}`
- GET `/panel/api/clients/links/{email}`
- GET `/panel/api/server/status`
- POST `/panel/api/server/restartXrayService`
- GET `/panel/api/hosts/list`

## Legacy fallbacks
Still tries `/panel/inbound/*` and `/xui/inbound/*` if modern path fails.

## panel type values
`sanaei`, `alireza`, `3x-ui`, `3xui`, `xui`
