# Introduction

The Suble Cloud rest API operates using the HTTPS protocol and utilizes JSON for its data format. This means all requests either submitting data or requesting data is expected to use the JSON format.

### Authorization

For authorization it uses the **Bearer Authentication** standard to implement JWT and a custom implementation for API tokens. For more information, see below

{% tabs %}
{% tab title="Project Key (Token)" %}
Project keys are generated and linked to a project, this means the key is locked to only work inside the project and cannot generate more project keys or new projects on the user's behalf.\
\
To authorize requests to Suble Cloud API, add "apikey" as prefix to the autorization header.\
Example:

`apikey xxxx-xxxx-xxxx`
{% endtab %}

{% tab title="User Token (JWT)" %}
User tokens are generated when a user logins to the Stacket Group Platform, they are used by the dashboard to communicate with our rest api. The user token can therefore be used for billing, creating project and everything a project key can do.

{% hint style="warning" %}
All requests are logged, therefore the user token will be authenticating on your behalf.
{% endhint %}
{% endtab %}
{% endtabs %}


# Roadmap

List of planned features, not ordered.

{% content-ref url="/pages/-McAgGPVWegMEck-fqkm" %}
[Changelog](/changelog/19-06-2022)
{% endcontent-ref %}

## Status Code

Use more http status codes to identify errors etc.

## Error codes

Numbered error codes along with the error messages, this will make it easier for api's to identify the specific error.

## Additional Networks

Create additional private networks that can be used instead or along with the default project network.

## Firewall

Creating firewall rules to manage networking.

## Event Websocket

Eventbus powered by websocket technology, this would allow users to listen for events like VM power on etc


# List

Available for user tokens.

{% hint style="danger" %}
This endpoint is only available for user tokens, **not project keys**!
{% endhint %}

## List

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects`

Retrieve list of all projects user is a member of.

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | User token  |

{% tabs %}
{% tab title="200 " %}

```
[
    {
        "_id": ObjectId,
        "name": String,
        "created": Number, //Unix timestamp
        "balance": Number,
        "user": ObjectId,
        "usecase": String,
        "support": String,
        "members": [
            {
                "id": ObjectId
            }
        ]
    }
]
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Get

Available for user tokens and project keys

## Get

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId`

Retrieve information about a project

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": ObjectId,
    "name": String,
    "created": Number, //Unix timestamp
    "balance": Number,
    "user": ObjectId,
    "usecase": String,
    "support": String,
    "members": [
        {
            "id": ObjectId
        }
    ]
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Create

Available for user tokens

{% hint style="danger" %}
This endpoint is only available for user tokens, **not project keys**!
{% endhint %}

## Create

<mark style="color:green;">`POST`</mark> `https://api.suble.io/projects`

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | User token  |

#### Request Body

| Name       | Type   | Description                                       |
| ---------- | ------ | ------------------------------------------------- |
| creditcard | string | Credit card used for project billing              |
| name       | string | Project name                                      |
| usecase    | array  | Options Available: Personal, Business & Reselling |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": ObjectId,
    "name": String,
    "created": Number, //Unix timestamp
    "balance": Number,
    "user": ObjectId,
    "usecase": String,
    "support": String,
    "members": [
        {
            "id": ObjectId
        }
    ]
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Transactions

Available for user tokens and project keys

## Transactions

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/transactions`

Retrieve list of all transactions **sorted by newest**

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id: ObjectId,
    "project: ObjectId,
    "user: ObjectId,
    "userName: String, // Full name of user that created the transaction
    "status: String, // Enum ("pending" / "error" / "success")
    "orderid: String,
    "amount: Number,
    "date: Number, // Unix timestamp
    "identifier: String,
    "url: String
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Keys

Available for user tokens

{% hint style="danger" %}
This endpoint is only available for user tokens, **not project keys**!
{% endhint %}

## List

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/keys`

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | User token  |

{% tabs %}
{% tab title="200 " %}

```
[
    {
        "_id": ObjectId,
        "type": String, //Ideally CLOUD-PROJECT-KEY or LOGIN
        "token": String, 
        "project": ObjectId,
        "name": String,
        "date": Number //Unix timestamp
    }
]
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}

## Create

<mark style="color:green;">`POST`</mark> `https://api.suble.io/projects/:projectId/keys`

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string | User token  |

#### Request Body

| Name | Type   | Description             |
| ---- | ------ | ----------------------- |
| name | string | Name of the project key |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": ObjectId,
    "type": String, //CLOUD-PROJECT-KEY
    "token": String, 
    "project": ObjectId,
    "name": String,
    "date": Number //Unix timestamp
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Invoices

