NAV Navbar
shell csharp

Introduction

Welcome to the ServerFlex Developer Hub, here you'll find everything you need to get up and running in a matter of minutes. If you have any enquiries, bug reports or feature requests please get in touch: [email protected].

Download our Postman collection to get started quickly: https://www.getpostman.com/collections/87e7bd45ede6a34767c0

Client libraries for this API are available:

Official C# API Client

JAVA - Coming Soon

Python - Coming Soon (Expected ~ 12th January 2021)

PHP - Coming Soon

Definitions

Before you can get started you will first need to understand our terminology and the platform's structure.

Server

A server is a game server, it can run Minecraft, Factorio, CS:GO or any other game we support. View Object Example A server combines the game, properties, settings and global scalability into one easy to use product.

Package

A Package represents the game that your servr hosts. You choose which Package will be loaded into your server when you deploy it; it cannot be changed once the server has been deployed. View Object Example

Runtime

Runtimes are a modular way of controlling the functionality of your server. Depending on the game, a Runtime may add, modify or define the base functionality. Available Runtimes, and their usage will be different for every Package. Depending on the Package, you may be required to provide Runtimes at the point of deployment - see game specific requirements below. View Object Example

Minecraft

A Runtime must be provided to deploy a Minecraft based servr. This Runtime tells the server which version of Minecraft to deploy, as well as any game enhancements such as Spigot, Forge, or a supported modpack.

CS:GO

CS:GO doesn't require a Runtime to deploy a servre with. Runtimes can however, be provided to add things like SourceMod to your server.

Factorio

Factorio requires a Runtime to be provided to deploy a server with. This Runtime tells the server whether to deploy a stable or experimental build of the game, or a specific game version.

Property

A property is a key/value pair used to pass game settings into a server - for example the game type for Minecraft (Survival, Creative, Adventure), the player count, and even the map for CS:GO. Properties are a standard way of taking a setting you would like to give to a server, either at boot, or change after the fact. View Object Example

Plan

A Plan defines the resources (CPU, RAM, SSD etc.) that will be available for your servr, as well as how much it will cost in your account's currency. Each plan will contain a pay hourly amount and a pay monthly amount. If you choose to pay hourly for your game server, the maximum you will be charged in a calendar month is the monthly. View Object Example

Region

A region represents a geographical location we operate servers. For example "uk-1" is a region based in London, UK. View Object Example

Authentication

{
    "name": "ServerFlex API",
    "version": "1.0",
    "documentation": "https://developer.serverflex.io"
}

To use this API, you need your own API key. You can generate a key through the ServerFlex Web App.

Your API key is in the form of a bearer token which must be sent in the Authorization header. For instance: Bearer {TOKEN}.

You are responsible for storing your API credentials and keeping them secure. Your API key is only shown once, immediately after generating through the Web App.

To validate that your keys are valid try calling https://api.serverflex.io/1.0 and you should receive a basic response like the one on the right.

Third Party Applications

Got a project in mind that could use the ServerFlex API? Get in touch with our support team to get your official third-party application API credentials.

Examples

All of our examples will assume that you already have an API key and can deploy servers on your account.

How to create a Minecraft server

## 1. Get the Minecraft package.
curl "https://api.serverflex.io/1.0/package/minecraft" -H "Authorization: Bearer {KEY}"

## 6. Get any properties for the Minecraft package.
curl "https://api.serverflex.io/1.0/package/minecraft/properties" -H "Authorization: Bearer {KEY}"

## 8. Make the request to create the Minecraft server.
curl -XPOST 'https://api.serverflex.io/server/new' -H 'Authentication: Bearer:  {key}' -H "Content-type: application/json" -d '{"name": "My Hourly Minecraft Server", "region": "uk-1", "package": "minecraft", "plan": "mc.grass", "properties": {"EULA": true}, "runtnimes": ["vanilla:latest"]}'

// Create a client.
var client = new ApiClient("{key}");

// 1. Get the Minecraft package.
var package = await client.CratePackages.GetCratePackageAsync("minecraft");

// 6. Get any properties for the Minecraft package.
var properties = await client.CratePackageOperations.ListAllCratePackageProperties("minecraft");
// Print out to see the properties. Any property that is required and doesn't have a default MUST be provided.
Console.WriteLine(JsonConvert.SerializeObject(properties));

// 8. Make the request to create the Minecraft server.
var crate = await client.Crate.DeployCrateAsync(new CrateDeployEntity
{
    BillingType = "hourly",
    PackageName = "minecraft",
    PlanName = "mc.grass",
    RegionName = "uk-1"
    Name = "My Hourly Minecraft Server",
    Properties = new Dictionary<string, object>
    {
        { "EULA", true }
    },
    Runtimes = new string[]
    {
        "vanilla:latest"
    }
});

// 9. Completed!
Console.WriteLine($"Connect to my new Minencraft Serevr at: {crate.Network.SubDomain} or {crate.Network.IPAddress}");

// Depending on the boot up speed of the Crate, you may not immediately get network information.
// If this is the case you can just simple the Crate after a few seconds.
crate = await client.Crate.GetCrateAsync(crate.UUID);

Follow along to create a new Minecraft server using our API.

  1. To get started let's get the Minecraft package from the API. See right hand side for shell and C# examples.
  2. Take a look at the response for the request - it will contain information such as plans, runtimes and regions. Using this information we can build our new deployment and provision it.
  3. Choose your plan, in this case we will choose Grass, so in our request we will send the name of the plan - not the display name. We would send mc.grass. You will also need to determine if you would like to pay hourly or pay monthly. Provide hourly or monthly.
  4. Choose a runtime - this is where you select the version of Minecraft you would like to play. We'll outline a few examples so you can get an idea of how runtimes work for Minecraft:
    • The latest verion of Vanilla Minecraft can be created with vanilla:latest.
    • The latest version of Spigot can be created with spigot:latest.
    • If you want to deploy a specific version of Forge you could supply forge:35.1.4 Any runtime name can be supplied before the collon and any version specified in the response to the first step can be provided after. If you would just like to latest or recommended version, then you can use an alias that is also supplied inside the runtimes provided in the first step.
  5. Choose a region - from the response to the first step you can see the regions where this package is supported. Determine the location you would like to provision to and enter the name field. In our example this will be uk-1.
  6. Find any properties that will have to be supplied to create your new Minecraft server. See right hand side for examples of how to do this.
  7. Give your server a name, if this field is left blank we'll fill it with a default.
  8. Make the request - see shell and C# examples to the right for this step.
  9. Congrats! If everything was correct with your request, you have just created a Minecraft server using our API! You'll receive an email to confirm deployment.

How to create a Factorio server

## 1. Get the Factorio package.
curl "https://api.serverflex.io/1.0/package/factorio" -H "Authorization: Bearer {KEY}"

## 6. Get any properties for the Factorio package.
curl "https://api.serverflex.io/1.0/package/factorio/properties" -H "Authorization: Bearer {KEY}"

