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",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
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",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
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",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
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",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}
{  "success": false,  "error": {    "code": "string",    "message": "string",    "docsUrl": "http://example.com"  }}

Servers

Dedicated machines in a project. The keys that can log into a server are fixed when it is created — they are written to the machine at first boot — so decide them before provisioning, not after.

Domains

The domains in a project. A domain is registered through Cosmoner, moved in from another registrar, or external — a domain whose DNS you keep hosting elsewhere. An external domain starts `PENDING`, and the project's apps can use it only once you have proven you control it: publish the TXT record Verify ownership of an external domain returns, then call it again until the record is found. Turning email on for the domain and verifying its records proves the same thing. Search shows which names can be registered and what each costs; see [Domain pricing](/docs/pricing/domains). Registering a domain and moving one in are done in the control panel. Three calls work with an API key but are not described operation by operation yet, because they answer with the domain's full internal record, which is not a stable contract: listing the project's domains (`GET /v1/projects/{projectId}/domains`, `domains:read`), reading one by id or name (`GET /v1/projects/{projectId}/domains/{domain}`, `domains:read`) and adding an external domain (`POST /v1/projects/{projectId}/domains` with `{ "name": "example.com", "type": "EXTERNAL" }`, `domains:write`). Rely only on `id`, `name`, `type`, `status`, `createdAt`, `dnsRecords` and, for an external domain, `verificationRecord` — the TXT record to publish — and expect the rest to change. Adding a domain is refused to members with the viewer role, and to a project blocked over an unpaid invoice.

On this page