API

Regions

Civo will be hosted in multiple datacentres (a.k.a. regions), with more coming online all the time. You can choose when creating an instance which region to have it hosted in (necessary if you want to share a private network between your instances) - or you can leave it for Civo to allocate you to a region if you don't care.

When managing other resources, you can use region's code (e.g. LON1) to specify the target region of your request.


Listing available regions

Listing the available regions is possible by making a GET request to the https://api.civo.com/v2/regions resource.

Request

This request doesn't take any parameters.

Response

The response from the server will be a JSON array of regions.

[
    {
        "code": "LON1",
        "name": "London 1",
        "type": "civostack",
        "default": false,
        "out_of_capacity": false,
        "country": "uk",
        "country_name": "United Kingdom",
        "features": {
            "iaas": true,
            "kubernetes": true
        }
    },
    {
        "code": "NYC1",
        "name": "New York 1",
        "type": "civostack",
        "default": true,
        "out_of_capacity": false,
        "country": "us",
        "country_name": "United States",
        "features": {
            "iaas": true,
            "kubernetes": true
        }
    }
]

Example of listing available regions

curl -H "Authorization: bearer 12345" https://api.civo.com/v2/regions
// At a shell prompt run:
// npm init -y
// npm i --save request

var request = require('request');

request.get(
  'https://api.civo.com/v2/regions',
  {},
  function (error, response, body) {
    if (!error && response.statusCode == 200) {
      console.log(body)
    }
  }
).auth(null, null, true, '12345');
require 'net/http'

http = Net::HTTP.new('api.civo.com', 443)
http.use_ssl = true

headers = {
  'Authorization' => 'bearer 12345',
  'Content-Type' => 'application/x-www-form-urlencoded'
}

resp, data = get('v2/regions', headers)