## 8. Make the request to create the Factorio server.
curl -XPOST 'https://api.serverflex.io/server/new' -H 'Authentication: Bearer:  {key}' -H "Content-type: application/json" -d '{"name": "My Hourly Factorio Server", "region": "uk-1", "package": "factorio", "plan": "fc.grass", "properties": {}, "runtnimes": ["factorio:stable"]}'

// Create a client.
var client = new ApiClient("{key}");

// 1. Get the Factorio package.
var package = await client.CratePackages.GetCratePackageAsync("factorio");

// 6. Get any properties for the Factorio package.
var properties = await client.CratePackageOperations.ListAllCratePackageProperties("factorio");
// Print out to see the properties. Any property that is required and doesn't have a default MUST be provided.
Console.WriteLine(JsonConvert.SerializeObject(properties));

// 8. Make the request to create the Factorio server.
var crate = await client.Crate.DeployCrateAsync(new CrateDeployEntity
{
    BillingType = "hourly",
    PackageName = "factorio",
    PlanName = "fc.wood",
    RegionName = "uk-1"
    Name = "My Hourly Factorio Server",
    Properties = new Dictionary<string, object>(),
    Runtimes = new string[]
    {
        "factorio:stable"
    }
});

// 9. Completed!
Console.WriteLine($"Connect to my new Factorio Serevr at: {crate.Network.SubDomain} or {crate.Network.IPAddress}");

// Depending on the boot up speed of the Crate, you may not immediately get network information.
// If this is the case you can just simple the Crate after a few seconds.
crate = await client.Crate.GetCrateAsync(crate.UUID);

Follow along to create a new Factorio server using our API.

  1. To get started let's get the Factorio package from the API. See right hand side for shell and C# examples.
  2. Take a look at the response for the request - it will contain information such as plans, runtimes and regions. Using this information we can build our new deployment and provision it.
  3. Choose your plan, in this case we will choose Wood, so in our request we will send the name of the plan - not the display name. We would send fc.wood. You will also need to determine if you would like to pay hourly or pay monthly. Provide hourly or monthly.
  4. With Factorio you can choose Stable, Experimental or a specific verion of the server to run.
    • If you would like to play the latest stable release, your runtime is going to be factorio:stable.
    • If you would like to plauy the latest experimental release, your runtime will be factorio:experimental.
    • If you would like to play a specific verion, find it in the response to step 1 and supply the version here: factorio:{version}.
  5. Choose a region - from the response to the first step you can see the regions where this package is supported. Determine the location you would like to provision to and enter the name field. In our example this will be uk-1.
  6. Find any properties that will have to be supplied to create your new Factorio server. See right hand side for examples of how to do this.
  7. Give your server a name, if this field is left blank we'll fill it with a default.
  8. Make the request - see shell and C# examples to the right for this step.
  9. Congrats! If everything was correct with your request, you have just created a Factorio server using our API! You'll receive an email to confirm deployment.

How to create a CS:GO server

## 1. Get the CS:GO package.
curl "https://api.serverflex.io/1.0/package/csgo" -H "Authorization: Bearer {KEY}"

## 6. Get any properties for the CS:GO package.
curl "https://api.serverflex.io/1.0/package/csgo/properties" -H "Authorization: Bearer {KEY}"

## 8. Make the request to create the CS:GO server.
curl -XPOST 'https://api.serverflex.io/server/new' -H 'Authentication: Bearer:  {key}' -H "Content-type: application/json" -d '{"name": "My Hourly CSGO Server", "region": "uk-1", "package": "csgo", "plan": "csgo.milspec", "properties": {"gslt": "YOUR GSLT"}, "runtnimes": ["sourcemod:stable"]}'

// Create a client.
var client = new ApiClient("{key}");

// 1. Get the CS:GO package.
var package = await client.CratePackages.GetCratePackageAsync("csgo");

// 6. Get any properties for the CS:GO package.
var properties = await client.CratePackageOperations.ListAllCratePackageProperties("csgo");
// Print out to see the properties. Any property that is required and doesn't have a default MUST be provided.
Console.WriteLine(JsonConvert.SerializeObject(properties));

// 8. Make the request to create the CS:GO server.
// For CS:GO servers you will always have to provide a GSLT (Game server login token)
var crate = await client.Crate.DeployCrateAsync(new CrateDeployEntity
{
    BillingType = "hourly",
    PackageName = "csgo",
    PlanName = "csgo.milspec",
    RegionName = "uk-1"
    Name = "My Hourly CS:GO Server",
    Properties = new Dictionary<string, object>{
        "gslt", "YOUR GSLT"
    },
    Runtimes = new string[]
    {
        "sourcemod:stable"
    }
});

// 9. Completed!
Console.WriteLine($"Connect to my new CS:GO Serevr at: {crate.Network.SubDomain} or {crate.Network.IPAddress}");

// Depending on the boot up speed of the Crate, you may not immediately get network information.
// If this is the case you can just simple the Crate after a few seconds.
crate = await client.Crate.GetCrateAsync(crate.UUID);

Follow along to create a new CS:GO server using our API.

  1. To get started let's get the CS:GO package from the API. See right hand side for shell and C# examples.
  2. Take a look at the response for the request - it will contain information such as plans, runtimes and regions. Using this information we can build our new deployment and provision it.
  3. Choose your plan, in this case we will choose Milspec, so in our request we will send the name of the plan - not the display name. We would send csgo.milspec. You will also need to determine if you would like to pay hourly or pay monthly. Provide hourly or monthly.
  4. No runtime is required for CS:GO, you can however provide the string sourcemod:stable for the latest stable build of sourcemod or sourcemod:development for the latest development version to be added to the new server.
  5. Choose a region - from the response to the first step you can see the regions where this package is supported. Determine the location you would like to provision to and enter the name field. In our example this will be uk-1.
  6. Find any properties that will have to be supplied to create your new CS:GO server. See right hand side for examples of how to do this. You must provide a GSLT (game server login token) to create a CS:GO server, this will be under the property gslt.
  7. Give your server a name, if this field is left blank we'll fill it with a default.
  8. Make the request - see shell and C# examples to the right for this step.
  9. Congrats! If everything was correct with your request, you have just created a CS:GO server using our API! You'll receive an email to confirm deployment.

Server API Routes

List Servers

curl "https://api.serverflex.io/1.0/server" -H "Authorization: Bearer: {key}"
// Create a Crate.
var client = new ApiClient("{key}");

// List all Crate on the account.
var crates = await client.Crate.ListAllCratesAsync();

This route returns the following JSON.

