API documentation Web hosting accessible to everyone Visit LWS

Aggiungere una chiave SSH

POST /api/v1/ssh-keys

operationIdpostSshKey

Livello richiesto
Operatività
Quota
modifica, 300 chiamate all'ora

Registra una chiave pubblica sull'account. La chiave è attiva fin dalla creazione.

La chiave viene rifiutata se il suo algoritmo non è riconosciuto o se si tratta di una RSA inferiore a 2048 bit. La risposta riporta la scheda della chiave: ne annoti l'id, necessario per disattivarla o eliminarla. Se non è stato possibile rileggere la scheda, la risposta si limita a {"created": true}: in tal caso ritrovi la chiave con GET /ssh-keys.

Request body

  • key string

    Chiave pubblica OpenSSH, così come nel file .pub

    required
Example request
{
  "key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINK0AO80+x734if/v0cHQXq3DTEQDjY2M0t6Mm3lDOiC poste-admin"
}

Responses

201

Chiave registrata

{
  "data": {
    "id": "47",
    "type": "ssh-ed25519",
    "comment": "poste-admin",
    "active": true,
    "fingerprint": "SHA256:lpEBpHL5EO65b9cDXg8YjfqlnovHfCn+3faPLPbfnZI",
    "fingerprint_md5": "ab:c7:15:6a:9a:4e:fb:02:1b:b8:ab:3f:e5:41:67:a2",
    "weak": false
  }
}
Response fields 8
  • data object required
  • id string

    Example: 47

  • type string

    Example: ssh-ed25519

  • comment string

    Commento incluso nella chiave

  • fingerprint string

    Impronta SHA-256, formato ssh-keygen -l

  • fingerprint_md5 string

    Impronta MD5, quella mostrata dal pannello

  • active boolean

    Installata automaticamente alla creazione o alla reinstallazione di un VPS

  • weak boolean

    Chiave ereditata che oggi verrebbe rifiutata in fase di aggiunta (RSA inferiore a 2048 bit): elencata per poter essere disattivata o eliminata, rifiutata alla reinstallazione

400

Parametri non validi: validation_failed — chiave illeggibile, di tipo sconosciuto o RSA inferiore a 2048 bit.

{
  "type": "https://docs.lws.fr/kvm/errors/validation-failed",
  "title": "Paramètres invalides",
  "status": 400,
  "code": "validation_failed",
  "detail": "Clé SSH refusée. Attendu : une clé publique OpenSSH d'un type reconnu, les clés RSA devant faire au moins 2048 bits.",
  "request_id": "3f9a1c07b2e45d18",
  "errors": {
    "key": "Clé SSH refusée. Attendu : une clé publique OpenSSH d'un type reconnu, les clés RSA devant faire au moins 2048 bits."
  }
}
Response fields 18
  • type string (uri)

    Example: https://docs.lws.fr/kvm/errors/vm-not-found

    required
  • title string

    Titolo breve

    Example: VPS introuvable

    required
  • status integer (int64)

    Stato HTTP

    Example: 404

    required
  • code string

    Codice macchina stabile (vedere «Errori» in Per iniziare)

    Example: vm_not_found

    required
  • detail string

    Messaggio dettagliato

    Example: Aucun VPS 999999 sur ce compte.

    required
  • request_id string

    Identificativo della richiesta, da comunicare al supporto

    Example: 3f9a1c07b2e45d18

    required
  • errors object

    validation_failed: messaggio per ogni parametro errato

  • required_level string

    insufficient_scope: livello richiesto dall'operazione

    one of: read, exploitation, full

  • task_id string

    task_already_running: task in corso su questo VPS

    Example: tsk_000002d5

  • family string

    rate_limited: famiglia di quota esaurita

    one of: read, mutation, heavy

  • limit integer (int64)

    rate_limited: limite orario della famiglia

  • retry_after integer (int64)

    rate_limited: secondi da attendere

  • lock string

    server_locked: blocco impostato dall'hypervisor (backup, snapshot, suspended…)

    Example: snapshot

  • reason string

    server_locked: operation_in_progress, è in corso un'operazione, riprovi dopo Retry-After; suspended, il VPS è in ibernazione, lo avvii prima; support_notified, blocco anomalo, il team LWS è stato avvisato e sta intervenendo

    one of: operation_in_progress, suspended, support_notified

  • maintenance object

    server_maintenance: natura dell'intervento, inizio e fine prevista (null per un incidente)

  • kind string

    one of: works, incident

  • started_at string (date-time)
  • expected_end string (date-time)
