# Create a server pool

Create a server pool. The warm servers boot from a snapshot of the team, or from a base image with a `server_type`. Send `snapshot_id` or `image`, not both. Warm servers boot a few at a time, so a large `min_size` fills over minutes. Each warm server is billed as a server of its type from its boot.

[endpoint]
method = "POST"
base_url = "https://{availability_zone}.betterstackcloud.com"
path = "/v1/servers/pools"

[[body_param]]
name = "team_id"
required = true
type = "string"
description = "The ID of the team that owns the pool. `betterstack team list` shows it."

[[body_param]]
name = "name"
required = true
type = "string"
description = "The pool's name, unique in the team. Up to 63 lowercase letters, digits and hyphens, starting and ending with a letter or digit."

[[body_param]]
name = "image"
type = "string"
description = "The slug of the base image to boot from. List the images with `betterstack image list`. Send a `server_type` with `image`. Can't be changed after the pool is created."

[[body_param]]
name = "snapshot_id"
type = "string"
description = "The ID of an available snapshot of the team to boot from. The warm servers get the snapshot's server type. Can't be changed after the pool is created."

[[body_param]]
name = "server_type"
type = "string"
description = "The server type of the warm servers. List the server types with `betterstack server-type list`. Required with `image`. With `snapshot_id`, leave `server_type` out or send the snapshot's type. Can't be changed after the pool is created."

[[body_param]]
name = "min_size"
default = "0"
type = "integer"
description = "The fewest warm servers the pool aims for."

[[body_param]]
name = "max_size"
default = "0"
type = "integer"
description = "The most warm servers the pool aims for, counted toward the `server_pool_size` quota."

[[body_param]]
name = "growth_multiplier"
default = "2.0"
type = "number"
description = "The factor `target_size` is multiplied by when a claim finds the pool empty, from 1 to 10. `1` turns growing off."

[[body_param]]
name = "shrink_multiplier"
default = "0.8"
type = "number"
description = "The factor `target_size` is multiplied by when the pool has had no claim for `idle_minutes`. More than 0 and at most 1. `1` turns shrinking off."

[[body_param]]
name = "idle_minutes"
default = "5"
type = "integer"
description = "Minutes without a claim before the pool shrinks, from 1 to 1440."

[[body_param]]
name = "enabled"
default = "true"
type = "boolean"
description = "Whether the pool keeps warm servers. Send `false` to create the pool without warm servers."

[[body_param]]
name = "public_ipv4"
default = "true"
type = "boolean"
description = "Whether the warm servers get a public IPv4 address. A warm server without one has only IPv6. Can't be changed after the pool is created."

[[body_param]]
name = "defaults"
type = "object"
description = "What every warm server gets when it boots, such as `ssh_keys`, firewalls, private networks and tags. Any other key is refused."

[[body_param]]
name = "defaults.ssh_keys"
type = "array of strings"
description = "The slugs of the SSH keys to add."

[[body_param]]
name = "defaults.firewall_ids"
type = "array of strings"
description = "The IDs of the firewalls to attach."

[[body_param]]
name = "defaults.network_ids"
type = "array of strings"
description = "The IDs of the private networks to join."

[[body_param]]
name = "defaults.metadata"
type = "object"
description = "Tags as string pairs. Accepts any keys."

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"

[[header]]
name = "Content-Type"
description = "application/json"
required = false
type = "string"
[/endpoint]

[responses]
[[response]]
status = 201
description = "Returns the newly created server pool."
body = '''
{
  "id": "example",
  "name": "Example server pool",
  "server_type": "AM1",
  "snapshot_id": "123456789",
  "image": "ubuntu-26-04",
  "min_size": 0,
  "max_size": 0,
  "growth_multiplier": 2.0,
  "shrink_multiplier": 0.8,
  "idle_minutes": 5,
  "enabled": true,
  "public_ipv4": true,
  "defaults": {
    "ssh_keys": [
      "example"
    ],
    "firewall_ids": [
      "123456789"
    ],
    "network_ids": [
      "123456789"
    ],
    "metadata": {
      "example": "value"
    }
  },
  "target_size": 1,
  "available": 1,
  "warming": 1,
  "claims_total": 1,
  "created_at": "2026-07-01T12:00:00.000Z",
  "updated_at": "2026-07-01T12:00:00.000Z",
  "team_id": "t123"
}
'''

[[response]]
status = 400
description = "The body isn't valid JSON."
body = '''
{
  "error": {
    "message": "Malformed JSON body.",
    "code": "bad_request"
  }
}
'''

[[response]]
status = 401
description = "The API token is missing or invalid."
body = '''
{
  "error": {
    "message": "Missing or invalid token.",
    "code": "unauthorized"
  }
}
'''

[[response]]
status = 402
description = "The organization hasn't made its first payment yet. The error code is `payment_required`."

[[response]]
status = 403
description = "The `max_size` of all the organization's pools together would go over the `server_pool_size` quota. The error code is `quota_exceeded`."