{
    "results": [
        {
            "uuid": "00000000-0000-0000-0000-000000000000",
            "name": "My Minecraft Server",
            "state": "running",
            "package": {
                "displayName": "Minecraft",
                "name": "minecraft"
            },
            "billingType": "monthly",
            "createdAt": "2021-01-07T13:07:43.0343562+00:00",
            "locked": {
                "isLocked": false,
                "reason": null
            },
            "network": {
                "ipAddress": "109.34.30.3",
                "ports": [
                    {
                        "name": "gmae",
                        "port": 25565,
                        "protocol": "tcp"
                    }
                ],
                "subDomain": "12fj.crate.pw"
            },
            "permission": "owner",
            "plan": {
                "displayName": "Grass",
                "name": "mc.grass",
                "pricing": {
                    "costHourly": 0.07,
                    "costMonthly": 7.0,
                    "currency": "USD"
                },
                "resources": {
                    "backupsInMB": 20000,
                    "memoryInMB": 1024,
                    "cpuCount": 2.0,
                    "storageInMB": 10000
                }
            },
            "region": {
                "country": "US",
                "city": "Ashburn",
                "name": "us-1"
            }
        }
    ],
    "totalResults": 1,
    "limit": 25,
    "page": 1,
    "totalPages": 1
}

List all the servers in your account, regardless of whether you own them or if another user has shared them with you. The returned servers are sorted by date created in ascending order (oldest servers at the top) and, by default, are returned in groups of 25. You can use the limit and page query parameters to adjust your returned results.

For reference see:

HTTP Request

GET /server

Query Parameters

Parameter Required Description Default Misc
limit No The maximum number of servers that can be returned. 25 Minimum 1, Maximum 50
page No The cursor for the next batch of results. 1 Minimum 1

Response Codes

200 OK

400 Bad Request - The request you sent was not valid.

Deploy a new server

curl -XPOST 'https://api.serverflex.io/server/new' -H 'Authentication: Bearer:  {key}' -H "Content-type: application/json" -d '{"name": "My API server", "region": "us-1", "package": "minecraft", "plan": "mc.grass", "properties": {"EULA": true}, "runtnimes": ["vanilla:latest"]}'
// Create a client.
var client = new ApiClient("{key}");

// Deploy a new Crate. (This will be a Minecraft Crate, running in the UK, with Vanilla 1.16.4, this is the latest at the time of writing.)
var crate = await client.Crate.DeployCrateAsync(new CrateDeployEntity
{
    BillingType = "hourly",
    PackageName = "minecraft",
    PlanName = "mc.grass",
    RegionName = "us-1"
    Name = "My API server",
    Properties = new Dictionary<string, object>
    {
        { "EULA", true }
    },
    Runtimes = new string[]
    {
        "vanilla:latest"
    }
});

This route returns the following JSON.

{
    "uuid": "00000000-0000-0000-0000-000000000000",
    "name": "My API server",
    "state": "created",
    "package": {
        "displayName": "Minecraft",
        "name": "minecraft"
    },
    "billingType": "hourly",
    "createdAt": "2021-01-08T16:35:40.9343245+00:00",
    "locked": {
        "isLocked": false,
        "reason": null
    },
    "network": {
        "ipAddress": "109.34.30.3",
        "ports": [
            {
                "name": "gmae",
                "port": 25565,
                "protocol": "tcp"
            }
        ],
        "subDomain": "12fj.crate.pw"
    },
    "permission": "owner",
    "plan": {
        "displayName": "Grass",
        "name": "mc.grass",
        "pricing": {
            "costHourly": 0.07,
            "costMonthly": 7.0,
            "currency": "USD"
        },
        "resources": {
            "backupsInMB": 20000,
            "cpuCount": 2.0,
            "memoryInMB": 1024,
            "storageInMB": 10000
        }
    },
    "region": {
        "country": "US East",
        "city": "Ashburn",
        "name": "us-1"
    }
}

Deploy a new server to your account. To call this route successfully you must have enough credit or have a payment method, and have not reached the limitation of your account. Please get in touch with our team if you need to deploy more than your account permits.

When deploying a server you must also pass in any required properties, to find which properties are required for your deployment see Package Properties, these properties are required key value pairs used to deploy your server.

When deploying a server you can also pass in runtimes - if you're not familiar with runtimes, please read more here before deploying a server.

HTTP Request

POST /server/new

Body Contents

Parameter Required Type Description
name Yes String The name for your new server (must abide by our server naming guidelines and regulations).
billingType Yes String The billing type - either hourly or monthly. Trial is not supported here.
package Yes String The package name, e.g. minecraft.
plan Yes String The name of the plan that should be used for this server (for example: “mc.grass”).
properties Yes Dictionary Any properties required to deploy the Package. Find these for your chosen package: see see Package Properties.
region Yes String The name of the region where the server should be deployed (for example: “us-east”).
runtimes No Array (String) The name of the runtiime(s) to add to this server.

Response Codes

200 OK - A new server has been created.

400 Bad Request - The request you sent was not valid.

412 Precondition Failed - Unable to create new server on this account. This could be regarding billing or other account limitations.

Get a server

curl "https://api.serverflex.io/1.0/server/269be408-3332-443f-83b1-ed27a9644a9a" -H "Authorization: Bearer: {key}"
// Create a client.
var client = new ApiClient("{key}");

// Get a Crate.
var crate = await client.Crates.GetCrateAsync(new Guid("00000000-0000-0000-0000-000000000000"));

This route returns the following JSON.

 {
    "uuid": "00000000-0000-0000-0000-000000000000",
    "name": "My Minecraft Server",
    "state": "running",
    "package": {
        "displayName": "Minecraft",
        "name": "minecraft"
    },
    "billingType": "monthly",
    "createdAt": "2021-01-07T13:07:43.0343562+00:00",
    "locked": {
        "isLocked": false,
        "reason": null
    },
    "network": {
        "ipAddress": "109.34.30.3",
        "ports": [
            {
                "name": "gmae",
                "port": 25565,
                "protocol": "tcp"
            }
        ],
        "subDomain": "12fj.crate.pw"
    },
    "permission": "owner",
    "plan": {
        "displayName": "Grass",
        "name": "mc.grass",
        "pricing": {
            "costHourly": 0.07,
            "costMonthly": 7.0,
            "currency": "USD"
        },
        "resources": {
            "backupsInMB": 20000,
            "memoryInMB": 1024,
            "cpuCount": 2.0,
            "storageInMB": 10000
        },
        "region": {
            "country": "US",
            "city": "Ashburn",
            "name": "us-1"
        }
    }
}

Retrieve a server from your account whether you own it, or another user has shared it with you.

For reference see:

HTTP Request

GET /server/{uuid}

URL Parameters

Parameter Description
uuid The UUID of the server.

Response Codes

200 OK - Server has been found.

404 Not Found - Server could not be found.

410 Gone - The server has been or is in the process of being deleted.

Edit a server

curl -XPOST 'https://api.serverflex.io/1.0/server/269be408-3332-443f-83b1-ed27a9644a9a' -H "Authorization: Bearer: {key}" -H "Content-type: application/json" -d '{"name": "Even more awesome server"}' 
// Create a client.
var client = new ApiClient("{key}");

// Edit a Crate.
var crate = await client.Crates.EditCrateAsync("00000000-0000-0000-0000-000000000000", new CrateEditEntity
{
    Name = "Even more awesome server"
});

