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.
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 the project settings 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.us/
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 | Disk | Create a disk View details Resize a disk Delete a disk |
Cloud servers | Snapshot | Create a snapshot View details Return the server to a snapshot Delete a snapshot |
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) |
Project | SSH key | Create an SSH key View details Delete an SSH key |
Project | Project | View project details |
Project | Task | View details |
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
{- "project": {
- "id": 123,
- "balance": 850.44,
- "currency": "USD",
- "state": "Active",
- "created": "2020-06-01T15:23:07.6258725Z"
}
}
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
{- "ssh_key": [
- {
- "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 ----"
}, - {
- "id": 2,
- "name": "Test Ssh-Key 2",
- "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA4pO1k8IU4JYNASJEGWR/3ECARddXiKLePNN8hIGaqT2grSpFIRULrRhL4qFIQOUB5m9qy0ZjazHoBUzaK/m+nrmkfamF90sKMN5KHRCUMbBOixS0Uc5r/HK7SDDnozjNSFDWscfpMuZfzSXQ512HRZ0ZN+fmXl9Ku87SE9fhrir7injfTVvF/VYfz9W1CvIwN8D6iTBo2zpI1xVfX1tuL2akME4ZBvH9+xVV7Ejw4ad6e/Z1p8g/pYzcmoMvng8qhrBMQaNSq1fTHN+YrJmr86k0pFpKbbSEksOLmV2piTBxqWqR00faRFgvG7HJDtoVAKSdpREUyDvDYeyUGyJwJw== rsa-key-20200730"
}
]
}
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
Supported formats OpenSSH and SSH2
name | string Key name |
public_key | string Key code |
{- "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 ----"
}
{- "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 ----"
}
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
ssh_key_id required | integer <int32> ID of the SSH key that you need to get information about |
{- "ssh_key": {
- "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 ----"
}
}
Returns information about the task, the ID of the entity the action is performed on, and data about its completion
task_id required | string The ID of the task that you need to get information on |
{- "task": {
- "id": "lt17499",
- "server_id": "l1s2274",
- "created": "2020-10-28T13:41:48.7754873Z",
- "completed": "2020-10-28T13:42:13.0265233Z",
- "is_completed": "Completed"
}
}
Returns a list of locations where server and network creation is available, as well as the data on minimum and maximum disk sizes
{- "locations": [
- {
- "id": "am2",
- "system_volume_min": 25600,
- "additional_volume_min": 10240,
- "volume_max": 512000,
- "windows_system_volume_min": 25600,
- "bandwidth_min": 50,
- "bandwidth_max": 200,
- "cpu_quantity_options": [
- 1,
- 2,
- 3,