Available for user tokens and project keys

## Invoices

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/invoices`

Retrieve list of invoices linked to the project.

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |

#### Headers

| Name          | Type   | Description                |
| ------------- | ------ | -------------------------- |
| Authorization | string | User token or project key. |

{% tabs %}
{% tab title="200 " %}

```
[
    {
        _id: ObjectId,
        project: ObjectId,
        status: String,
        date: Unix timestamp,
        orderid: String,
        total: Number,
        items: [
            {
                type: String,
                product: ObjectId,
                name: String,
                price: Number
            }
        ],
        user: ObjectId, //Nullable
        token: String //Nullable
    }
]
```

{% endtab %}
{% endtabs %}


# Members

Available for user tokens and project keys

## Get Members

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/members`

Retrieve list of members apart of the project.

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |

#### Headers

| Name          | Type   | Description                |
| ------------- | ------ | -------------------------- |
| Authorization | string | User token or project key. |

{% tabs %}
{% tab title="200 " %}

```
[
    {
        "_id": ObjectId,
        "fullname": String,
        "email": String,
        "image": String,
        "pending": Boolean
    }
]
```

{% endtab %}
{% endtabs %}

## Invite Member

<mark style="color:green;">`POST`</mark> `https://api.suble.io/projects/:projectId/members`

Invite user to the project

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |

#### Headers

| Name          | Type   | Description                |
| ------------- | ------ | -------------------------- |
| Authorization | string | User token or project key. |

#### Request Body

| Name  | Type   | Description             |
| ----- | ------ | ----------------------- |
| email | string | Email of user to invite |

{% tabs %}
{% tab title="200 " %}

```
{
    "success": true
}
```

{% endtab %}

