Logo
OpenScaler
API DocumentationElastic Servers

Create elastic server

POST
/v1/elastic-servers

Create an auto-scaling elastic server pool. An Elastic Server is a cluster of VMs that scale horizontally based on load. You only pay for the VMs you actually use, not the maximum number of nodes in the pool.

The request waits until the pool is ready, then returns the pool as JSON.

Progress is a separate Server-Sent Events stream. Subscribe with the same sequence_id from this request body at GET /v1/events/create-elastic-server/{sequence_id}.

Authorization

bearer_auth
AuthorizationBearer <token>

OAuth Authentication

OpenScaler API uses OAuth, a standard for secure authorization. To access the API, obtain a token via the OpenScaler Platform.

Use the access_token in the Authorization header for requests:

Authorization: Bearer <token>

Always keep your token secure and do not share it with anyone.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

text/pain

application/json

application/json

curl -X POST "https://example.com/v1/elastic-servers" \  -H "Content-Type: application/json" \  -d '{    "name": "my-servers",    "description": "My elastic servers",    "region": "alg1",    "size": "s-1vcpu-1gb",    "project_id": "default",    "sequence_id": 123,    "distro": "debian-12",    "cloud_init_user_data": "#!/bin/bash\\napt update && apt install -y python3-flask\\n",    "scale_config": {      "autoscale": true,      "min_nodes": 1,      "max_nodes": 5,      "autoscaling_metrics": [        {          "type": "cpu",          "min_threshold": 30,          "max_threshold": 60        }      ],      "cooldown": 90,      "metrics_interval": 60    }  }'
{  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",  "name": "my-servers",  "description": "My elastic servers",  "user_id": "2abb7c25-a2d5-42ac-a776-e8ac5dfb16c3",  "project_id": "default",  "distro": "debian-12",  "region": "alg1",  "vcpus": 1,  "storageGB": 25,  "memoryMB": 1024,  "transferGB": 1000,  "size": "s-1vcpu-1gb",  "vpc_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",  "vpc_subnet": "10.0.20.0/24",  "scale_config": {    "autoscale": true,    "min_nodes": 1,    "max_nodes": 5,    "autoscaling_metrics": [      {        "type": "cpu",        "min_threshold": 30,        "max_threshold": 60      }    ],    "cooldown": 90,    "metrics_interval": 60  },  "paused": false,  "autoscale": true,  "created_at": "2024-06-01T12:00:00Z",  "updated_at": "2024-06-15T08:30:00Z"}
{  "errors": [    {      "message": "'vcpus' field must be an integer",      "field": "resource_id"    }  ]}
"Access denied"
{  "errors": [    {      "message": "User not initialized (missing required fields in token), please init user by sending POST request to `/v1/init` then refresh your token\n"    }  ]}
{  "errors": [    {      "message": "VM with ID 23 not found"    }  ]}