401

Autenticazione rifiutata: invalid_token — intestazione Authorization assente o non valida, oppure chiave sconosciuta; access_disabled — accesso API disattivato per questo account, oppure servizio API momentaneamente sospeso da LWS.

intestazione Authorization assente o non valida, oppure chiave sconosciuta

{
  "type": "https://docs.lws.fr/kvm/errors/invalid-token",
  "title": "Authentification invalide",
  "status": 401,
  "code": "invalid_token",
  "detail": "Clé inconnue ou révoquée.",
  "request_id": "3f9a1c07b2e45d18"
}

accesso API disattivato per questo account, oppure servizio API momentaneamente sospeso da LWS

{
  "type": "https://docs.lws.fr/kvm/errors/access-disabled",
  "title": "Accès API désactivé",
  "status": 401,
  "code": "access_disabled",
  "detail": "L'accès API est désactivé pour ce compte. Réactivez-le depuis la page « API / MCP » du panel.",
  "request_id": "3f9a1c07b2e45d18"
}
Response fields 18
  • type string (uri)

    Example: https://docs.lws.fr/kvm/errors/vm-not-found

    required
  • title string

    Titolo breve

    Example: VPS introuvable

    required
  • status integer (int64)

    Stato HTTP

    Example: 404

    required
  • code string

    Codice macchina stabile (vedere «Errori» in Per iniziare)

    Example: vm_not_found

    required
  • detail string

    Messaggio dettagliato

    Example: Aucun VPS 999999 sur ce compte.

    required
  • request_id string

    Identificativo della richiesta, da comunicare al supporto

    Example: 3f9a1c07b2e45d18

    required
  • errors object

    validation_failed: messaggio per ogni parametro errato

  • required_level string

    insufficient_scope: livello richiesto dall'operazione

    one of: read, exploitation, full

  • task_id string

    task_already_running: task in corso su questo VPS

    Example: tsk_000002d5

  • family string

    rate_limited: famiglia di quota esaurita

    one of: read, mutation, heavy

  • limit integer (int64)

    rate_limited: limite orario della famiglia

  • retry_after integer (int64)

    rate_limited: secondi da attendere

  • lock string

    server_locked: blocco impostato dall'hypervisor (backup, snapshot, suspended…)

    Example: snapshot

  • reason string

    server_locked: operation_in_progress, è in corso un'operazione, riprovi dopo Retry-After; suspended, il VPS è in ibernazione, lo avvii prima; support_notified, blocco anomalo, il team LWS è stato avvisato e sta intervenendo

    one of: operation_in_progress, suspended, support_notified

  • maintenance object

    server_maintenance: natura dell'intervento, inizio e fine prevista (null per un incidente)

  • kind string

    one of: works, incident

  • started_at string (date-time)
  • expected_end string (date-time)
403

Accesso negato: insufficient_scope — livello della chiave insufficiente; ip_not_allowed — indirizzo di chiamata non autorizzato.

livello della chiave insufficiente

{
  "type": "https://docs.lws.fr/kvm/errors/insufficient-scope",
  "title": "Droits insuffisants",
  "status": 403,
  "code": "insufficient_scope",
  "detail": "Niveau de permission « exploitation » requis.",
  "request_id": "3f9a1c07b2e45d18",
  "required_level": "exploitation"
}

indirizzo di chiamata non autorizzato