This route returns the following JSON.

{
    "uuid": "00000000-0000-0000-0000-000000000000",
    "name": "Even more awesome server",
    "state": "running",
    "package": {
        "displayName": "Minecraft",
        "name": "minecraft"
    },
    "billingType": "monthly",
    "createdAt": "2021-01-07T13:07:43.0343562+00:00",
    "locked": {
        "isLocked": false,
        "reason": null
    },
    "network": {
        "ipAddress": "109.34.30.3",
        "ports": [
            {
                "name": "gmae",
                "port": 25565,
                "protocol": "tcp"
            }
        ],
        "subDomain": "12fj.crate.pw"
    },
    "permission": "owner",
    "plan": {
        "displayName": "Grass",
        "name": "mc.grass",
        "pricing": {
            "costHourly": 0.07,
            "costMonthly": 7.0,
            "currency": "USD"
        },
        "resources": {
            "backupsInMB": 20000,
            "memoryInMB": 1024,
            "cpuCount": 2.0,
            "storageInMB": 10000
        },
        "region": {
            "country": "US",
            "city": "Ashburn",
            "name": "us-1"
        }
    }
}

Edit a server in your account. To call this route successfully you must have write permissions for the server.

For reference see:

HTTP Request

POST /server/{uuid}

URL Parameters

Parameter Description
uuid The UUID of the server to edit.

Body Contents

Parameter Required Type Description
name Yes String The new name for this server (must abide by our Craserverte naming guidelines and regulations).

Response Codes

200 OK - Servre has been editted.

400 Bad Request - The request you sent was not valid.

403 Forbidden - You do not have permission to change the name of this server.

404 Not Found - Server could not be found.

410 Gone - The server has been deleted or is in the process of being deleted.

Delete a server

curl -X DELETE "https://api.serverflex.io/1.0/server/269be408-3332-443f-83b1-ed27a9644a9a" -H "Authorization: Bearer: {key}"
// Create client.
var client = new ApiClient("{key}");

// Delete a Crate.
await client.Crates.DeleteCrateAsync("00000000-0000-0000-0000-000000000000");

This command returns the following JSON body.

{
    "uuid": "00000000-0000-0000-0000-000000000000",
    "type": "Delete",
    "isCompleted": true,
    "isCompletedSuccesfully": true,
    "createdAt": "2020-06-03T12:28:06.0937006+00:00",
    "completedAt": "2020-06-03T12:28:06.7964868+00:00"
}

Delete a server from your account. You must either be the owner of this server or have admin permissions.

HTTP Request

DELETE /server/{uuid}

URL Parameters

Parameter Description
uuid The UUID of the server to delete.

Response Codes

200 Ok - The deletion process has been started, the operation to track this request has been returned.

403 Forbidden - You do not have permission to delete that server.

404 Not Found - Server could not be found.

410 Gone - The server has been deleted or is in the process of being deleted.

412 Precondition Failed - The server can not be deleted as another operation is in progress.

Start a server

curl -XPOST "https://api.serverflex.io/1.0/server/269be408-3332-443f-83b1-ed27a9644a9a/start?timeout=30" -H "Authorization: Bearer: {key}"
// Create a client.
var client = new ApiClient("{key}");
// Start Crate, and wait a maximum of thirty seconds.
await client.CrateOperations.StartCrateAsync(new Guid("269be408-3332-443f-83b1-ed27a9644a9a"), TimeSpan.FromSeconds(30));

This command returns the following JSON body.

{
    "uuid": "00000000-0000-0000-0000-000000000000",
    "type": "Start",
    "isCompleted": true,
    "isCompletedSuccesfully": true,
    "createdAt": "2020-06-03T12:28:06.0937006+00:00",
    "completedAt": "2020-06-03T12:28:06.7964868+00:00"
}

Start a server from your account whether you own it, or another user has shared it with you. To call this route successfully the server must already be in the stopped state. This process is asynchronous so the server may not be available immediately.

HTTP Request

POST /server/{uuid}/start

URL Parameters

Parameter Description
uuid The UUID of the server to start.

Query Parameters

Parameter Description Default Misc
timeout The timeout (in seconds) to wait for the call to complete. 30 Minimum 1, Maximum 30

Response Codes

200 Ok - The start command has been received by the server - the operation to track this request has been returned.

403 Forbidden - You do not have the required permissions to change the state of this server.

404 Not Found - Server could not be found.

410 Gone - The server has been deleted.

412 Precondition Failed - The start command can not be accepted currently, this may be because another operation is running or the server is not in a suitable state to issue a start command.

Stop a server

curl -X POST "https://api.serverflex.io/1.0/server/269be408-3332-443f-83b1-ed27a9644a9a/stop?timeout=30" -H "Authorization: Bearer: {KEY}"
// Create a client.
var client = new ApiClient("{key}");
// Stop Crate, and wait a maximum of thirty seconds.
await client.CrateOperations.StopCrateAsync(new Guid("269be408-3332-443f-83b1-ed27a9644a9a"), TimeSpan.FromSeconds(30));

This command returns the following JSON body.

{
    "uuid": "00000000-0000-0000-0000-000000000000",
    "type": "Stop",
    "isCompleted": true,
    "isCompletedSuccesfully": true,
    "createdAt": "2020-06-03T12:28:06.0937006+00:00",
    "completedAt": "2020-06-03T12:28:06.7964868+00:00"
}

Stops a server from your account whether you own it, or another user has shared it with you. To call this route successfully the server must already be in the running state. This process is asynchronous so the server may not be available immediately.

HTTP Request

POST /server/{uuid}/stop

URL Parameters

Parameter Description
uuid The UUID of the server to stop.

Query Parameters

Parameter Description Default Misc
timeout The timeout (in seconds) to wait for the command to complete. 30 Minimum 1, Maximum 30

Response Codes

200 Ok - The stop command has been received by the server - the operation to track this request has been returned.

403 Forbidden - You do not have the required permissions to change the state of this server.

404 Not Found - Server could not be found.

410 Gone - The server has been deleted.

412 Precondition Failed - The stop command can not be accepted currently, this may be because another operation is running or the server is not in a suitable state to issue a stop command.

Restart a server

curl -X POST "https://api.serverflex.io/1.0/server/269be408-3332-443f-83b1-ed27a9644a9a/restart?timeout=30" -H "Authorization: Bearer: {KEY}"
// Create a client.
var client = new ApiClient("{key}");
// Restart Crate, and wait a maximum of thirty seconds.
await client.CrateOperations.RestartCrateAsync(new Guid("269be408-3332-443f-83b1-ed27a9644a9a"), TimeSpan.FromSeconds(30));

This command returns the following JSON body.

{
    "uuid": "00000000-0000-0000-0000-000000000000",
    "type": "Restart",
    "isCompleted": true,
    "isCompletedSuccesfully": true,
    "createdAt": "2020-06-03T12:28:06.0937006+00:00",
    "completedAt": "2020-06-03T12:28:06.7964868+00:00"
}

