Using the API

⏱ 6 min read 🟡 Intermediate Last updated: October 2026

Everything you can do in the console, you can also do from code. The API lets scripts, CI pipelines and your own tools launch servers, change firewall rules, take snapshots and more.

What the API is for

Create an API key

  1. In the console, open Developer › API Keys.
  2. Click + New Key and give it a name that says what uses it, such as ci-deploy.
  3. Copy the key. It starts with bm_ and is shown only once.
ℹ️  You need to be an organisation admin or owner to create keys. A key belongs to the organisation, not to you, and works across its projects.

Your first request

All requests go to https://console.baremeta.cloud/api/v1. Send your key in the X-API-Key header. Store it in an environment variable rather than typing it into commands:

export BAREMETA_API_KEY="bm_..."

curl https://console.baremeta.cloud/api/v1/orgs \
  -H "X-API-Key: $BAREMETA_API_KEY"

This lists your organisation. Use its id to list projects, and a project's id to list its servers:

curl https://console.baremeta.cloud/api/v1/orgs/<org_id>/projects \
  -H "X-API-Key: $BAREMETA_API_KEY"

curl https://console.baremeta.cloud/api/v1/projects/<project_id>/vms \
  -H "X-API-Key: $BAREMETA_API_KEY"
💡  You can also find your organisation and project IDs in the console's API Reference, where every example is pre-filled for the project you have selected.

Launch a server

curl -X POST https://console.baremeta.cloud/api/v1/projects/<project_id>/vms \
  -H "X-API-Key: $BAREMETA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: web-01-launch-1" \
  -d '{"name":"web-01","image":"ubuntu-24.04","vcpus":2,"memory_mb":4096,"disk_gb":50,"assign_public_ip":true}'

The server starts building straight away. Check on it by listing the project's servers until its status is running. Servers launched from the API are billed exactly like servers launched in the console.

Retrying safely

Networks fail. If a request to create something times out, you can't tell whether it worked. Add an Idempotency-Key header with a value you choose to every POST, PUT or PATCH:

Errors

Errors come back as JSON with a short code, a readable message and a request ID:

{"error": {"code": "...", "message": "Invalid API key", "status": 401, "request_id": "5e5405d48d80"}}

If you contact support about a failed request, include the request_id.

What keys can't do

API keys are for running your infrastructure, not for managing people or access. These actions need you to be signed in to the console:

This means a leaked key can't lock you out of your account or create more keys.

Keeping keys safe

⚠️  Treat an API key like a password. Anyone who has it can create, change and delete servers in your organisation, and those servers are billed to you.

Full reference

The console's Developer › API Reference lists every endpoint you can use, grouped by area, with a ready-to-run example for each one. The examples use a signed-in session token; replace the Authorization header with X-API-Key to use a key instead.