Create a server

Create a server. If we can't launch it after accepting the request, its status becomes destroyed and we don't bill it.

POST https://{availability_zone}.betterstackcloud.com/v1/servers
Authorization string required

Bearer $TOKEN

Content-Type string

application/json

team_id string required

The ID of the team that owns the server. betterstack team list shows it.

name string required

The server's name, unique among the organization's servers that aren't destroyed or terminated.

server_type string required

The name of the server type, such as AM4. List the types with betterstack server-type list.

image string required

The slug of an available image, such as ubuntu-26-04. List the images with betterstack image list. Can't be changed after the server is created.

network_ids array of strings

The IDs of private networks to attach. Each network must belong to the server's team. To change them later, attach or detach a network.

firewall_ids array of strings

The ID of a firewall to attach, at most one. The firewall must belong to the server's team. To change the firewall later, attach or detach a firewall.

placement_group_id string or null

The ID of a placement group to add the server to. The placement group must belong to the server's team. Can't be changed after the server is created.

ssh_keys array of strings

The slugs of SSH keys to install. List the keys with betterstack ssh-key list, and add a .pub file first with betterstack ssh-key create. Each key must belong to the server's team. Send at least one key, unless root_password is true. When you pass the keys in a file, the file must hold a JSON array of slugs, not a public key.

metadata object

Your own tags, as string keys and values, at most 10. Accepts any keys.

ddos_protection boolean default: false

Whether to turn on DDoS protection. Can't be changed after the server is created.

ai_engineer_access boolean default: true

Whether the Better Stack AI Engineer can SSH into the server. Can't be changed after the server is created.

vulnerability_monitoring boolean default: false

Whether to scan the server daily for open ports and vulnerable versions.

observability boolean default: false

Whether to install the Better Stack collector. The team must have a telemetry token set up. Can't be changed after the server is created.

reserved_ip_ids array of strings

The IDs of reserved IPs to attach at boot, instead of new addresses. Each reserved address must belong to the server's team and not be assigned.

public_ipv4 boolean default: true

Whether to give the server a new public IPv4 address. A reserved IPv4 address in reserved_ip_ids replaces it. Send false for a server with only IPv6. Such a server can't have a reserved IPv4 address or Cloudflare A records.

cloudflare_records array of objects

Cloudflare DNS records to point to the new server. Each entry adds an A and an AAAA record.

cloudflare_records[].cloudflare_account_id string required

The ID of the Cloudflare account that holds the zone. Connect the account to your team first, under Integrations → Cloudflare in the web app.

cloudflare_records[].cloudflare_domain string required

The Cloudflare zone to add the records to.

cloudflare_records[].cloudflare_a_record string required

The name of the A and AAAA records.

cloudflare_records[].cloudflare_proxied boolean default: false

Whether Cloudflare proxies the records.

cloudflare_records[].cloudflare_a_record_ttl integer

The TTL in seconds, 1 for automatic or 60–86400. Defaults to 1. A proxied record must use 1.

root_password boolean default: false

Whether to return a one-time root password. The password is returned only in this response, and we don't store it.

subdomain boolean default: true

Whether to give the server a free generic subdomain, <server-name>.onbetterstack.com.

user_data string

A cloud-init document or a script that runs once, at the first boot, at most 32 KiB of UTF-8. A cloud-init document starts with #cloud-config. A script starts with #! and runs as root. No response returns it, but root can read it on the server, so don't put a long-lived credential in it.

term string default: monthly

The billing term. Defaults to monthly. Possible values: monthly, annual.

202 Accepted
{
  "root_password": "example"
}

Returns the newly created server.

root_password string

The one-time root password, returned only when you send root_password as true.