Restarts a server from your account whether you own it, or another user has shared it with you. To call this route successfully the server must already be in the running state. This process is asynchronous so the server may not be available immediately.

HTTP Request

POST /server/{uuid}/restart

URL Parameters

Parameter Description
uuid The UUID of the server to restart.

Query Parameters

Parameter Description Default Misc
timeout The timeout (in seconds) to wait for the command to complete. 30 Minimum 1, Maximum 30

Response Codes

200 Ok - The restart command has been received by the server - the operation to track this request has been returned.

403 Forbidden - You do not have the required permissions to change the state of this server.

404 Not Found - server could not be found.

410 Gone - The server has been deleted.

412 Precondition Failed - The restart command can not be accepted currently, this may be because another operation is running or the server is not in a suitable state to issue a restart command.

Get players on server

curl -X GET "https://api.serverflex.io/1.0/server/269be408-3332-443f-83b1-ed27a9644a9a/players" -H "Authorization: Bearer: {KEY}"
// Create a client.
var client = new ApiClient("{key}");
// Restart Crate, and wait a maximum of thirty seconds.
await client.CrateOperations.GetPlayersAsync(new Guid("269be408-3332-443f-83b1-ed27a9644a9a"));

This command returns the following JSON body.

{
    "online": 1,
    "totalSlots": 10
}

Get the number of players that are currently connected to a server and the total number of available slots. To call this route successfully the server must already be in the running state. This information may be game specific.

HTTP Request

GET /server/{uuid}/players

URL Parameters

Parameter Description
uuid The UUID of the server to get the player count for.

Response Codes

200 OK - The player count has been returned.

404 Not Found - server could not be found.

410 Gone - The server has been deleted.

412 Precondition Failed - The operation could not complete, this could be because the server is offline.

Share a server

curl -X POST "https://api.serverflex.io/1.0/server/269be408-3332-443f-83b1-ed27a9644a9a/sharing/add" -H "Authorization: Bearer: {KEY}" -H "Content-type: application/json" -d '{"permission": "admin", "username": "[email protected]"}' 
// Create a client.
var client = new ApiClient("{key}");
// Share a Crate with a user.
await client.CrateSharingOperations.AddCrateUserSharingAsync(new Guid("269be408-3332-443f-83b1-ed27a9644a9a"), new UserSharingNewEntity{
    Permission = "admin",
    Username = "[email protected]"
});

This route returns the following JSON body.

{
    "createdAt": "2021-01-07T13:07:43.0343562+00:00",
    "permission": "admin",
    "user": {
        "emailAddress": "[email protected]",
        "familyName": "Flex",
        "givenName": "Server",
        "username": "[email protected]",
        "uuid": "221fa47e-756c-49db-bf8f-0482451d3bec"
    }
}

Share a server with another user. The new user must already have a valid account. You must also have owner or admin permissions on the server to add another user.

HTTP Request

POST /server/{uuid}/sharing/add

URL Parameters

Parameter Description
uuid The UUID of the server.

Body Contents

Parameter Required Type Description
permission Yes String The permission level for the new user over the server. See Permissions
username Yes String The username of the user to share the server with. This will usually be their email address.

Response Codes

200 OK - The server has been shared with the new user.

403 Forbidden - You do not have the required permissions to add a user to the server.

404 Not Found - Server could not be found.

410 Gone - The server has been deleted.

412 Precondition Failed - The maximum number of users the server can be shared between has been reached.

Get the users that share a server

curl -X GET "https://api.serverflex.io/1.0/server/269be408-3332-443f-83b1-ed27a9644a9a/sharing" -H "Authorization: Bearer: {KEY}" 
// Create a client.
var client = new ApiClient("{key}");
// Get a list of users this Crate is shared with.
await client.CrateSharingOperations.ListAllCrateUserSharingAsync(new Guid("269be408-3332-443f-83b1-ed27a9644a9a"));

This route returns the following JSON body.

[
    {
        "createdAt": "2021-01-07T13:07:43.0343562+00:00",
        "permission": "admin",
        "user": {
            "emailAddress": "[email protected]",
            "familyName": "Flex",
            "givenName": "Server",
            "username": "[email protected]",
            "uuid": "221fa47e-756c-49db-bf8f-0482451d3bec"
        }
    }
]

Get the users that share a server, and their relative permission level.

HTTP Request

GET /server/{uuid}/sharing

URL Parameters

Parameter Description
uuid The UUID of the server to get the users for.

Response Codes

200 OK - The users have been returned.

403 Forbidden - You do not have the required permissions to access the shared users.

404 Not Found - server could not be found.

410 Gone - The server has been deleted.

Edit Server user sharing settings

curl -X POST "https://api.serverflex.io/1.0/server/269be408-3332-443f-83b1-ed27a9644a9a/sharing/221fa47e-756c-49db-bf8f-0482451d3bec" -H "Authorization: Bearer: {KEY}" -H "Content-type: application/json" -d '{"permission": "read"}' 
// Create a client.
var client = new ApiClient("{key}");
// Edit an existing users permission.
await client.CrateSharingOperations.EditCrateUserSharingAsync(new Guid("269be408-3332-443f-83b1-ed27a9644a9a"), new UserSharingNewEntity{
    Permission = "read"
});

This route returns the following JSON body.

{
    "createdAt": "2021-01-07T13:07:43.0343562+00:00",
    "permission": "read",
    "user": {
        "emailAddress": "[email protected]",
        "familyName": "Flex",
        "givenName": "Server",
        "username": "te[email protected]",
        "uuid": "221fa47e-756c-49db-bf8f-0482451d3bec"
    }
}

Edit the permission level of a particular user that shares a server.

HTTP Request

POST /server/{uuid}/sharing/{userUUID}

URL Parameters

Parameter Description
uuid The UUID of the server to delete the user from.
userUUID The user UUID.

Body Contents

Parameter Required Type Description
permission Yes String The new permission level to assign to the user. See Permissions

Response Codes

200 OK - The settings for the user have been updated.

403 Forbidden - You do not have the required permissions to add a user to the server.

404 Not Found - server could not be found.

410 Gone - The server has been deleted.

Delete a sharing user

curl -X DELETE "https://api.serverflex.io/1.0/server/269be408-3332-443f-83b1-ed27a9644a9a/sharing/221fa47e-756c-49db-bf8f-0482451d3bec" -H "Authorization: Bearer: {KEY}" 
// Create a client.
var client = new ApiClient("{key}");
// Delete a user from a Crate.
await client.CrateSharingOperations.DeleteCrateUserSharingAsync(new Guid("269be408-3332-443f-83b1-ed27a9644a9a"), new Guid("221fa47e-756c-49db-bf8f-0482451d3bec"));

Remove a user from a server. To call this route succesfully you must either have owner or admin permissions.

HTTP Request

DELETE /server/{uuid}/sharing/{userUUID}

