curl --request POST \
--url https://console.cloudblast.io/api/v2/workers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"location_id": 1,
"name": "api-worker",
"git_repository": "https://github.com/example/app",
"git_source": "public",
"git_branch": "main",
"build_pack": "nixpacks",
"ports_exposes": "3000",
"base_directory": "<string>",
"publish_directory": "<string>",
"install_command": "<string>",
"build_command": "<string>",
"start_command": "<string>",
"is_spa": false
}
'import requests
url = "https://console.cloudblast.io/api/v2/workers"
payload = {
"location_id": 1,
"name": "api-worker",
"git_repository": "https://github.com/example/app",
"git_source": "public",
"git_branch": "main",
"build_pack": "nixpacks",
"ports_exposes": "3000",
"base_directory": "<string>",
"publish_directory": "<string>",
"install_command": "<string>",
"build_command": "<string>",
"start_command": "<string>",
"is_spa": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
location_id: 1,
name: 'api-worker',
git_repository: 'https://github.com/example/app',
git_source: 'public',
git_branch: 'main',
build_pack: 'nixpacks',
ports_exposes: '3000',
base_directory: '<string>',
publish_directory: '<string>',
install_command: '<string>',
build_command: '<string>',
start_command: '<string>',
is_spa: false
})
};
fetch('https://console.cloudblast.io/api/v2/workers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://console.cloudblast.io/api/v2/workers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'location_id' => 1,
'name' => 'api-worker',
'git_repository' => 'https://github.com/example/app',
'git_source' => 'public',
'git_branch' => 'main',
'build_pack' => 'nixpacks',
'ports_exposes' => '3000',
'base_directory' => '<string>',
'publish_directory' => '<string>',
'install_command' => '<string>',
'build_command' => '<string>',
'start_command' => '<string>',
'is_spa' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://console.cloudblast.io/api/v2/workers"
payload := strings.NewReader("{\n \"location_id\": 1,\n \"name\": \"api-worker\",\n \"git_repository\": \"https://github.com/example/app\",\n \"git_source\": \"public\",\n \"git_branch\": \"main\",\n \"build_pack\": \"nixpacks\",\n \"ports_exposes\": \"3000\",\n \"base_directory\": \"<string>\",\n \"publish_directory\": \"<string>\",\n \"install_command\": \"<string>\",\n \"build_command\": \"<string>\",\n \"start_command\": \"<string>\",\n \"is_spa\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://console.cloudblast.io/api/v2/workers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"location_id\": 1,\n \"name\": \"api-worker\",\n \"git_repository\": \"https://github.com/example/app\",\n \"git_source\": \"public\",\n \"git_branch\": \"main\",\n \"build_pack\": \"nixpacks\",\n \"ports_exposes\": \"3000\",\n \"base_directory\": \"<string>\",\n \"publish_directory\": \"<string>\",\n \"install_command\": \"<string>\",\n \"build_command\": \"<string>\",\n \"start_command\": \"<string>\",\n \"is_spa\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.cloudblast.io/api/v2/workers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"location_id\": 1,\n \"name\": \"api-worker\",\n \"git_repository\": \"https://github.com/example/app\",\n \"git_source\": \"public\",\n \"git_branch\": \"main\",\n \"build_pack\": \"nixpacks\",\n \"ports_exposes\": \"3000\",\n \"base_directory\": \"<string>\",\n \"publish_directory\": \"<string>\",\n \"install_command\": \"<string>\",\n \"build_command\": \"<string>\",\n \"start_command\": \"<string>\",\n \"is_spa\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"uuid": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"name": "api-worker",
"status": "active",
"runtime_status": "running",
"runtime_status_at": "2023-11-07T05:31:56Z",
"provisioned": true,
"last_deployment_status": "finished",
"last_deployment_at": "2023-11-07T05:31:56Z",
"last_error": "<string>",
"fqdn": "api-worker.workers.cloudblast.io",
"location_id": 1,
"git_source": "public",
"git_repository": "https://github.com/example/app",
"git_branch": "main",
"build_pack": "nixpacks",
"ports_exposes": "3000",
"base_directory": "<string>",
"publish_directory": "<string>",
"install_command": "<string>",
"build_command": "<string>",
"start_command": "<string>",
"is_spa": false,
"limits": {
"cpu": 1,
"memory_mb": 1024,
"disk_mb": 5120
},
"usage": {
"cpu_percent": 3.5,
"memory_mb": 184,
"disk_mb": 612
},
"billing_type": "hourly",
"suspended_at": "2023-11-07T05:31:56Z",
"suspension_reason": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"location": {
"id": 1,
"name": "Frankfurt",
"short_code": "fra",
"description": "Germany",
"out_of_stock": false
}
}
}{
"error": {
"code": "WORKER_LIMIT_REACHED",
"message": "Your account level allows 2 workers. Delete a worker or raise your account level to deploy more."
}
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Missing or invalid Authorization header. Use: Authorization: Bearer <token>"
}
}{
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Insufficient balance to deploy a Worker. At least 0.08 EUR is required to cover its first hour of usage. Please top up first."
}
}{
"error": {
"code": "WORKERS_DISABLED",
"message": "Worker service sales are currently disabled."
}
}{
"error": {
"code": "LOCATION_UNAVAILABLE",
"message": "That location is not available for workers."
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "The given data was invalid.",
"details": {
"name": [
"The name field is required."
]
}
}
}Deploy a Worker
Deploys a new worker. A node in the given location is picked automatically.
Workers are billed by measured usage, and the first hour is charged against your balance, so the deploy is rejected outright when the balance is below the minimum. Call GET /workers/deploy-requirements first to see that minimum and how many workers your account level still allows.
What git_repository holds depends on git_source:
public: a publicly reachable git URL.github: a URL on a private repository of the GitHub account linked to your panel account. The OAuth flow only exists in the panel, so an account that has never linked GitHub is answered withGITHUB_NOT_CONNECTED.template/database: theidof an entry fromGET /workers/templates, not a URL.
The worker comes back in pending and is built in the background. Poll GET /workers/{worker}/status until it reports active.
curl --request POST \
--url https://console.cloudblast.io/api/v2/workers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"location_id": 1,
"name": "api-worker",
"git_repository": "https://github.com/example/app",
"git_source": "public",
"git_branch": "main",
"build_pack": "nixpacks",
"ports_exposes": "3000",
"base_directory": "<string>",
"publish_directory": "<string>",
"install_command": "<string>",
"build_command": "<string>",
"start_command": "<string>",
"is_spa": false
}
'import requests
url = "https://console.cloudblast.io/api/v2/workers"
payload = {
"location_id": 1,
"name": "api-worker",
"git_repository": "https://github.com/example/app",
"git_source": "public",
"git_branch": "main",
"build_pack": "nixpacks",
"ports_exposes": "3000",
"base_directory": "<string>",
"publish_directory": "<string>",
"install_command": "<string>",
"build_command": "<string>",
"start_command": "<string>",
"is_spa": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
location_id: 1,
name: 'api-worker',
git_repository: 'https://github.com/example/app',
git_source: 'public',
git_branch: 'main',
build_pack: 'nixpacks',
ports_exposes: '3000',
base_directory: '<string>',
publish_directory: '<string>',
install_command: '<string>',
build_command: '<string>',
start_command: '<string>',
is_spa: false
})
};
fetch('https://console.cloudblast.io/api/v2/workers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://console.cloudblast.io/api/v2/workers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'location_id' => 1,
'name' => 'api-worker',
'git_repository' => 'https://github.com/example/app',
'git_source' => 'public',
'git_branch' => 'main',
'build_pack' => 'nixpacks',
'ports_exposes' => '3000',
'base_directory' => '<string>',
'publish_directory' => '<string>',
'install_command' => '<string>',
'build_command' => '<string>',
'start_command' => '<string>',
'is_spa' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://console.cloudblast.io/api/v2/workers"
payload := strings.NewReader("{\n \"location_id\": 1,\n \"name\": \"api-worker\",\n \"git_repository\": \"https://github.com/example/app\",\n \"git_source\": \"public\",\n \"git_branch\": \"main\",\n \"build_pack\": \"nixpacks\",\n \"ports_exposes\": \"3000\",\n \"base_directory\": \"<string>\",\n \"publish_directory\": \"<string>\",\n \"install_command\": \"<string>\",\n \"build_command\": \"<string>\",\n \"start_command\": \"<string>\",\n \"is_spa\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://console.cloudblast.io/api/v2/workers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"location_id\": 1,\n \"name\": \"api-worker\",\n \"git_repository\": \"https://github.com/example/app\",\n \"git_source\": \"public\",\n \"git_branch\": \"main\",\n \"build_pack\": \"nixpacks\",\n \"ports_exposes\": \"3000\",\n \"base_directory\": \"<string>\",\n \"publish_directory\": \"<string>\",\n \"install_command\": \"<string>\",\n \"build_command\": \"<string>\",\n \"start_command\": \"<string>\",\n \"is_spa\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://console.cloudblast.io/api/v2/workers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"location_id\": 1,\n \"name\": \"api-worker\",\n \"git_repository\": \"https://github.com/example/app\",\n \"git_source\": \"public\",\n \"git_branch\": \"main\",\n \"build_pack\": \"nixpacks\",\n \"ports_exposes\": \"3000\",\n \"base_directory\": \"<string>\",\n \"publish_directory\": \"<string>\",\n \"install_command\": \"<string>\",\n \"build_command\": \"<string>\",\n \"start_command\": \"<string>\",\n \"is_spa\": false\n}"
response = http.request(request)
puts response.read_body{
"data": {
"uuid": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"name": "api-worker",
"status": "active",
"runtime_status": "running",
"runtime_status_at": "2023-11-07T05:31:56Z",
"provisioned": true,
"last_deployment_status": "finished",
"last_deployment_at": "2023-11-07T05:31:56Z",
"last_error": "<string>",
"fqdn": "api-worker.workers.cloudblast.io",
"location_id": 1,
"git_source": "public",
"git_repository": "https://github.com/example/app",
"git_branch": "main",
"build_pack": "nixpacks",
"ports_exposes": "3000",
"base_directory": "<string>",
"publish_directory": "<string>",
"install_command": "<string>",
"build_command": "<string>",
"start_command": "<string>",
"is_spa": false,
"limits": {
"cpu": 1,
"memory_mb": 1024,
"disk_mb": 5120
},
"usage": {
"cpu_percent": 3.5,
"memory_mb": 184,
"disk_mb": 612
},
"billing_type": "hourly",
"suspended_at": "2023-11-07T05:31:56Z",
"suspension_reason": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"location": {
"id": 1,
"name": "Frankfurt",
"short_code": "fra",
"description": "Germany",
"out_of_stock": false
}
}
}{
"error": {
"code": "WORKER_LIMIT_REACHED",
"message": "Your account level allows 2 workers. Delete a worker or raise your account level to deploy more."
}
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Missing or invalid Authorization header. Use: Authorization: Bearer <token>"
}
}{
"error": {
"code": "INSUFFICIENT_BALANCE",
"message": "Insufficient balance to deploy a Worker. At least 0.08 EUR is required to cover its first hour of usage. Please top up first."
}
}{
"error": {
"code": "WORKERS_DISABLED",
"message": "Worker service sales are currently disabled."
}
}{
"error": {
"code": "LOCATION_UNAVAILABLE",
"message": "That location is not available for workers."
}
}{
"error": {
"code": "VALIDATION_ERROR",
"message": "The given data was invalid.",
"details": {
"name": [
"The name field is required."
]
}
}
}Authorizations
API token from your CloudBlast account settings. Pass as Authorization: Bearer <token>.
Body
From GET /workers/locations.
1
191"api-worker"
Repository URL, or a template id when git_source is template or database.
500"https://github.com/example/app"
github requires a GitHub account linked in the panel.
public, github, template, database 191nixpacks, static, dockerfile Port your application listens on.
64255Directory to serve for a static build.
255100010001000Route unknown paths of a static build to the index.
Response
Worker accepted and queued for provisioning
Show child attributes
Show child attributes