API & Terraform

Manage everything on VPS GB from your own scripts, a CI job or Terraform. Every price is shown to you before anything is bought.

Connecting

Base URL and sign-in

  • Base URL: https://www.vpsgb.co.uk/api/v1
  • Authentication: an app token, sent as Authorization: Bearer vgb_…
  • Tokens always expire. You choose from 1 hour to 90 days, and you can revoke one at any time.

Getting a token

Tokens are made from your account, on the API access page. Make an account, then create a token with only the access it needs.

Tools

Every endpoint, in Swagger UI. Paste a token into Authorize to try calls from the page.

Create a token with only the access it needs, see when each was last used, and revoke them.

OpenAPI description

The machine-readable OpenAPI 3.1 description, for code generators and tools. Like every other call it needs a token:

curl -H "Authorization: Bearer $VPSGB_TOKEN" https://www.vpsgb.co.uk/api/v1/openapi.json

Terraform provider

Beta

The provider manages servers, firewalls, SSH keys, snapshots, load balancers, object storage, certificates, game servers and managed services, and can read your web hosting. Every paid resource shows its price in terraform plan.

The provider is in beta and is not on the public Terraform Registry yet, so terraform init cannot download it. Ask support for access.
terraform {
  required_providers {
    vpsgb = { source = "vpsgb/vpsgb" }
  }
}

# The token is read from the VPSGB_TOKEN environment variable.
provider "vpsgb" {}

# The cheapest plan that can be ordered today.
data "vpsgb_server_plan" "small" {
  orderable_only = true
  cheapest       = true
}

# `terraform plan` shows this server's price before anything is ordered.
resource "vpsgb_server" "app" {
  name           = "app-1"
  plan           = data.vpsgb_server_plan.small.code
  image          = "debian-12"
  ssh_public_key = file("~/.ssh/id_ed25519.pub")
}

How billing works through the API

  • You see the price first. A quote, or terraform plan, shows what is due now and what recurs, before anything is ordered.
  • An order goes through only at that price. The order carries the price you accepted. If the price has changed since, the order is refused, not placed at the new price.
  • A retry never orders twice. Paid orders carry an Idempotency-Key, so sending the same request again returns the order already placed instead of placing another.
  • Nothing is cancelled by accident. Deleting never cancels a paid service. Cancelling is a separate action, offered only where a service can be cancelled online, and terraform destroy stops at the plan for anything that cannot.
  • Prices are in pounds sterling. VPS GB is not VAT-registered, so no VAT is added.