URL Parameters

Parameter Description
uuid The UUID of the server to delete the user from.
userUUID The UUID of the user to remove.

Response Codes

204 No Content - The user has been deleted from the server.

403 Forbidden - You do not have the required permissions to add a user to the server.

404 Not Found - Server could not be found.

410 Gone - The server has been deleted.

Send Command to Server Console

curl -X POST "https://api.serverflex.io/1.0/server/269be408-3332-443f-83b1-ed27a9644a9a/console" -H "Authorization: Bearer: {KEY}" -H "Authorization: Bearer: {KEY}" -H "Content-type: application/json" -d '{"input": "say hello world"}' 
// Create a client.
var client = new ApiClient("{key}");
// Delete a user from a Crate.
await client.CrateSharingOperations.SendCommandAsync(new Guid("269be408-3332-443f-83b1-ed27a9644a9a"), new CrateConsoleInputEntity{
    Input = "say hello world"
});

Input a command into the console for a given server. To call this route successfully the server must already be in the running state and you must have either owner, admin or write permissions.

We are building a new feature that will allow you to stream a server's console using WebSockets. We'll let you know when this is ready.

HTTP Request

POST /server/{uuid}/console

URL Parameters

Parameter Description
uuid The UUID of the server to input a command to.

Body Contents

Parameter Required Type Description
input Yes String The command to run.

Response Codes

204 No Content - The restart command has been received by the server.

403 Forbidden - You do not have the required permissions to change the state of this server.

404 Not Found - server could not be found.

410 Gone - The server has been deleted.

412 Precondition Failed - The command can not be sent, this could be because the server is offline.

Packages API Routes

List Packages

curl "https://api.serverflex.io/1.0/package" -H "Authorization: Bearer {KEY}"
// Create a client.
var client = new ApiClient("{KEY}");

// List packages usingn paginationn.
var packages = await client.CratePackages.ListCratePackagesAsync();
// List all packages in one method call.
var allPackages = await client.CratePackages.ListAllCratePackagesAsync();

This route returns the following JSON.

{
    "limit": 25,
    "page": 1,
    "results": [
        {
            "displayName": "Minecraft",
            "name": "minecraft",
            "plans": [
                {
                    "displayName": "Grass",
                    "name": "mc.grass",
                    "pricing": {
                        "costHourly": 0.07,
                        "costMonthly": 7.0,
                        "currency": "USD"
                    },
                    "resources": {
                        "backupsInMB": 20000,
                        "cpuCount": 2.0,
                        "memoryInMB": 1024,
                        "storageInMB": 10000
                    }
                }
            ],
            "runtimes": [
                {
                    "aliases": {
                        "latest": "1.16.4"
                    },
                    "displayName": "Vanilla",
                    "name": "vanilla",
                    "versions": [
                        {
                            "displayName": "1.16.14",
                            "name": "1.16.14"
                        }
                    ]
                }
            ],
            "regions": [
                {
                    "country": "US West",
                    "city": "Ashburn",
                    "name": "usa-1"
                }
            ]
        },
        {
            "displayName": "Factorio",
            "name": "factorio",
            "plans": [
                {
                    "displayName": "Wood",
                    "name": "fc.wood",
                    "pricing": {
                        "costHourly": 0.07,
                        "costMonthly": 7.0,
                        "currency": "USD"
                    },
                    "resources": {
                        "backupsInMB": 20000,
                        "cpuCount": 2.0,
                        "memoryInMB": 512,
                        "storageInMB": 10000
                    }
                }
            ],
            "runtimes": [
                {
                    "aliases": {
                        "stable": "1.0.0",
                        "experimental": "1.1.6"
                    },
                    "displayName": "Factorio",
                    "name": "factorio",
                    "versions": [
                        {
                            "displayName": "1.1.5",
                            "name": "1.1.5"
                        },
                        {
                            "displayName": "1.0.0",
                            "name": "1.0.0"
                        },
                        {
                            "displayName": "1.1.6",
                            "name": "1.1.6"
                        }
                    ]
                }
            ],
            "regions": [
                {
                    "country": "US West",
                    "city": "Ashburn",
                    "name": "usa-1"
                }
            ]
        },
        {
            "displayName": "CS:GO",
            "name": "csgo",
            "plans": [
                {
                    "displayName": "Mil-Spec",
                    "name": "csgo.milspec",
                    "pricing": {
                        "costHourly": 0.07,
                        "costMonthly": 7.0,
                        "currency": "USD"
                    },
                    "resources": {
                        "backupsInMB": 30000,
                        "cpuCount": 2.0,
                        "memoryInMB": 1024,
                        "storageInMB": 15000
                    }
                }
            ],
            "runtimes": [
                {
                    "aliases": {
                        "stable": "1.10-6499",
                        "development": "1.11-6645"
                    },
                    "displayName": "SourceMod",
                    "name": "sourcemod",
                    "versions": [
                        {
                            "displayName": "1.10 #6499",
                            "name": "1.10-6499"
                        },
                        {
                            "displayName": "1.10 #6645",
                            "name": "1.11-6645"
                        }
                    ]
                }
            ],
            "regions": [
                {
                    "country": "US West",
                    "city": "Ashburn",
                    "name": "usa-1"
                }
            ]
        }
    ],
    "totalPages": 1,
    "totalResults": 3
}

Get a list of packages, this will be returned in the standard Results Response with pagination.

HTTP Request

GET /package

Query Parameters

Parameter Required Description Default Misc
limit No The maximum number of Packages that can be returned. 25 Minimum: 1, Maximum: 50
page No The cursor for the next batch of results. 1 Minimum 1

Response Codes

200 OK

Get a Package

curl "https://api.serverflex.io/1.0/package/minecraft" -H "Authorization: Bearer {KEY}"
// Create a client.
var client = new ApiClient("{KEY}");

// Find a package.
var package = await client.CratePackages.GetCratePackageAsync("minecraft");

This route returns the following JSON.

{
    "displayName": "Minecraft",
    "name": "minecraft",
    "plans": [
        {
            "displayName": "Grass",
            "name": "mc.grass",
            "pricing": {
                "costHourly": 0.07,
                "costMonthly": 7.0,
                "currency": "USD"
            },
            "resources": {
                "backupsInMB": 20000,
                "cpuCount": 2.0,
                "memoryInMB": 1024,
                "storageInMB": 10000
            }
        }
    ],
    "runtimes": [
        {
            "aliases": {
                "latest": "1.16.4"
            },
            "displayName": "Vanilla",
            "name": "vanilla",
            "versions": [
                {
                    "displayName": "1.16.14",
                    "name": "1.16.14"
                }
            ]
        },
        {
            "aliases": {
                "latest": "35.1.13",
                "recommended": "35.1.4",
            },
            "displayName": "Forge",
            "name": "forge",
            "versions": [
                {
                    "displayName": "35.1.13",
                    "name": "35.1.13"
                },
                {
                    "displayName": "35.1.4",
                    "name": "35.1.4"
                }
            ]
        }
    ],
    "regions": [
        {
            "country": "U.K.",
            "city": "London",
            "name": "us-west-1"
        }
    ]
}

