# Get a server's live status

`GET https://console.advinservers.com/api/v1/client/servers/{server}/state`

### Overview

Returns the server's current power state, CPU usage, memory usage and uptime. This queries the server directly and may be slower than reading the cached server details. During a power operation, the state is `starting`, `stopping`, `shutting_down` or `restarting`. It returns to `running` or `stopped` when the operation completes or times out. Returns 503 with a `message` if the host cannot be reached.

### Permissions

Requires the `server.read` (View servers) permission for the selected team. Resources outside that team return 404.

## Authorization

Send `Authorization: Bearer <token>` with the request. Your API key, sent as a bearer token. Create one in the control panel under API Keys, give it only the permissions the integration needs, and copy it when it is created. It cannot be shown again. Each key is restricted to one owned team. The key determines the team for every request.

## Path parameters

- `server` (string, required): The server uuid short

## Response 200

The record, as a JSON object. There is no envelope.

- `state` (string, required): The billing state, province, or region, or null or an empty string to clear it. One of: `stopped`, `running`, `stopping`, `starting`, `shutting_down`, `restarting`.
- `cpu_used` (number, required): The value of `cpu_used`.
- `memory_total` (integer, required): The value of `memory_total`.
- `memory_used` (integer, required): The value of `memory_used`.
- `uptime` (integer, required): The value of `uptime`.
- `lock` (string | null, required): The value of `lock`.
- `qmp_state` (string | null, required): The value of `qmp_state`.

```json
{
  "state": "running",
  "cpu_used": 0.22,
  "memory_total": 4294967296,
  "memory_used": 2164260864,
  "uptime": 1134000,
  "lock": null,
  "qmp_state": "running"
}
```

## Errors

- `401`: The key was missing, malformed, revoked, or belongs to an account that no longer exists.
- `403`: Access denied. Check the key's team, permissions and allowed IP addresses. Some actions, such as managing API keys, require a browser session. The response message explains the reason.
- `404`: The resource was not found in the selected team. Resources in another account or team also return 404.
- `429`: Too many requests. The `Retry-After` header says how many seconds to wait. Limits are per account, so several keys on one account share them.
- `503`: The server power state could not be read.

## Example request

```bash
curl --request GET \
  --url 'https://console.advinservers.com/api/v1/client/servers/{server}/state' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json'
```
