Public API (v1.0.0)

Serverspace Public API is a public API for interacting with Serverspace services. Actions performed in the Serverspace dashboard can also be performed using the public API. This documentation describes the Serverspace application programming interface (API): the various API operations, request and response structures, error codes, and examples.

Authentication

You need to create an API key for the project to work with the public API. The key can be generated by the project owner in Automation tab in the control panel. Each key has attributes: name, key value, issue date, expiration date. The key name can be arbitrary, up to 50 characters long. The key value is generated automatically and is 64 characters long. The key expiration date may be left blank, meaning the key does not expire and can be used indefinitely.

To work with the public API, the key value must be passed with all requests in the X-API-KEY header, for example:

  -H "X-API-KEY: lmGwbvllpIqIrKROOCLgE5Z941MKP5EYfbkgwtqJZGigfXUTpuYRpNQkCqShmm6r"

All API requests must be made over HTTPS. Requests made over plain HTTP will fail. API requests without authentication will also fail.

Endpoint:

  https://api.serverspace.io/

Facilities

Below are the objects that can be manipulated using the public API and how they relate to the services in the control panel.

Service Object Actions
Cloud servers OS image View available operating systems for creating servers and networks
Cloud servers Configuration View available configurations for creating servers and networks
Cloud servers Location View available locations for creating servers and networks
Cloud servers Server Create a server
View details
Manage power
Change configuration
Delete a server
Cloud servers Volume Create a volume
View details
Resize a volume
Delete a volume
Cloud servers Snapshot Create a snapshot
View details
Return the server to a snapshot
Delete a snapshot
Cloud servers Affinity groups Create group
View Details
Delete group
Cloud servers Private network Create a private network
View details
Change configuration
Delete a private network
Cloud servers Network interface Connect the server to the network (create a network interface)
View details
Disconnect the server from the network (remove the network interface)
Cloud servers Gateway Create an edge gateway
View details
Manage Firewall and NAT rules
Connecting and disconnecting the isolated network
Delete a gateway
Project SSH key Create an SSH key
View details
Delete an SSH key
Project Project View project details
Project Task View details
DNS Domain name Create a domain name
View details
Delete a domain name
DNS DNS-record Create a DNS-record
View details
Update a DNS-record
Delete a DNS-record

Projects

Get information about project

Detailing

Returns the project ID and the current project balance. Projects let the account holder provide full or limited access to their infrastructure or resources (servers, networks, balance, etc.) to other users to collaborate with resources. There are two types of projects: personal and general. Each user in the project can be assigned a role with certain access rights: owner, administrator or accountant

Responses

Response samples

Content type
application/json
{
  • "project":
    {
    }
}

SSH keys

Work with SSH Keys

List

Returns a list of SSH keys. SSH keys are used to create a server running a Linux operating system. Using SSH keys lets you connect to the server without a password and increases the server's security level

Responses

Response samples

Content type
application/json
{
  • "ssh_keys":
    [
    ]
}

Create new

Adds a new SSH key. SSH keys are used to create a server running a Linux operating system. Using SSH keys lets you connect to the server without a password and increases the server's security level

Request Body schema: application/json

Supported formats OpenSSH and SSH2

name
string

Key name

public_key
string

Key code

Responses

Request samples

Content type
application/json
{
  • "name": "Test Ssh-Key 1",
  • "public_key": "---- BEGIN SSH2 PUBLIC KEY ----\r\nComment: \"rsa-key-20190927\"\r\nAAAAB3NzaC1yc2EAAAABJQAAAQEAkEWseYLYVW4wpdNwWNXtoz84r5sYZ2FBXJ5M\r\nsfibRpJ47o/2z6VcdYnbhhJ/J2dE9AlDCGgleXilnxc9UKRgWXi3NHMmDNFi1kR5\r\nJ6xcY3Tv0ly6w0if+QMJULnoixgPulg93JanVxCvAFy4sE8kwQqTQrYio3UJbiQ5\r\nlX0kEkaWMDM/p8Z97d5izVN+PoMjW0bZdK17VAS90cf+FKFL6cs5VKrY/d7OMfxi\r\nqNeEs+vzYPK2VT4aiLLzryTIiDgG9CjsPtRoMxSihw5tdIw3mhsFdZkKdaJDfank\r\noQ3Y6P4XFPbzwOfDLwIRkDd7Gbh7jRp+4SeVVsBP9AbBR/kv3w==\r\n---- END SSH2 PUBLIC KEY ----"
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "name": "Test Ssh-Key 1",
  • "public_key": "---- BEGIN SSH2 PUBLIC KEY ----\r\nComment: \"rsa-key-20190927\"\r\nAAAAB3NzaC1yc2EAAAABJQAAAQEAkEWseYLYVW4wpdNwWNXtoz84r5sYZ2FBXJ5M\r\nsfibRpJ47o/2z6VcdYnbhhJ/J2dE9AlDCGgleXilnxc9UKRgWXi3NHMmDNFi1kR5\r\nJ6xcY3Tv0ly6w0if+QMJULnoixgPulg93JanVxCvAFy4sE8kwQqTQrYio3UJbiQ5\r\nlX0kEkaWMDM/p8Z97d5izVN+PoMjW0bZdK17VAS90cf+FKFL6cs5VKrY/d7OMfxi\r\nqNeEs+vzYPK2VT4aiLLzryTIiDgG9CjsPtRoMxSihw5tdIw3mhsFdZkKdaJDfank\r\noQ3Y6P4XFPbzwOfDLwIRkDd7Gbh7jRp+4SeVVsBP9AbBR/kv3w==\r\n---- END SSH2 PUBLIC KEY ----"
}

Get by ID

Returns the granularity of a single SSH key. SSH keys are used to create a server with a Linux operating system. Using SSH keys lets you connect to the server without a password and increases the server's security level

path Parameters
ssh_key_id
required
integer <int32>

ID of the SSH key that you need to get information about

Responses

Response samples

Content type
application/json