Retrieve a specific Package.

HTTP Request

GET /package/{name}

URL Parameters

Parameter Description
name The name of the Package.

Response Codes

200 OK - Package found.

404 Not Found - This Package can not be found.

410 Gone - This Package has been discontinued.

Get Properties for a Package

curl "https://api.serverflex.io/1.0/package/minecraft/properties" -H "Authorization: Bearer {KEY}"
// Create a client.
var client = new ApiClient("{KEY}");

// Find the properties for a package.
var properties = await client.CratePackageOperations.ListAllCratePackageProperties("minecraft");

This command returns the following JSON.

[
    {
        "acceptedValues": [
            {
                "display": "True",
                "value": true
            }
        ],
        "default": true,
        "name": "eula",
        "required": true,
        "valueType": "boolean"
    }
]

List all available properties for a specific Package. See Property.

HTTP Request

GET /package/{packageName}/properties

URL Parameters

Parameter Description
packageName The name of the Package.

Response Codes

200 OK

404 Not Found - The package could not be found.

410 Gone - This Package has been discontinued.

Region API Routes

List Regions

curl "https://api.serverflex.io/1.0/region" -H "Authorization: Bearer {KEY}"
// Create a client.
var client = new ApiClient("{KEY}");
// List regions using pagination.
var regions = await client.RegionOperations.ListRegionsAsync();
// List all the regions. (Client will handle pagination)
var allregions = await client.RegionOperations.ListAllRegionsAsync();

This command returns the following JSON.

{
    "limit": 25,
    "page": 1,
    "results": [
        {
            "country": "U.K.",
            "city": "London",
            "name": "uk-1"
        },
        {
            "country": "US East",
            "city": "Ashburn",
            "name": "us-1"
        }
    ],
    "totalPages": 1,
    "totalResults": 2
}

List all available Regions.

HTTP Request

GET /region

Query Parameters

Parameter Required Description Default Misc
limit No The maximum number of Regions that can be returned. 25 Minimum: 1, Maximum: 50
page No The cursor for the next batch of results. 1 Minimum 1

Response Codes

200 OK

Get Region

curl "https://api.serverflex.io/1.0/region/uk-1" -H "Authorization: Bearer {KEY}"
// Create a client.
var client = new ApiClient("{KEY}");
// Get a region.
var region = await client.RegionOperations.GetRegionAsync("uk-1");

This command returns the following JSON.

{
    "name": "uk-1",
    "country": "UK",
    "city": "London"
}

Get a specific Region.

HTTP Request

GET /region/{name}

URL Parameters

Parameter Description
name The name of the Region.

Response Codes

200 OK - Region found.

404 Not Found - This Region can not be found.

410 Gone - This Region has been discontinued.

Account API Routes

These routes return information regarding your account. Changes to your account information must be made through the Web App.

Get basic account information

curl "https://api.serverflex.io/1.0/account" -H "Authorization: Bearer: {KEY}"
// Create a client.
var client = new ApiClient("{KEY}");

// Get account information.
var user = await client.Accounts.GetUserAsync();

This command returns the following JSON body.

{
    "country": "GB",
    "createdAt": "2020-04-20T10:21:45.1852191+00:00",
    "emailAddress": "[email protected]",
    "givenName": "Awesome",
    "familyName": "Legend",
    "referralToken": "awesome-legend-123",
    "username": "[email protected]",
    "uuid": "00000000-0000-0000-0000-000000000000"
}

This route returns a User Object containing information about your account.

HTTP Request

GET /account

Response Codes

200 OK

Get balances for your account

curl "https://api.serverflex.io/1.0/account/balance" -H "Authorization: Bearer: {KEY}"
// Create a client.
var client = new ApiClient("{KEY}");

// Get balances.
var balances = await client.Accounts.GetBalanceAsync();

This command returns the following JSON body.

[
    {
        "amount": 28.25,
        "currency": "GBP"
    }
]

This route returns an array of Balance Objects, this will contain the three character code of the currency and a decimal of how much of that currency your account holds.

HTTP Request

GET /account/balance

Response Codes

200 OK

Object Definitions

Result Response

{
    "results": [],
    "totalResults": 0,
    "limit": 25,
    "page": 1,
    "totalPages": 0
}

A result object is a generalised return format used by this API. It is used to return pages of results in a reusable format. When a result object is returned, you can usually supply the query parameters page and limit.

Attribute Type Description
results Array An array of objects. The object type will be defined per the request.
totalResults Integer The total number of results, not just those on this page.
limit Integer The limit for each page.
page Integer The current page.
totalPages Integer The total number of available pages.

Server Object

{
    "uuid": "00000000-0000-0000-0000-000000000000",
    "name": "Example Server",
    "state": "running",
    "package": {
        "name": "minecraft",
        "displayName": "Minecraft"
    },
    "plan": {
        "name": "mc.grass",
        "displayName": "Grass",
        "pricing": {
            "costHourly": 0.03,
            "costMonthly": 5.0,
            "currency": "USD"
        },
    },
    "billingType": "hourly",
    "createdAt": "2021-01-08T16:35:40.9343245+00:00",
    "locked": {
        "isLocked": false,
        "reason": null
    },
    "network": {
        "ipAddress": "192.168.1.10",
        "ports": [
            {
                "name": "gmae",
                "port": 25565,
                "protocol": "tcp"
            }
        ],
        "subDomain": "1ab23cd4.crate.pw"
    },
    "permission": "owner",
    "plan": {
        "displayName": "Grass",
        "name": "mc.grass",
        "pricing": [
            {
                "costHourly": 0.05,
                "costMonthly": 5.0,
                "currency": "GBP"
            }
        ],
        "resources": {
            "backupsInMB": 20000,
            "cpuCount": 2.0,
            "memoryInMB": 1024,
            "storageInMB": 10000
        }
    },
    "region": {
        "country": "US",
        "city": "Ashburn",
        "name": "us-1"
    }
}
Attribute Type Description
billingType String The billing method of the server, either hourly or monthly.
createdAt DateTime The date and time when the server was created in ISO 8601 format.
locked ServerLockInfoObject The lock state information for the server.
name String The name of the server. A server name can only contain the following characters: "a-z", "A-Z", "0-9", "_", "-", "[]", "+"
network NetworkInfoObject The server's network information.
package PackageObject The server Package the servr is running. (See Package)
permission String The permission level you have on this server. (See Permissions)
plan PlanObject The Plan your server is currently running. (See Plan)
region RegionObject The Region the server is running in. (See Region)
runtimes Array (RuntimeObject) The Runtimes running on the servre. (See Runtime)
state String The current state of the servr. (See Server States)
uuid String The unique ID of the server.

Server States

A server can be in any of the following states:

Package Object

