Bacloud API (1.0)

Download OpenAPI specification:Download

Introduction

This documentation aims to provide all the information you need to work with our API.

Getting Started

API Access Tokens

In order to use the API you need an access token.

  1. Sign in into the Bacloud client area using your user credentials.

  2. Choose an API Management.

  3. Press Create API client and then on Action menu click Generate API tokens.

  4. Make sure to copy both the Access Token and the Refresh Token because it won’t be shown to you again.

Alternatively, you can generate both the Access and the Refresh tokens by using Access Tokens -> Generate token endpoint.

Billing

To order services using the API, you must have enough money in a credit balance on your Bacloud account. If your credit balance is too low, the service won't launch automatically. In that case, you have to add money to your balance and pay the invoice manually in the Bacloud client area.

You can check your credit balance using an API endpoint /v1/billing/credit.

Requests

Communicate with the API by making an HTTP request at the correct endpoint. The chosen method determines the action taken.

Pagination

Some endpoints support pagination. If they support pagination, it can be controlled with the page and per_page query parameters.

page - The page number to retrieve. Defaults to the first page which is 1.

per_page - The number of items to retrieve per page. Defaults to 25. Maximum value is 100 unless stated otherwise.

Details of pagination can be found in the response body meta object, pagination key.

Pagination response contains the following keys:

  • page - current page (number);
  • perPage - number of items per page (number);
  • firstPage - first page (number), usually 1.;
  • prevPage - previous page (number). Can be null if you are on the first page;
  • nextPage - next page (number). Can be null if you are on the last page;
  • lastPage - last page (number).;
  • totalItems - total number of items (number);

Rate Limiting

Bacloud safeguards the API against bursts of incoming traffic based on the requests IP address to ensure stability for all users. If your application sends more than 30 requests per second, the API may return HTTP status code 429.

How to Authenticate with OAuth

In order to make an authenticated request, include a bearer-type

Authorization header containing your Access token. All requests must be made over HTTPS.

Authenticate with a Bearer Authorization Header

curl -X $HTTP_METHOD -H "Authorization: Bearer $BACLOUD_ACCESS_TOKEN"
"https://api.bacloud.com/v1/"

Responses

Along with the HTTP methods that the API responds to, it will also return standard HTTP statuses, including error codes.

In the event of a problem, the status will contain the error code, while the body of the response will usually contain additional information about the problem that was encountered.

Responses in the 200 range indicates that the request was successful and no errors were encountered.

Responses in the 400 range indicates that there is an issue with the requests and it should be changed before trying it again. It will usually contain the message describing what went wrong.

Responses in the 500 range indicates the server-side problem. In that case the issue is on our end and the request was not completed.

Possible responses:

Response Description
200 OK The request was successful.
201 Created The request was successful and a new resource was created.
202 Accepted Your request was accepted and a resource was updated.
204 No Content Your request succeeded, there is no additional information returned.
400 Bad Request The request could not be completed due to a malformed request of wrongly used endpoint.
401 Unauthorized The request could not be completed due to an invalid authentication credentials. This response is possible at all endpoints except for /v1/token/generate and /v1/token/refresh.
403 Forbidden You are not allowed to access the requested resource. This response is possible at all endpoints.
404 Not Found The requested resource was not found.
409 Conflict The request could not be completed due to a conflict with the current state of the resource.
422 Validation Error The request could not be completed due to invalid data.
429 Too Many Requests The request could not be completed due to rate limiting. This response is possible at all endpoints.
500 Internal Server Error The request could not be completed due to server-side problems. This response is possible at all endpoints.

Access Tokens

Access tokens description

Generate Token

Generate token to access API resources.

Request Body schema: application/json
client_id
required
string

The API Client ID from Bacloud client area.

client_secret
required
string

The API Client Secret from Bacloud client area.

Responses

Request samples

Content type
application/json
{
  • "client_id": "9b7d6a04-4a09-4f6e-a4af-a663",
  • "client_secret": "1V9GwF4BJv7HJNLH0RtxvBvGRRKd8u"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "data": {
    }
}

Refresh Token

Generate token with refresh token.

Request Body schema: application/json
client_id
required
string

The API Client ID from Bacloud client area.

client_secret
required
string

The API Client Secret from Bacloud client area.

refresh_token
required
string

The API Client Refresh Token.

Responses

Request samples

Content type
application/json
{
  • "client_id": "9b7d6a04-4a09-4f6e-a4af-a663",
  • "client_secret": "1V9GwF4BJv7HJNLH0RtxvBvGRRKd8u",
  • "refresh_token": "def5020003044bb4be0589f687b51330b"
}

Response samples

Content type
application/json
{
  • "success": true,
  • "data": {
    }
}

Billing

Credit description

Get Credit

Get current credit amount on Bacloud account.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "data": [
    ]
}