{
  "type": "https://docs.lws.fr/kvm/errors/ip-not-allowed",
  "title": "Adresse non autorisée",
  "status": 403,
  "code": "ip_not_allowed",
  "detail": "L'adresse 203.0.113.10 ne figure pas parmi les adresses autorisées de ce compte.",
  "request_id": "3f9a1c07b2e45d18"
}
Response fields 18
  • type string (uri)

    Example: https://docs.lws.fr/kvm/errors/vm-not-found

    required
  • title string

    Titolo breve

    Example: VPS introuvable

    required
  • status integer (int64)

    Stato HTTP

    Example: 404

    required
  • code string

    Codice macchina stabile (vedere «Errori» in Per iniziare)

    Example: vm_not_found

    required
  • detail string

    Messaggio dettagliato

    Example: Aucun VPS 999999 sur ce compte.

    required
  • request_id string

    Identificativo della richiesta, da comunicare al supporto

    Example: 3f9a1c07b2e45d18

    required
  • errors object

    validation_failed: messaggio per ogni parametro errato

  • required_level string

    insufficient_scope: livello richiesto dall'operazione

    one of: read, exploitation, full

  • task_id string

    task_already_running: task in corso su questo VPS

    Example: tsk_000002d5

  • family string

    rate_limited: famiglia di quota esaurita

    one of: read, mutation, heavy

  • limit integer (int64)

    rate_limited: limite orario della famiglia

  • retry_after integer (int64)

    rate_limited: secondi da attendere

  • lock string

    server_locked: blocco impostato dall'hypervisor (backup, snapshot, suspended…)

    Example: snapshot

  • reason string

    server_locked: operation_in_progress, è in corso un'operazione, riprovi dopo Retry-After; suspended, il VPS è in ibernazione, lo avvii prima; support_notified, blocco anomalo, il team LWS è stato avvisato e sta intervenendo

    one of: operation_in_progress, suspended, support_notified

  • maintenance object

    server_maintenance: natura dell'intervento, inizio e fine prevista (null per un incidente)

  • kind string

    one of: works, incident

  • started_at string (date-time)
  • expected_end string (date-time)
429

Quota superata: rate_limited — quota oraria della famiglia esaurita.

{
  "type": "https://docs.lws.fr/kvm/errors/rate-limited",
  "title": "Quota dépassé",
  "status": 429,
  "code": "rate_limited",
  "detail": "Quota dépassé pour les opérations de type « mutation » : 300 appels par heure. Réessayez dans 95 seconde(s).",
  "request_id": "3f9a1c07b2e45d18",
  "family": "mutation",
  "limit": 300,
  "retry_after": 95
}
Response fields 18
  • type string (uri)

    Example: https://docs.lws.fr/kvm/errors/vm-not-found

    required
  • title string

    Titolo breve

    Example: VPS introuvable

    required
  • status integer (int64)

    Stato HTTP

    Example: 404

    required
  • code string

    Codice macchina stabile (vedere «Errori» in Per iniziare)

    Example: vm_not_found

    required
  • detail string

    Messaggio dettagliato

    Example: Aucun VPS 999999 sur ce compte.

    required
  • request_id string

    Identificativo della richiesta, da comunicare al supporto

    Example: 3f9a1c07b2e45d18

    required
  • errors object

    validation_failed: messaggio per ogni parametro errato

  • required_level string

    insufficient_scope: livello richiesto dall'operazione

    one of: read, exploitation, full

  • task_id string

    task_already_running: task in corso su questo VPS

    Example: tsk_000002d5

  • family string

    rate_limited: famiglia di quota esaurita

    one of: read, mutation, heavy

  • limit integer (int64)

    rate_limited: limite orario della famiglia

  • retry_after integer (int64)

    rate_limited: secondi da attendere

  • lock string

    server_locked: blocco impostato dall'hypervisor (backup, snapshot, suspended…)

    Example: snapshot

  • reason string

    server_locked: operation_in_progress, è in corso un'operazione, riprovi dopo Retry-After; suspended, il VPS è in ibernazione, lo avvii prima; support_notified, blocco anomalo, il team LWS è stato avvisato e sta intervenendo

    one of: operation_in_progress, suspended, support_notified

  • maintenance object

    server_maintenance: natura dell'intervento, inizio e fine prevista (null per un incidente)

  • kind string

    one of: works, incident

  • started_at string (date-time)
  • expected_end string (date-time)
502

Dipendenza irraggiungibile: upstream_unavailable — API di gestione delle chiavi irraggiungibile.

