API Reference
POST
ssh-keys/generateGenerate 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
POST
https://api.sharkcluster.com/ssh-keys/generateHow do you call Generate SSH Key Pair?
- 1Get a token from the login endpoint (POST /login) and send it as Authorization: Bearer <token>. See Login.
- 2Send a POST request to https://api.sharkcluster.com/ssh-keys/generate.
- 3Include the required parameter: name.
- 4Add the optional parameter only if you need it: server_id.
Request parameters
| Parameter | Type | Description |
|---|---|---|
nameRequired | string | Label for the generated key. |
server_id | string | Optional: Automatically install this new key on a server. |
AuthorizationRequired | header | Bearer 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));
Related SSH Keys endpoints
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.