News
Seven days of Black Friday madness — great deal from Serverspace!
Serverspace Black Friday
OL
September 3, 2021
Updated May 22, 2023

How to automate server deployment via API?

Terraform VPS

List of API Keys

API keys to access your project.

Serverspace control panel - Automation

API

Serverspace Public API - a public API for interaction with the Serverspace services. Actions performed in the Serverspace control panel can also be performed using the public API.

Authorization

To work with the public API, create an API key for the project and pass it in the X-API-KEY header with every request. For example, when using the cURL utility, the header would look like this:

-H "X-API-KEY: lmGwbvllpIqIrKROOCLgE5Z941MKP5EYfbkgwtqJZGigfXUTpuYRpNQkCqShmm6r"

All API requests must be made through HTTPS, here is the URL of the endpoint of the public API:

https://api.serverspace.io/


Usage Examples

Let's get information about the project by sending a request using the cURL utility:

curl -X GET \
https://api.serverspace.io/api/v1/project \
-H 'content-type: application/json' \
-H 'x-api-key: lmGwbvllpIqIrKROOCLgE5Z941MKP5EYfbkgwtqJZGigfXUTpuYRpNQkCqShmm6r'

This will return information about the project:

{
"project": {
"balance": 400.07,
"created": "2019-04-08T10:35:53.7021047Z",
"currency": "EUR",
"id": 1,
"state": "Active"
}
}

Let's create a server with the following configuration: Amsterdam, name: "api-example", Debian 10.7 operating system, server configuration - 1 GB RAM, 1 CPU, 25 GB SSD boot drive, 50 Mbps:

curl -X POST \
https://api.serverspace.io/api/v1/servers \
-H 'content-type: application/json' \
-H 'x-api-key: lmGwbvllpIqIrKROOCLgE5Z941MKP5EYfbkgwtqJZGigfXUTpuYRpNQkCqShmm6r' \
-d '{
"location_id": "am2",
"image_id": "Debian-10.7-X64",
"cpu": 1,
"ram_mb": 1024,
"volumes": [
{
"name": "boot",
"size_mb": 25600
}
],
"networks": [
{
"bandwidth_mbps": 50
}
],
"name": "api-example"
}'

The result returns a task ID, which can be used to track the server creation process:

{
"task_id" : "lt1507097"
}
Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.