API Reference
POSTssh-keys/generate

Generate SSH Key Pair

Generate SSH Key Pair is a POST request to https://api.sharkcluster.com/ssh-keys/generate in the SSH Keys section of the SharkCluster API. Generates a new RSA key pair. CRITICAL: The private key is returned only once in this response. You must save it locally as it is not stored on the server for security reasons. It takes 2 parameters, 1 required (name).

Request URL

POSThttps://api.sharkcluster.com/ssh-keys/generate

How do you call Generate SSH Key Pair?

  1. 1Get a token from the login endpoint (POST /login) and send it as Authorization: Bearer <token>. See Login.
  2. 2Send a POST request to https://api.sharkcluster.com/ssh-keys/generate.
  3. 3Include the required parameter: name.
  4. 4Add the optional parameter only if you need it: server_id.

Request parameters

ParameterTypeDescription
name
Required
stringLabel for the generated key.
server_idstringOptional: Automatically install this new key on a server.
Authorization
Required
headerBearer token for authentication (e.g., Bearer eyJ...).

What does Generate SSH Key Pair return?

This endpoint has no documented response sample yet; check the response body of your first call.

Request sample

const axios = require('axios');

const data = {
  name: "New Production Key",
  server_id: "optional-server-uuid" // Optional
};

axios.post('https://api.sharkcluster.com/ssh-keys/generate', data, {
  headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
})
.then(res => {
  console.log("Success:", res.data.message);
  console.log("PRIVATE KEY (SAVE THIS):", res.data.privateKey);
})
.catch(err => console.error(err));

Stuck on an integration?

Raise a ticket from the panel with the endpoint and the response you got back — it reaches an engineer with your server already attached.

Contact us