{
  "type": "https://docs.lws.fr/kvm/errors/upstream-unavailable",
  "title": "Service momentanément indisponible",
  "status": 502,
  "code": "upstream_unavailable",
  "detail": "La liste des clés SSH n'a pas pu être obtenue. Réessayez dans quelques instants.",
  "request_id": "3f9a1c07b2e45d18"
}
Response fields 18
  • type string (uri)

    Example: https://docs.lws.fr/kvm/errors/vm-not-found

    required
  • title string

    Titolo breve

    Example: VPS introuvable

    required
  • status integer (int64)

    Stato HTTP

    Example: 404

    required
  • code string

    Codice macchina stabile (vedere «Errori» in Per iniziare)

    Example: vm_not_found

    required
  • detail string

    Messaggio dettagliato

    Example: Aucun VPS 999999 sur ce compte.

    required
  • request_id string

    Identificativo della richiesta, da comunicare al supporto

    Example: 3f9a1c07b2e45d18

    required
  • errors object

    validation_failed: messaggio per ogni parametro errato

  • required_level string

    insufficient_scope: livello richiesto dall'operazione

    one of: read, exploitation, full

  • task_id string

    task_already_running: task in corso su questo VPS

    Example: tsk_000002d5

  • family string

    rate_limited: famiglia di quota esaurita

    one of: read, mutation, heavy

  • limit integer (int64)

    rate_limited: limite orario della famiglia

  • retry_after integer (int64)

    rate_limited: secondi da attendere

  • lock string

    server_locked: blocco impostato dall'hypervisor (backup, snapshot, suspended…)

    Example: snapshot

  • reason string

    server_locked: operation_in_progress, è in corso un'operazione, riprovi dopo Retry-After; suspended, il VPS è in ibernazione, lo avvii prima; support_notified, blocco anomalo, il team LWS è stato avvisato e sta intervenendo

    one of: operation_in_progress, suspended, support_notified

  • maintenance object

    server_maintenance: natura dell'intervento, inizio e fine prevista (null per un incidente)

  • kind string

    one of: works, incident

  • started_at string (date-time)
  • expected_end string (date-time)
Show the code examples and the test console
POST /ssh-keys
LWS_API_KEY='…'curl -X POST \  "https://panelkvm.lwspanel.com/api/v1/ssh-keys" \  -H "Authorization: Bearer $LWS_API_KEY" \  -H "Content-Type: application/json" \  -d '{"key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINK0AO80+x734if/v0cHQXq3DTEQDjY2M0t6Mm3lDOiC poste-admin"}'
$lwsApiKey = '…';$ch = curl_init("https://panelkvm.lwspanel.com/api/v1/ssh-keys");curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_HTTPHEADER, [    "Authorization: Bearer " . $lwsApiKey,    "Content-Type: application/json",]);curl_setopt($ch, CURLOPT_POSTFIELDS, '{"key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINK0AO80+x734if/v0cHQXq3DTEQDjY2M0t6Mm3lDOiC poste-admin"}');$res = json_decode(curl_exec($ch), true);
import requestsLWS_API_KEY = "…"res = requests.post(    "https://panelkvm.lwspanel.com/api/v1/ssh-keys",    headers={        "Authorization": "Bearer " + LWS_API_KEY,    },    json={"key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINK0AO80+x734if/v0cHQXq3DTEQDjY2M0t6Mm3lDOiC poste-admin"},)print(res.json())
const LWS_API_KEY = "…";const res = await fetch("https://panelkvm.lwspanel.com/api/v1/ssh-keys", {  method: "POST",  headers: {    "Authorization": "Bearer " + LWS_API_KEY,    "Content-Type": "application/json",  },  body: JSON.stringify({"key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINK0AO80+x734if/v0cHQXq3DTEQDjY2M0t6Mm3lDOiC poste-admin"}),});const data = await res.json();
lwsApiKey := "…"body := strings.NewReader(`{"key":"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINK0AO80+x734if/v0cHQXq3DTEQDjY2M0t6Mm3lDOiC poste-admin"}`)req, _ := http.NewRequest("POST",    "https://panelkvm.lwspanel.com/api/v1/ssh-keys", body)req.Header.Set("Authorization", "Bearer "+lwsApiKey)req.Header.Set("Content-Type", "application/json")resp, err := http.DefaultClient.Do(req)