{% tab title="401 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# List

Available for user tokens and project keys

## List

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/vm`

Retrieve a list of all virtual machines in the project.

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 Returns an array of virtual machine objects" %}

```
[
    {
        "_id": ObjectId,
        "project": ObjectId,
        "name": String,
        "status": String ("offline" | "online"),
        "online": Boolean,
        "created": Number, // Datetime Unix
        "network": {
            "ipv4": {
                "public": String,
                "private": {
                    "network": ObjectId,
                    "address": String,
                    "macaddress": String
                }
            },
            "floating": Array
        },
        "package": {
            "name": String,
            "cores": Number,
            "memory": Number, // Defined in MB
            "storage": Number, // Defined in MB,
            "price": Number // Defined as 1 DKK = 100 
        },
        "esxi": Number,
        "datacenter": String, // Example: aad1-dc1
        "node": Number,
        "renew": Number, // Datetime Unix
        "image": {
            "long": String, // linux-ubuntu-20.10
            "short": String, // ubuntu-20.10
            "flavor": String, // ubuntu
            "version": String, // 20.10
            "icon": String, //ubuntu (MDI Icon)
        },
        usage: {
            cpu: Number,
            ram: Number,
            date: Number // Datetime Unix
        }
    }
]4
```

{% endtab %}

{% tab title="400 Error can occur if request was made unauthorized or with an invalid project id." %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Get

Available for user tokens and project keys

## Get

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/vm/:vmId`

Retrieve information about a virtual machine

#### Path Parameters

| Name      | Type   | Description                       |
| --------- | ------ | --------------------------------- |
| projectId | string | Unique id for the project         |
| vmId      | string | Unique id for the virtual machine |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
{
    "_id": ObjectId,
    "project": ObjectId,
    "name": String,
    "status": String ("offline" | "online"),
    "online": Boolean,
    "created": Number, // Datetime Unix
    "network": {
        "ipv4": {
            "public": String,
            "private": {
                "network": ObjectId,
                "address": String,
                "macaddress": String
            }
        },
        "floating": Array
    },
    "package": {
        "name": String,
        "cores": Number,
        "memory": Number, // Defined in MB
        "storage": Number, // Defined in MB,
        "price": Number // Defined as 1 DKK = 100 
    },
    "esxi": Number,
    "datacenter": String, // Example: aad1-dc1
    "node": Number,
    "renew": Number, // Datetime Unix
    "image": {
        "long": String, // linux-ubuntu-20.10
        "short": String, // ubuntu-20.10
        "flavor": String, // ubuntu
        "version": String, // 20.10
        "icon": String, //ubuntu (MDI Icon)
    },
    usage: {
        cpu: Number,
        ram: Number,
        date: Number // Datetime Unix
    }
}
```

{% endtab %}
{% endtabs %}


# Create

Available for user tokens and project keys

## Create

<mark style="color:green;">`POST`</mark> `https://api.suble.io/projects/:projectId/vm`

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique Id for the project |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

#### Request Body

| Name          | Type   | Description                            |
| ------------- | ------ | -------------------------------------- |
| name          | string | Name of the virtual machine            |
| package       | string | Package of the virtual machine         |
| image         | object | Operating system of the virtual        |
| image.flavor  | string | OS name, example ubuntu                |
| image.version | string | OS version, example 20.10              |
| couponCode    | String | Discount code                          |
| rdns          | String | Predefine rDNS domain                  |
| password      | String | Default Root or Administrator password |

{% tabs %}
{% tab title="200 " %}

```
{
    "root_password": String,
    "server": {
        "_id": ObjectId,
        "project": ObjectId,
        "name": String,
        "status": String ("offline" | "online"),
        "online": Boolean,
        "created": Number, // Datetime Unix
        "network": {
            "ipv4": {
                "public": String,
                "private": {
                    "network": ObjectId,
                    "address": String,
                    "macaddress": String
                }
            },
            "floating": Array
        },
        "package": {
            "name": String,
            "cores": Number,
            "memory": Number, // Defined in MB
            "storage": Number, // Defined in MB,
            "price": Number // Defined as 1 DKK = 100 
        },
        "esxi": Number,
        "datacenter": String, // Example: aad1-dc1
        "node": Number,
        "renew": Number, // Datetime Unix
        "image": {
            "long": String, // linux-ubuntu-20.10
            "short": String, // ubuntu-20.10
            "flavor": String, // ubuntu
            "version": String, // 20.10
            "icon": String, //ubuntu (MDI Icon)
        },
        usage: {
            cpu: Number,
            ram: Number,
            date: Number // Datetime Unix
        }
    }
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Modify

Available for user tokens and project keys

## Modify

<mark style="color:green;">`POST`</mark> `https://api.suble.io/projects/:projectId/vm/:vmId`

Modify virtual machine information

#### Path Parameters

| Name      | Type   | Description                       |
| --------- | ------ | --------------------------------- |
| projectId | string | Unique id for the project         |
| vmId      | string | Unique id for the virtual machine |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

#### Request Body

| Name | Type   | Description              |
| ---- | ------ | ------------------------ |
| name | string | New virtual machine name |

{% tabs %}
{% tab title="200 " %}

```
{
    "message": String
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Rescale

Available for user tokens and project keys

## Rescale

<mark style="color:green;">`POST`</mark> `https://api.suble.io/projects/:projectId/vm/:vmId/package`

Rescale virtual machine package

#### Path Parameters

| Name      | Type   | Description                       |
| --------- | ------ | --------------------------------- |
| projectId | string | Unique id for the project         |
| vmId      | string | Unique id for the virtual machine |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

#### Request Body

| Name    | Type   | Description     |
| ------- | ------ | --------------- |
| package | string | Name of package |

{% tabs %}
{% tab title="200 " %}

```
{
    "status": "success"
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# rDNS

Available for user tokens and project keys

{% hint style="info" %}
Stacket Group complies with the RIPE NCC IPv4 PTR record guidelines, therefore our systems automatically does a DNS record check to make sure its a 1:1 mapping otherwise the request will be denied.&#x20;

If our system cannot find an A record matching the rDNS requested domain, the request will be denied with following error message "A record does not match %ipv4 address%"
{% endhint %}

## Retrieve rDNS records

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/vm/:vmId/rdns`

This endpoint will respond with a list of all IPv4 addresses connected to the virtual machine along with their PTR record.

#### Path Parameters

| Name      | Type   | Description                       |
| --------- | ------ | --------------------------------- |
| projectId | string | Unique Id for the project         |
| vmId      | string | Unique Id for the virtual machine |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
[
    {
        "ipv4": String,
        "record": String
    }
]
```

{% endtab %}
{% endtabs %}

## Modify rDNS record

<mark style="color:green;">`POST`</mark> `https://api.suble.io/projects/:projectId/vm/:vmId/rdns`

This endpoint is used to modify a PTR record of an virtual machine ipv4 address

#### Path Parameters

| Name      | Type   | Description                       |
| --------- | ------ | --------------------------------- |
| projectId | string | Unique Id for the project         |
| vmId      | string | Unique Id for the virtual machine |

#### Request Body

| Name   | Type   | Description                                   |
| ------ | ------ | --------------------------------------------- |
| Ipv4   | string | IPv4 address of the record you want to modify |
| record | string | The domain you want the record changed to     |

{% tabs %}
{% tab title="200 " %}

```
{
    "message": String
}
```

{% endtab %}

{% tab title="400 This response will occur if you provide invalid body data or for example the domain doesn't have a matching record." %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Console

Available for user tokens and project keys

This endpoint is used for getting remote access to a virtual machine's VNC

## Generate link

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/vm/:vmId/console`

This endpoint will generate a 1 hour link that will allow any users with the link to manage the virtual machine console / vnc

#### Path Parameters

| Name      | Type   | Description                       |
| --------- | ------ | --------------------------------- |
| projectId | string | Unique Id for the project         |
| vmId      | string | Unique Id for the virtual machine |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
{
    "token": String,
    "link": String
}
```

{% endtab %}
{% endtabs %}


# Actions

Available for user tokens and project keys

## List

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/vm/:vmId/actions/:amount?`

Retrieve a list of actions performed on virtual machine.

#### Path Parameters

| Name      | Type   | Description                                         |
| --------- | ------ | --------------------------------------------------- |
| projectId | string | Unique Id for the project                           |
| vmId      | string | Unique Id for the virtual machine                   |
| amount    | number | Amount of actions that will be fetched. Default: 25 |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 List of actions" %}

```
[
        {
                "_id": ObjectId,
                "user": ObjectId, // nullable
                "apikey": String, // nullable
                "type": String,
                "command": String,
                "vm": String,
                "running": Boolean,
                "progress": Number,
                "date": Number // Date time unix
        }
]
```

{% endtab %}

{% tab title="400 Error message will occur if provided information is invalid." %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Controls

Available for user tokens and project keys

## Controls

<mark style="color:green;">`POST`</mark> `https://api.suble.io/projects/:projectId/vm/:vmId/controls/:type`

This endpoint allows you to start, stop or reset a virtual machine.

#### Path Parameters

| Name      | Type   | Description                       |
| --------- | ------ | --------------------------------- |
| projectId | string | Unique id for the project         |
| vmId      | string | Unique id for the virtual machine |
| type      | string | Enum (start / stop / reset)       |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 Returns action data" %}

```
{
        "_id": ObjectId,
        "user": ObjectId, // nullable
        "apikey": String, // nullable
        "type": String,
        "command": String,
        "vm": String,
        "running": Boolean,
        "progress": Number,
        "date": Number // Date time unix
}
```

{% endtab %}

{% tab title="400 Error will occur if control type is invalid or the vm doesn't exist." %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Cancel

Available for user tokens and project keys

## Cancel

<mark style="color:green;">`POST`</mark> `https://api.suble.io/projects/:projectId/vm/:vmId/cancel`

Schedule or unschedule cancellation of a virtual machine

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

#### Request Body

| Name   | Type    | Description                                          |
| ------ | ------- | ---------------------------------------------------- |
| cancel | boolean | true = cancel, false = remove scheduled cancellation |

{% tabs %}
{% tab title="200 " %}

```
{
    "status": "success"
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Delete

Available for user tokens and project keys

## Delete

<mark style="color:red;">`DELETE`</mark> `https://api.suble.io/projects/:projectId/vm/:vmId`

Force delete virtual machine.

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
{
    "status": "success"
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Network Usage

Available for user tokens and project keys

## Get

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/vm/:vmId/networkusage/:interval/:type`

Retrieve image of network usage graph

#### Path Parameters

| Name      | Type   | Description                       |
| --------- | ------ | --------------------------------- |
| projectId | string | Unique Id for the project         |
| vmId      | string | Unique Id for the virtual machine |
| interval  | string | Options: Daily, Weekly & Monthly  |
| type      | string | Options: Send & Receive           |

#### Headers

| Name          | Type   | Description           |
| ------------- | ------ | --------------------- |
| Authorization | string | Project or user token |

{% tabs %}
{% tab title="200 " %}

```
//Returns image of graph
```

{% endtab %}

{% tab title="500 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# List

## List

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/floating_ips`

Retrieve list of floating ips

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
[
        {
                "_id": ObjectId,
                "project": ObjectId,
                "ipv4": {
                    "ip": String,
                    "gateway": String,
                    "subnet": String,
                    "type": String
                },
                "ipv6: {
                    "ip": String
                },
                "macaddress": String,
                "vms": [ObjectId], //Array
                "name": String,
                "purpose": String,
                "price": Integer,
                "connected": String
        }
]
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Order

## Order

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/floating_ips`

Order Floating ip

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique Id for the project |

#### Headers

| Name          | Type   | Description           |
| ------------- | ------ | --------------------- |
| Authorization | string | User or project token |

{% tabs %}
{% tab title="200 " %}

```
{
        "_id": ObjectId,
        "project": ObjectId,
        "ipv4": {
            "ip": String,
            "gateway": String,
            "subnet": String,
            "type": String
        },
        "ipv6: {
            "ip": String
        },
        "macaddress": String,
        "vm": ObjectId, //Nullable
        "name": String,
        "purpose": String,
        "price": Integer,
        "connected": String
}
```

{% endtab %}
{% endtabs %}


# Get

## Get

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/floating_ips/:id`

Retrieve floating ip

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |
| id        | string | Floating IP Id            |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
{
        "_id": ObjectId,
        "project": ObjectId,
        "ipv4": {
            "ip": String,
            "gateway": String,
            "subnet": String,
            "type": String
        },
        "ipv6: {
            "ip": String
        },
        "macaddress": String,
        "vms": [ObjectId], //Array
        "name": String,
        "purpose": String,
        "price": Integer,
        "connected": String
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Assign

## Assign

<mark style="color:green;">`POST`</mark> `https://api.suble.io/projects/:projectId/floating_ips/:id/assign`

Assign floating ip to virtual machine

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |
| id        | string | Floating IP Id            |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

#### Request Body

| Name | Type   | Description           |
| ---- | ------ | --------------------- |
| vm   | string | Id of virtual machine |

{% tabs %}
{% tab title="200 " %}

```
{
    "status": "success"
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}

## Detach

<mark style="color:red;">`DELETE`</mark> `https://api.suble.io/projects/:projectId/floating_ips/:id/assign?vm=:vm`

Detach floating ip from virtual machine

#### Path Parameters

| Name                                        | Type   | Description               |
| ------------------------------------------- | ------ | ------------------------- |
| projectId<mark style="color:red;">\*</mark> | string | Unique id for the project |
| id<mark style="color:red;">\*</mark>        | string | Floating IP Id            |

#### Query Parameters

| Name                                 | Type     | Description |
| ------------------------------------ | -------- | ----------- |
| vm<mark style="color:red;">\*</mark> | ObjectID | VM ID       |

#### Headers

| Name                                            | Type   | Description               |
| ----------------------------------------------- | ------ | ------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
{
    "status": "success"
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# rDNS

## Retrieve

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/floating_ips/:id/rdns`

Retrieve information about current rDNS record.

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |
| id        | string | Floating IP Id            |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
{
    "ipv4": String,
    "record": String
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}

## Assign

<mark style="color:green;">`POST`</mark> `https://api.suble.io/projects/:projectId/floating_ips/:id/rdns`

Update rDNS record

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |
| id        | string | Floating IP Id            |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

#### Request Body

| Name   | Type   | Description                    |
| ------ | ------ | ------------------------------ |
| record | string | New domain for the rDNS record |

{% tabs %}
{% tab title="200 " %}

```
{
    "message": String
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Delete

## Delete

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/floating_ips/:id`

Delete floating ip

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |
| id        | string | Floating IP Id            |

#### Headers

| Name          | Type   | Description |
| ------------- | ------ | ----------- |
| Authorization | string |             |

{% tabs %}
{% tab title="200 " %}

```
{
    "type": "success"
}
```

{% endtab %}
{% endtabs %}


# Network Usage

Available for user tokens and project keys

## Get

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/vm/:vmId/networkusage/:interval/:type`

Retrieve image of network usage graph

#### Path Parameters

| Name      | Type   | Description                       |
| --------- | ------ | --------------------------------- |
| projectId | string | Unique Id for the project         |
| vmId      | string | Unique Id for the virtual machine |
| interval  | string | Options: Daily, Weekly & Monthly  |
| type      | string | Options: Send & Receive           |

#### Headers

| Name          | Type   | Description           |
| ------------- | ------ | --------------------- |
| Authorization | string | Project or user token |

{% tabs %}
{% tab title="200 " %}

```
//Returns image of graph
```

{% endtab %}

{% tab title="500 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# List

Available for user tokens and project keys

## List

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/network`

Retrieve information about a network

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
[
        {
                "_id": ObjectId,
                "project": ObjectId,
                "name": String,
                "vlan": Number,
                "ip": String, // Example: 10.0.0.1
                "subnet": String, // Example '255.255.255.0'
                "default": Boolean
        }
]
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Get

Available for user tokens and project keys

## Get

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/projects/:projectId/network/:networkId`

Retrieve information about a network

#### Path Parameters

| Name      | Type   | Description               |
| --------- | ------ | ------------------------- |
| projectId | string | Unique id for the project |
| networkId | string | Unique id for the network |

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
{
        "_id": ObjectId,
        "project": ObjectId,
        "name": String,
        "vlan": Number,
        "ip": String, // Example: 10.0.0.1
        "subnet": String, // Example '255.255.255.0'
        "default": Boolean
}
```

{% endtab %}

{% tab title="400 " %}

```
{
    "error": String
}
```

{% endtab %}
{% endtabs %}


# Pricing

Available for user tokens and project keys

## Get

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/pricing`

Retrieve list of packages pricing

#### Headers

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
[
    {
        "name": String,
        "cores": Number,
        "memory": Number,
        "storage": Number,
        "price": Number
    }
]
```

{% endtab %}

{% tab title="400 " %}

```
[]
```

{% endtab %}
{% endtabs %}


# Operating Systems

## Get

<mark style="color:blue;">`GET`</mark> `https://api.suble.io/operatingsystems`

Retrieve list of operating systems supported

#### Path Parameters

| Name          | Type   | Description               |
| ------------- | ------ | ------------------------- |
| Authorization | string | User token or project key |

{% tabs %}
{% tab title="200 " %}

```
[
    {
        "type": String,
        "name": String,
        "icon": String, //MDI Icon
        "beta": Boolean,
        "minumum": {
            "cores": Number,
            "memory": Number,
            "storage": Number
        },
        "versions": [
            {
                "name": String,
                "default": Boolean,
                "latest": Boolean
            }
        ]
    }
]
```

{% endtab %}

{% tab title="400 " %}

```
[]
```

{% endtab %}
{% endtabs %}


# 19-06-2022

## Backup

Easily backup a virtual machine

## Discount code system

We now advertise discount codes on our discord and various places that can be used to save money when ordering a virtual machine.


# 28-02-2022

## Windows Server

We have officially added support for windows server including automatic setup and user generation.

## New Console

Rewritten shareable console link, mouse input is now working again

## Reset Password

Windows VPS's can now reset their password directly from our dashboard in case it was lost or you got locked out.

## Windows Stats

We are now injecting a daemon into windows meaning we can get stats readout such as cpu, ram and disk usage.

## Disk Upgrade

We can now upgrade the disk in windows and linux automatically when you change package.

## Apps

Use docker? No need to waste time anymore, just select it on the panel and order the vps. We will automatically ship the VPS with the latest docker version.


# 18-11-2021

## Windows

Windows has officially been re-added back into the system with fixes for mouse input.

## New Console

Since we moved over to our new hypervisor, we haven't got a working console. That changes today with our completely rewritten console made with no-vnc meaning it allows for both mouse and keyboard support.


# 20-10-2021

## Screenshot

Screenshots have been removed from the API

## Hypervisor

Legacy virtual machines created on our vmware platform can no longer be accessed through the API due to issues on VMWare Rest API.&#x20;

We have deployed a new infrastructure on our custom built hypervisor developed on top of XEN architecture giving us access to new and advanced features.


# 28-09-2021

## Screenshot

It is now possible to retrieve screenshot of a virtual machine's current VNC state.


# 14-09-2021

## Project Invitations

You can now invite people to be apart of your team


# 01-08-2021

## Floating IP Addresses

It is now possible to order additional IPv4 and IPv6 addresses and easily migrate them between virtual machines.


# 18-06-2021

## Rescale Virtual Machine

You can now rescale your virtual machine after your needs, for now automatic disk expansion has been disabled. For rescaling your disk along with the rest, you need to contact our support.


# 17-06-2021

## Addresses

You can now enter German, Norway and Swedish address into the account information

## Account Information

You can now change account information in the account tab.

## Ubuntu Update

We have now added support for Ubuntu v21.04


# 14-06-2021

## Hyperlinks

You are now able to click on the path names in the navbar for easier navigation.

![](/files/-McAqxUxZOSZK_GxcFYJ)

## More image types

The image above virtual machine name will now change depending on what type of operating system you have chosen.

![](/files/-McArMlXiSiPnMg-9mWp)

{% hint style="info" %}
General bug fixes on various pages.
{% endhint %}