[[response]]
status = 404
description = "We couldn't find the team, snapshot, image or server type. The error code is `not_found`."

[[response]]
status = 409
description = "The resource's state doesn't allow the request, such as starting a running server or removing a placement group that still has servers."

[[response]]
status = 422
description = "The request has both or neither of `snapshot_id` and `image`, or the `server_type` isn't the snapshot's type. Or the `name` isn't valid or is taken in the team, a size or multiplier is out of range, or `defaults` has an unknown key. The error code is `validation_failed`. A deprecated `server_type` returns `type_deprecated`, and `details.replacement` names the type to send instead."

[[response]]
status = 423
description = "We've locked the resource, with the code `locked`. Every change to a locked resource is refused, and so is a change that involves one."

[[response]]
status = 429
description = "Too many requests, with the code `rate_limited`. We limit requests per client IP and per organization, and some costly endpoints have a stricter limit. Wait as long as the `Retry-After` header says."

[[response]]
status = 500
description = "An unexpected, temporary error on our side, with the code `internal_error`. Try again."
body = '''
{
  "error": {
    "message": "The request could not be completed right now. Please try again in a few moments.",
    "code": "internal_error"
  }
}
'''

[[response]]
status = 503
description = "The zone has no capacity, with the code `no_capacity`. Or we couldn't set up or change the resource, with the code `orchestration_failed`. Or the organization is creating too many resources at the same time, with the code `concurrent_create_limit`. Try again after a short wait."
[/responses]

[params]
title = "Response attributes"

[[param]]
name = "id"
type = "string"
description = "The pool's ID, a UUID."

[[param]]
name = "name"
type = "string"
description = "The pool's name, unique in the team. Up to 63 lowercase letters, digits and hyphens, starting and ending with a letter or digit. Warm servers are named after the pool, with 6 hex characters added, until a claim renames them."

[[param]]
name = "server_type"
type = "string"
description = "The server type of the warm servers. For a pool that boots from a snapshot, it's the snapshot's type."

[[param]]
name = "snapshot_id"
type = "string or null"
description = "The ID of the snapshot the warm servers boot from, or `null` for a pool that boots from an image."

[[param]]
name = "image"
type = "string or null"
description = "The slug of the base image the warm servers boot from, or `null` for a pool that boots from a snapshot."

[[param]]
name = "min_size"
type = "integer"
description = "The fewest warm servers the pool aims for, from 0 up to `max_size`."

[[param]]
name = "max_size"
type = "integer"
description = "The most warm servers the pool aims for. Together, the `max_size` of all the organization's pools can't be more than its `server_pool_size` quota."

[[param]]
name = "growth_multiplier"
type = "number"
description = "The factor `target_size` is multiplied by when a claim finds the pool empty, from 1 to 10. `1` turns growing off."

[[param]]
name = "shrink_multiplier"
type = "number"
description = "The factor `target_size` is multiplied by each minute while the pool is full and has had no claim for `idle_minutes`. More than 0 and at most 1. `1` turns shrinking off."

[[param]]
name = "idle_minutes"
type = "integer"
description = "Minutes without a claim before the pool shrinks, from 1 to 1440."

[[param]]
name = "enabled"
type = "boolean"
description = "Whether the pool keeps warm servers. A disabled pool removes all its warm servers and keeps its settings. A claim on a disabled pool is refused."

[[param]]
name = "public_ipv4"
type = "boolean"
description = "Whether the warm servers get a public IPv4 address. A warm server without one has only IPv6."

[[param]]
name = "defaults"
type = "object"
description = "What every warm server gets when it boots, such as `ssh_keys`, firewalls, private networks and tags. When a claim adds nothing to these, the server is ready as soon as the claim returns."

[[param]]
name = "defaults.ssh_keys"
type = "array of strings"
description = "The slugs of the SSH keys to add."

[[param]]
name = "defaults.firewall_ids"
type = "array of strings"
description = "The IDs of the firewalls to attach."

[[param]]
name = "defaults.network_ids"
type = "array of strings"
description = "The IDs of the private networks to join."

[[param]]
name = "defaults.metadata"
type = "object"
description = "Tags as string pairs."

[[param]]
name = "target_size"
type = "integer"
description = "The number of warm servers the pool aims for, from `min_size` to `max_size`. The target changes as claims come in, and is 0 while the pool is disabled."

[[param]]
name = "available"
type = "integer"
description = "How many warm servers a claim can get now."

[[param]]
name = "warming"
type = "integer"
description = "How many warm servers are still booting."

[[param]]
name = "claims_total"
type = "integer"
description = "How many claims the pool has served."

[[param]]
name = "created_at"
type = "datetime"
description = "When the pool was created. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "updated_at"
type = "datetime"
description = "When the pool was last updated. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "team_id"
type = "string"
description = "The ID of the team that owns the pool and its servers."
[/params]
