Create pool
curl --request POST \
--url https://api.sfcompute.com/v2/pools \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspace": "wksp_k3R-nX9vLm7Qp2Yw5Jd8F",
"name": "my-resource-name",
"tags": {
"env": "prod",
"team": "infra"
}
}
'import requests
url = "https://api.sfcompute.com/v2/pools"
payload = {
"workspace": "wksp_k3R-nX9vLm7Qp2Yw5Jd8F",
"name": "my-resource-name",
"tags": {
"env": "prod",
"team": "infra"
}
}
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({
workspace: 'wksp_k3R-nX9vLm7Qp2Yw5Jd8F',
name: 'my-resource-name',
tags: {env: 'prod', team: 'infra'}
})
};
fetch('https://api.sfcompute.com/v2/pools', 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://api.sfcompute.com/v2/pools",
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([
'workspace' => 'wksp_k3R-nX9vLm7Qp2Yw5Jd8F',
'name' => 'my-resource-name',
'tags' => [
'env' => 'prod',
'team' => 'infra'
]
]),
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://api.sfcompute.com/v2/pools"
payload := strings.NewReader("{\n \"workspace\": \"wksp_k3R-nX9vLm7Qp2Yw5Jd8F\",\n \"name\": \"my-resource-name\",\n \"tags\": {\n \"env\": \"prod\",\n \"team\": \"infra\"\n }\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://api.sfcompute.com/v2/pools")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workspace\": \"wksp_k3R-nX9vLm7Qp2Yw5Jd8F\",\n \"name\": \"my-resource-name\",\n \"tags\": {\n \"env\": \"prod\",\n \"team\": \"infra\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sfcompute.com/v2/pools")
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 \"workspace\": \"wksp_k3R-nX9vLm7Qp2Yw5Jd8F\",\n \"name\": \"my-resource-name\",\n \"tags\": {\n \"env\": \"prod\",\n \"team\": \"infra\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "pool_k3R-nX9vLm7Qp2Yw5Jd8F",
"resource_path": "sfc:pool:<account_id>:<workspace>:<name>",
"workspace": {
"object": "workspace_summary",
"id": "wksp_k3R-nX9vLm7Qp2Yw5Jd8F",
"name": "my-resource-name"
},
"name": "my-resource-name",
"object": "pool",
"allocation_schedule": {
"total": [
{
"start_at": 1738972800,
"node_count": 123,
"end_at": 1738972800
}
],
"by_sku": {}
},
"created_at": 1738972800,
"_preview_procurements": [
{
"id": "proc_k3R-nX9vLm7Qp2Yw5Jd8F",
"name": "my-resource-name"
}
],
"_preview_deployments": [
{
"id": "depl_k3R-nX9vLm7Qp2Yw5Jd8F",
"name": "my-resource-name"
}
],
"tags": {
"env": "prod",
"team": "infra"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"type": "authentication_error",
"message": "<string>"
}
}{
"error": {
"type": "forbidden",
"message": "<string>"
}
}{
"error": {
"type": "unprocessable_entity",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"type": "rate_limited",
"message": "<string>"
}
}{
"error": {
"type": "api_error",
"message": "<string>"
}
}Pools
Create pool
Create a pool to hold compute.
POST
/
v2
/
pools
Create pool
curl --request POST \
--url https://api.sfcompute.com/v2/pools \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspace": "wksp_k3R-nX9vLm7Qp2Yw5Jd8F",
"name": "my-resource-name",
"tags": {
"env": "prod",
"team": "infra"
}
}
'import requests
url = "https://api.sfcompute.com/v2/pools"
payload = {
"workspace": "wksp_k3R-nX9vLm7Qp2Yw5Jd8F",
"name": "my-resource-name",
"tags": {
"env": "prod",
"team": "infra"
}
}
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({
workspace: 'wksp_k3R-nX9vLm7Qp2Yw5Jd8F',
name: 'my-resource-name',
tags: {env: 'prod', team: 'infra'}
})
};
fetch('https://api.sfcompute.com/v2/pools', 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://api.sfcompute.com/v2/pools",
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([
'workspace' => 'wksp_k3R-nX9vLm7Qp2Yw5Jd8F',
'name' => 'my-resource-name',
'tags' => [
'env' => 'prod',
'team' => 'infra'
]
]),
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://api.sfcompute.com/v2/pools"
payload := strings.NewReader("{\n \"workspace\": \"wksp_k3R-nX9vLm7Qp2Yw5Jd8F\",\n \"name\": \"my-resource-name\",\n \"tags\": {\n \"env\": \"prod\",\n \"team\": \"infra\"\n }\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://api.sfcompute.com/v2/pools")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workspace\": \"wksp_k3R-nX9vLm7Qp2Yw5Jd8F\",\n \"name\": \"my-resource-name\",\n \"tags\": {\n \"env\": \"prod\",\n \"team\": \"infra\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sfcompute.com/v2/pools")
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 \"workspace\": \"wksp_k3R-nX9vLm7Qp2Yw5Jd8F\",\n \"name\": \"my-resource-name\",\n \"tags\": {\n \"env\": \"prod\",\n \"team\": \"infra\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "pool_k3R-nX9vLm7Qp2Yw5Jd8F",
"resource_path": "sfc:pool:<account_id>:<workspace>:<name>",
"workspace": {
"object": "workspace_summary",
"id": "wksp_k3R-nX9vLm7Qp2Yw5Jd8F",
"name": "my-resource-name"
},
"name": "my-resource-name",
"object": "pool",
"allocation_schedule": {
"total": [
{
"start_at": 1738972800,
"node_count": 123,
"end_at": 1738972800
}
],
"by_sku": {}
},
"created_at": 1738972800,
"_preview_procurements": [
{
"id": "proc_k3R-nX9vLm7Qp2Yw5Jd8F",
"name": "my-resource-name"
}
],
"_preview_deployments": [
{
"id": "depl_k3R-nX9vLm7Qp2Yw5Jd8F",
"name": "my-resource-name"
}
],
"tags": {
"env": "prod",
"team": "infra"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"type": "authentication_error",
"message": "<string>"
}
}{
"error": {
"type": "forbidden",
"message": "<string>"
}
}{
"error": {
"type": "unprocessable_entity",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"type": "rate_limited",
"message": "<string>"
}
}{
"error": {
"type": "api_error",
"message": "<string>"
}
}Authorizations
Create an API token using sf tokens create or at https://sfcompute.com/dashboard/tokens.
Body
application/json
Create a pool to hold compute.
Response
Pool created.
A pool — a container of owned compute allocation over time.