Product Groups

Product groups description

Get product groups

Get product groups that are available on the API.

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "data": {
    }
}

Get products of the specified group

Get products of the specific group that are available on the API.

Authorizations:
bearerAuth
path Parameters
groupId
required
integer
Example: 16

Product group ID.

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "data": {
    }
}

Products

Products tag description

Get product details

Get details of the Bacloud product: configurable options, billing.

Authorizations:
bearerAuth
path Parameters
id
required
integer
Example: 1

Product ID

query Parameters
with_billing
string
Default: "false"
Example: with_billing=false

Should the product billing be included.

currency_code
string (Currency)
Enum: "EUR" "USD"
Example: currency_code=EUR

Currency code for the pricing.

Responses

Response samples

Content type
application/json
Example
{
  • "success": true,
  • "data": {
    }
}

VPS

VPS tag description

Get VPS

Get details of VPS service

Authorizations:
bearerAuth
path Parameters
id
required
integer
Example: 1

VPS service ID

Responses

Response samples

Content type
application/json
{
  • "success": false,
  • "data": {
    }
}

Control VPS

Perform various actions on VPS service.

Authorizations:
bearerAuth
path Parameters
serviceId
required
integer
Example: 1

VPS service ID

Request Body schema: application/json
action
required
string (VpsAction)
Enum: "boot" "reboot" "shutdown" "changeRootPassword" "changeHostname" "reinstallServer"

Action to perform on the service.

Notes

Some types of services might not support some actions. i.e. Windows VPS do not support the changeRootPassword action. In that case, the response will contain an error message.

If action changeRootPassword is performed, the new password can be retrieved using the GET method with the /v1/vps/{serviceId} endpoint.

hostname
string

New Hostname for your VPS service.

Restrictions

Only required and allowed if action is changeHostname

operating_system
string

New Operating System for your VPS service.

Restrictions

Only required and allowed if action is reinstallServer.

If your service has a cPanel web control panel, only Almalinux or Cloudlinux operating systems are allowed.

Responses

Request samples

Content type
application/json
Example
{
  • "action": "reboot"
}

Response samples

Content type
application/json
{
  • "success": true
}

Delete VPS

Request to delete VPS Service.

Authorizations:
bearerAuth
path Parameters
serviceId
required
integer
Example: 1

VPS service ID

Responses

Response samples

Content type
application/json
{
  • "success": false,
  • "message": "The requested service is not a VPS"
}

Cancel VPS

Request to cancel VPS Service.

Authorizations:
bearerAuth
path Parameters
serviceId
required
integer
Example: 1

VPS service ID

Request Body schema: application/json
cancel_type
required
string (CancelRequestType)
Enum: "Immediate" "End of Billing Period"
cancel_reason
string

Cancellation reason

Responses

Request samples

Content type
application/json
{
  • "cancel_type": "Immediate",
  • "cancel_reason": "Not needed"
}

Response samples

Content type
application/json
{
  • "success": true
}

Get VPS list

Get list of your VPS services

Authorizations:
bearerAuth
query Parameters
status
string (ServiceStatus)
Enum: "Active" "Cancelled" "Pending" "Suspended" "Terminated"
Example: status=Active

List only the services with selected status

location
string
Example: location=lt-sqq

List only the services at the selected location. Only services with the status Active will be shown. Location value must be in ISO 3166-1 alpha-2 format.

page
integer >= 1
Default: 1
Example: page=1

Which page should be returned. First page is 1.

per_page
integer [ 1 .. 100 ]
Default: 25
Example: per_page=25

The number of items returned per page.

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "data": [
    ]
}

Create VPS

Create VPS service.

Authorizations:
bearerAuth
Request Body schema: application/json

Request body

product_id
required
integer

Product ID

payment_period
required
string (PaymentPeriodType)
Enum: "free" "free account" "onetime" "monthly" "quarterly" "semiannually" "annually" "biennially" "triennially"
operating_system
required
string

Service operating system.

Restrictions

Only Almalinux and Cloudlix operating systems support the cPanel web control panel.

location
required
string

Location where the server will be launched. Must be in ISO 3166-1 alpha-2 format

extra_ipv4_addresses
integer

Amount of needed extra IPv4 addresses

hostname
string

Hostname of the service

note
string

Additional notes for the service

Array of objects (CreateServiceLicense)

An array of licenses to be included with the server

Responses

Request samples

Content type
application/json
Example
{
  • "product_id": 111,
  • "payment_period": "monthly",
  • "operating_system": "debian-11",
  • "location": "us-chi",
  • "extra_ipv4_addresses": 1,
  • "hostname": "example.com",
  • "note": "My Linux server",
  • "licenses": [
    ]
}

Response samples

Content type
application/json
{
  • "success": true,
  • "data": {
    }
}