{
    "name": "minecraft",
    "displayName": "Minecraft",
    "plans": [
        {
            "name": "mc.grass",
            "displayName": "Grass",
            "name": "mc.grass",
            "pricing": [
                {
                    "costHourly": 0.05,
                    "costMonthly": 5.0,
                    "currency": "GBP"
                }
            ],
            "resources": {
                "backupsInMB": 20000,
                "cpuCount": 2.0,
                "memoryInMB": 1024,
                "storageInMB": 10000
            }
        }
    ],
    "regions": [
        {
            "name": "us-1",
            "country": "USA",
            "city": "Ashburn"
        }
    ],
    "runtimes": [
        {
            "aliases": {
                "latest": "1.16.4"
            },
            "displayName": "Vanilla",
            "name": "vanilla",
            "versions": [
                {
                    "displayName": "1.16.4",
                    "name": "1.16.4"
                }
            ]
        }
    ]
}
Attribute Type Description
displayName String The display name for this Package.
name String The unique name of of the Package.
plans Array (PlanObject) The Plans that are available for the Package. (See Plan)
regions Array (RegionObject) The Regions where the Package can be deployed. (See Region)
runtimes Array (RuntimeObject) The Runtimes that are available for the Package. (See Runtime)

Runtime Object

{
    "aliases": {
        "latest": "1.16.4"
    },
    "displayName": "Vanilla",
    "name": "vanilla",
    "versions": [
        {
            "displayName": "1.16.4",
            "name": "1.16.4"
        }
    ]
}
Attribute Type Description
aliases Array (key value pair) The version aliases available for the Runtime.
displayName String The display name for the Runtime.
name String The unique name of the Runtime.
versions Array (RuntimeVersionObject) The versions available for the Runtime. (See Runtime Version)

Runtime Version Object

{
    "displayName": "1.16.4",
    "name": "1.16.4"
}
Attribute Type Description
displayName String The display name for this version.
name String The unique name of this Runtime Version.

Property Object

{
    "allowedValues": [
        {
            "display": "Peaceful",
            "group": null,
            "value": "peaceful",
        }
    ],
    "categoryName": "world",
    "name": "difficulty",
    "value": "normal",
    "valueType": "string"
}
Attribute Type Description
allowedValues Array (AllowedValueObject) An array of values that can be used to configure the setting. If this array contains items, only the values from this array can be used to modify the setting. (See AllowedValueObject)
categoryName String The unique name of the category that this setting falls under.
name String The unique name of the setting.
value Various The value of the setting as per the value type.
valueType String The type of the value.

Allowed Value Object

{
    "display": "Peaceful",
    "group": null,
    "value": "peaceful",
}
Attribute Type Description
display String The display name of the value.
group String The group that the setting belongs to. May be null.
value Various The value of the setting as per the value type defined in the parent object.

Plan Object

{
    "displayName": "Grass",
    "name": "mc.grass",
    "pricing": [
        {
            "costHourly": 0.05,
            "costMonthly": 5.0,
            "currency": "GBP"
        }
    ],
    "resources": {
        "backupsInMB": 20000,
        "cpuCount": 2.0,
        "memoryInMB": 1024,
        "storageInMB": 10000
    }
}
Attribute Type Description
displayName String The display name of the Plan.
name String The unique name of the Plan.
pricing Array (PricingObject) An array containing an object defining the price for your accounts chosen currency.
resources PlanResourceObject The resources this Plan will have.

Pricing Object

{
    "costHourly": 0.05,
    "costMonthly": 5.0,
    "currency": "GBP"
}
Attribute Type Description
costHourly Decimal The amount that will billed each hour for this servre.
costMonthly Decimal The cost this plan will cap out at, per month. (This is calculated by costMonthly / (7 * 24)). This is because the server bills each hour for the first seven days, after that you hit the monthly cost of the server and it is free for the remainder of the period.
currency String The currency code that this plan is billed in, in ISO 4217 format.

Plan Resource Object

{
    "backupsInMB": 20000,
    "cpuCount": 2.0,
    "memoryInMB": 1024,
    "storageInMB": 10000
}
Attribute Type Description
backupsInMB Integer The amount of backup-allocated-storage (in MB) provided by this Plan.
cpuCount Double The number of vCPUs provided by this Plan.
memoryInMB Integer The amount of memory (in MB) provided by this Plan.
storageInMB Integer The amount of storage (in MB) provided by this Plan.

Region Object

{
    "name": "uk-1",
    "country": "UK",
    "city": "London"
}
Attribute Type Description
country String The name of the country where the Region is hosted.
city String The name of the city where the Region is hosted.
name String The unique name of the Region.

Operation Object

{
    "createdAt": "2020-06-03T12:28:06.0937006+00:00",
    "completedAt": "2020-06-03T12:28:06.7964868+00:00",
    "isCompleted": true,
    "isCompletedSuccessfully": true,
    "type": "Start",
    "uuid": "00000000-0000-0000-0000-000000000000"
}
Attribute Type Description
createdAt DateTime The datetime the operation was created.
completedAt DateTime / Null The datetime the operation was completed.
isCompleted Boolean Is the operation completed.
isCompletedSuccesfully Boolean If the operation is completed, did it complete succesfully.
type String The type of operation.
uuid Guid The unique id of the operation.

User Object

{
    "country": "GB",
    "createdAt": "2020-04-20T10:21:45.1852191+00:00",
    "emailAddress": "[email protected]",
    "givenName": "Awesome",
    "familyName": "Legend",
    "referralToken": "awesome-legend-123",
    "username": "[email protected]",
    "uuid": "00000000-0000-0000-0000-000000000000"
}
Attribute Type Description
country String The two character ISO standard country code for your country.
createdAt DateTime The date and time when the account was created.
emailAddress String The email address for your account.
givenName String Your given name,
familyName String Your family name.
referralToken String Your account's referral token.
username String Your account username.
uuid String Your account's unique ID.

Balance Object

{
    "amount": 28.25,
    "currency": "GBP"
}
Attribute Type Description
amount Decimal The amount of that currency on the account.
currency String The three character code of the balance.

Permissions

Permissions are used to control what users can do with your servers when shared.

Outlined below is the hierarchy of permission levels.

owner - Assigned to the user who pays for the resource. The resource belongs to their account.

admin - This permission grants the user the ability to perform any action on a resource.

write - This permission grants the user the ability to write information to a resource. They do not have permission to destructive operations (for example: deleting a server).

read - This permission grants the user the ability to view resources but not modify it in any way.

Error Handling

The ServerFlex API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is invalid.
403 Forbidden -- You do not have permission to perform that action.
404 Not Found -- The route or object you tried to access could not be found.
405 Method Not Allowed -- You tried to access a route with the incorrect method.
406 Not Acceptable -- You requested a format that isn't JSON.
410 Gone -- The resource requested has been removed from our servers.
429 Too Many Requests -- You're requesting too many requests! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
502 Bad Gateway - Try your request again - it was incorrectly hanndled.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.