Manage Cloud with the API

Manage your servers, networks, volumes and databases over HTTPS, with JSON requests and responses.

Base URL

Every data center serves the same API at https://<data center>.betterstackcloud.com/v1/, for example https://us-west-2a.betterstackcloud.com/v1/servers.

Get an API token

Every request authenticates with a bearer token. Create a global API token in Settings → API tokens → Global tokens. It sees every team in your organization. A Read only token can make GET requests only.

Make your first request

  1. Set your API token as BETTERSTACK_API_TOKEN.
  2. List your servers:
List your servers
curl https://us-west-2a.betterstackcloud.com/v1/servers \
  -H "Authorization: Bearer $BETTERSTACK_API_TOKEN"

Read the response

Example response, shortened
{
  "data": [
    {
      "id": "8f14e45f-ceea-467a-9275-7c4f3d9b1a2e",
      "team_id": "t123",
      "name": "web-01",
      "status": "running"
    }
  ],
  "meta": { "page": 1, "per_page": 25, "total": 60 }
}
  • Pagination: lists return 25 items per page by default. Use page and per_page, up to 1,000.
  • Teams: every create takes the team_id of the team that owns the resource, for example "team_id": "t123". List your teams with betterstack team list in the Cloud CLI. A team token can only create in its own team.
  • Errors come with an HTTP status and a machine-readable code, for example a 401 for a missing or wrong token:
Example error
{"error":{"code":"unauthorized","message":"Missing or invalid token."}}

Endpoint reference

Every endpoint, with its parameters and an example request and response, is under Cloud API in the sidebar, starting with Servers.

Need help?

Please let us know at hello@betterstack.com.
We're happy to help! 🙏