Bacloud API (1.0)

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:

ResponseDescription
200 OKThe request was successful.
201 CreatedThe request was successful and a new resource was created.
202 AcceptedYour request was accepted and a resource was updated.
204 No ContentYour request succeeded, there is no additional information returned.
400 Bad RequestThe request could not be completed due to a malformed request of wrongly used endpoint.
401 UnauthorizedThe 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 ForbiddenYou are not allowed to access the requested resource. This response is possible at all endpoints.
404 Not FoundThe requested resource was not found.
409 ConflictThe request could not be completed due to a conflict with the current state of the resource.
422 Validation ErrorThe request could not be completed due to invalid data.
429 Too Many RequestsThe request could not be completed due to rate limiting. This response is possible at all endpoints.
500 Internal Server ErrorThe request could not be completed due to server-side problems. This response is possible at all endpoints.