Cosmoner Docs
API Reference

SSH keys

Public keys that authorise access to the servers in a project. A key is written to a server by cloud-init at first boot, so it must be registered *before* the server that should trust it is created.

GET
/v1/projects/{projectId}/ssh-keys

Every SSH key registered on the project, newest first.

Auth: a project API key carrying servers:read.

AuthorizationBearer <token>

A project API key. X-API-Key: <key> is accepted as an alternative to the Authorization header.

In: header

Path Parameters

projectId*string
Length1 <= length

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/projects/string/ssh-keys"
{  "success": true,  "data": [    {      "id": "string",      "organizationId": "string",      "name": "string",      "publicKey": "string",      "fingerprint": "string",      "createdAt": "2019-08-24T14:15:22Z",      "updatedAt": "2019-08-24T14:15:22Z"    }  ]}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
POST
/v1/projects/{projectId}/ssh-keys

Registers a public key you already hold, so it can authorise servers created afterwards.

Keys are deduplicated by fingerprint within a project: registering one that is already present returns 409 CONFLICT naming the existing key rather than creating a second entry.

Auth: a project API key carrying all of servers:read and servers:write.

AuthorizationBearer <token>

A project API key. X-API-Key: <key> is accepted as an alternative to the Authorization header.

In: header

Path Parameters

projectId*string
Length1 <= length

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/projects/string/ssh-keys" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "publicKey": "string"  }'
{  "success": true,  "data": {    "id": "string",    "organizationId": "string",    "name": "string",    "publicKey": "string",    "fingerprint": "string",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
DELETE
/v1/projects/{projectId}/ssh-keys/{sshKeyId}

Removes the key from the project so it no longer authorises new servers.

Servers already provisioned with it keep accepting it: the key was written to disk at first boot and is not reached back into. stillAuthorisedOn says how many such servers remain.

Auth: a project API key carrying all of servers:read and servers:write.

AuthorizationBearer <token>

A project API key. X-API-Key: <key> is accepted as an alternative to the Authorization header.

In: header

Path Parameters

projectId*string
Length1 <= length
sshKeyId*string
Length1 <= length

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X DELETE "https://example.com/v1/projects/string/ssh-keys/string"
{  "success": true,  "data": {    "stillAuthorisedOn": -9007199254740991  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
POST
/v1/projects/{projectId}/ssh-keys/generate

Generates a keypair on your behalf and registers the public half.

The private key is returned in this response and nowhere else — it is never stored and never logged. If you lose it, the only recovery is to generate a new key and rebuild the servers that trusted the old one.

Auth: a project API key carrying all of servers:read and servers:write.

Rate limit: this endpoint is rate limited; a 429 means back off and retry.

AuthorizationBearer <token>

A project API key. X-API-Key: <key> is accepted as an alternative to the Authorization header.

In: header

Path Parameters

projectId*string
Length1 <= length

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/projects/string/ssh-keys/generate" \  -H "Content-Type: application/json" \  -d '{    "name": "string"  }'
{  "success": true,  "data": {    "id": "string",    "organizationId": "string",    "name": "string",    "publicKey": "string",    "fingerprint": "string",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z",    "privateKey": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string"  }}

On this page