# Open a console session

`POST https://console.advinservers.com/api/v1/client/servers/{server}/create-console-session`

### Overview

Creates a connection through the integrated console proxy. Send `type` as `novnc` for a graphical console or `xtermjs` for a serial console. Connect to `websocket_url` immediately, from a browser on any website or from your own server. The single-use connection token expires after 30 seconds. For a graphical console, use `password` as the VNC password. Serial authentication is handled by the proxy. Request a new session after every disconnect, including a server restart. The existing `is_tls_enabled`, `fqdn`, `port` and `token` fields describe the panel connection. A temporary failure returns `503`; retry after the delay in `Retry-After`.

### Permissions

Requires the `server.console` (Use the console) 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

## Body

Sent as `application/json`.

- `type` (string, required): The type of operation or resource. One of: `novnc`, `xtermjs`.

## Response 200

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

- `is_tls_enabled` (boolean, required): Whether is tls is enabled.
- `fqdn` (string, required): The value of `fqdn`.
- `port` (integer, required): The value of `port`.
- `token` (string, required): The value of `token`.
- `websocket_url` (string, required): Single-use socket address. Request a new session after disconnecting.
- `password` (string | null, required): Temporary VNC password; null for a serial console.

```json
{
  "is_tls_enabled": true,
  "fqdn": "vps.advinservers.com",
  "port": 443,
  "token": "YSAH2tawwS9CGsecn2x66O42hhTY2B8a1u5TaFRCX5NjnhA8ZUKuHw9FsZZfM4tT",
  "websocket_url": "wss://vps.advinservers.com/console/socket/YSAH2tawwS9CGsecn2x66O42hhTY2B8a1u5TaFRCX5NjnhA8ZUKuHw9FsZZfM4tT",
  "password": "hdFC1nD+9/XQCGKax8QCP59CZQadQHw3A6Xsk1wvb+KT"
}
```

## 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.
- `422`: A field is missing or invalid, or the resource cannot accept this change in its current state. Check `message` for details. Field validation also includes an `errors` object keyed by field name.
- `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.

## Example request

```bash
curl --request POST \
  --url 'https://console.advinservers.com/api/v1/client/servers/{server}/create-console-session' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "type": "novnc"
}'
```
