Platform
Get Placements
Simulates placing the specified number of machines into regions, depending on available capacity and limits.
POST
/
v1
/
platform
/
placements
Get Placements
curl --request POST \
--url https://api.machines.dev/v1/platform/placements \
--header 'Content-Type: application/json' \
--data '
{
"org_slug": "personal",
"compute": {
"cpu_kind": "<string>",
"cpus": 123,
"gpu_kind": "<string>",
"gpus": 123,
"host_dedication_id": "<string>",
"kernel_args": [
"<string>"
],
"max_memory_mb": 123,
"memory_mb": 123,
"required_host_features": [
"<string>"
]
},
"count": 123,
"region": "lhr,eu",
"volume_name": "",
"volume_size_bytes": 123,
"weights": {
"region": 1000,
"spread": 0
}
}
'import requests
url = "https://api.machines.dev/v1/platform/placements"
payload = {
"org_slug": "personal",
"compute": {
"cpu_kind": "<string>",
"cpus": 123,
"gpu_kind": "<string>",
"gpus": 123,
"host_dedication_id": "<string>",
"kernel_args": ["<string>"],
"max_memory_mb": 123,
"memory_mb": 123,
"required_host_features": ["<string>"]
},
"count": 123,
"region": "lhr,eu",
"volume_name": "",
"volume_size_bytes": 123,
"weights": {
"region": 1000,
"spread": 0
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
org_slug: 'personal',
compute: {
cpu_kind: '<string>',
cpus: 123,
gpu_kind: '<string>',
gpus: 123,
host_dedication_id: '<string>',
kernel_args: ['<string>'],
max_memory_mb: 123,
memory_mb: 123,
required_host_features: ['<string>']
},
count: 123,
region: 'lhr,eu',
volume_name: '',
volume_size_bytes: 123,
weights: {region: 1000, spread: 0}
})
};
fetch('https://api.machines.dev/v1/platform/placements', 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.machines.dev/v1/platform/placements",
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([
'org_slug' => 'personal',
'compute' => [
'cpu_kind' => '<string>',
'cpus' => 123,
'gpu_kind' => '<string>',
'gpus' => 123,
'host_dedication_id' => '<string>',
'kernel_args' => [
'<string>'
],
'max_memory_mb' => 123,
'memory_mb' => 123,
'required_host_features' => [
'<string>'
]
],
'count' => 123,
'region' => 'lhr,eu',
'volume_name' => '',
'volume_size_bytes' => 123,
'weights' => [
'region' => 1000,
'spread' => 0
]
]),
CURLOPT_HTTPHEADER => [
"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.machines.dev/v1/platform/placements"
payload := strings.NewReader("{\n \"org_slug\": \"personal\",\n \"compute\": {\n \"cpu_kind\": \"<string>\",\n \"cpus\": 123,\n \"gpu_kind\": \"<string>\",\n \"gpus\": 123,\n \"host_dedication_id\": \"<string>\",\n \"kernel_args\": [\n \"<string>\"\n ],\n \"max_memory_mb\": 123,\n \"memory_mb\": 123,\n \"required_host_features\": [\n \"<string>\"\n ]\n },\n \"count\": 123,\n \"region\": \"lhr,eu\",\n \"volume_name\": \"\",\n \"volume_size_bytes\": 123,\n \"weights\": {\n \"region\": 1000,\n \"spread\": 0\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.machines.dev/v1/platform/placements")
.header("Content-Type", "application/json")
.body("{\n \"org_slug\": \"personal\",\n \"compute\": {\n \"cpu_kind\": \"<string>\",\n \"cpus\": 123,\n \"gpu_kind\": \"<string>\",\n \"gpus\": 123,\n \"host_dedication_id\": \"<string>\",\n \"kernel_args\": [\n \"<string>\"\n ],\n \"max_memory_mb\": 123,\n \"memory_mb\": 123,\n \"required_host_features\": [\n \"<string>\"\n ]\n },\n \"count\": 123,\n \"region\": \"lhr,eu\",\n \"volume_name\": \"\",\n \"volume_size_bytes\": 123,\n \"weights\": {\n \"region\": 1000,\n \"spread\": 0\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.machines.dev/v1/platform/placements")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"org_slug\": \"personal\",\n \"compute\": {\n \"cpu_kind\": \"<string>\",\n \"cpus\": 123,\n \"gpu_kind\": \"<string>\",\n \"gpus\": 123,\n \"host_dedication_id\": \"<string>\",\n \"kernel_args\": [\n \"<string>\"\n ],\n \"max_memory_mb\": 123,\n \"memory_mb\": 123,\n \"required_host_features\": [\n \"<string>\"\n ]\n },\n \"count\": 123,\n \"region\": \"lhr,eu\",\n \"volume_name\": \"\",\n \"volume_size_bytes\": 123,\n \"weights\": {\n \"region\": 1000,\n \"spread\": 0\n }\n}"
response = http.request(request)
puts response.read_body{
"regions": [
{
"concurrency": 123,
"count": 123,
"region": "<string>"
}
]
}Body
application/json
Get placements request
Example:
"personal"
Resource requirements for the Machine to simulate. Defaults to a performance-1x machine
Show child attributes
Show child attributes
Number of machines to simulate placement. Defaults to 0, which returns the org-specific limit for each region.
Region expression for placement as a comma-delimited set of regions or aliases. Defaults to "[region],any", to prefer the API endpoint's local region with any other region as fallback.
Example:
"lhr,eu"
Example:
""
Optional weights to override default placement preferences.
Show child attributes
Show child attributes
Example:
{ "region": 1000, "spread": 0 }
Response
200 - application/json
OK
Show child attributes
Show child attributes
⌘I
Get Placements
curl --request POST \
--url https://api.machines.dev/v1/platform/placements \
--header 'Content-Type: application/json' \
--data '
{
"org_slug": "personal",
"compute": {
"cpu_kind": "<string>",
"cpus": 123,
"gpu_kind": "<string>",
"gpus": 123,
"host_dedication_id": "<string>",
"kernel_args": [
"<string>"
],
"max_memory_mb": 123,
"memory_mb": 123,
"required_host_features": [
"<string>"
]
},
"count": 123,
"region": "lhr,eu",
"volume_name": "",
"volume_size_bytes": 123,
"weights": {
"region": 1000,
"spread": 0
}
}
'import requests
url = "https://api.machines.dev/v1/platform/placements"
payload = {
"org_slug": "personal",
"compute": {
"cpu_kind": "<string>",
"cpus": 123,
"gpu_kind": "<string>",
"gpus": 123,
"host_dedication_id": "<string>",
"kernel_args": ["<string>"],
"max_memory_mb": 123,
"memory_mb": 123,
"required_host_features": ["<string>"]
},
"count": 123,
"region": "lhr,eu",
"volume_name": "",
"volume_size_bytes": 123,
"weights": {
"region": 1000,
"spread": 0
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
org_slug: 'personal',
compute: {
cpu_kind: '<string>',
cpus: 123,
gpu_kind: '<string>',
gpus: 123,
host_dedication_id: '<string>',
kernel_args: ['<string>'],
max_memory_mb: 123,
memory_mb: 123,
required_host_features: ['<string>']
},
count: 123,
region: 'lhr,eu',
volume_name: '',
volume_size_bytes: 123,
weights: {region: 1000, spread: 0}
})
};
fetch('https://api.machines.dev/v1/platform/placements', 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.machines.dev/v1/platform/placements",
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([
'org_slug' => 'personal',
'compute' => [
'cpu_kind' => '<string>',
'cpus' => 123,
'gpu_kind' => '<string>',
'gpus' => 123,
'host_dedication_id' => '<string>',
'kernel_args' => [
'<string>'
],
'max_memory_mb' => 123,
'memory_mb' => 123,
'required_host_features' => [
'<string>'
]
],
'count' => 123,
'region' => 'lhr,eu',
'volume_name' => '',
'volume_size_bytes' => 123,
'weights' => [
'region' => 1000,
'spread' => 0
]
]),
CURLOPT_HTTPHEADER => [
"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.machines.dev/v1/platform/placements"
payload := strings.NewReader("{\n \"org_slug\": \"personal\",\n \"compute\": {\n \"cpu_kind\": \"<string>\",\n \"cpus\": 123,\n \"gpu_kind\": \"<string>\",\n \"gpus\": 123,\n \"host_dedication_id\": \"<string>\",\n \"kernel_args\": [\n \"<string>\"\n ],\n \"max_memory_mb\": 123,\n \"memory_mb\": 123,\n \"required_host_features\": [\n \"<string>\"\n ]\n },\n \"count\": 123,\n \"region\": \"lhr,eu\",\n \"volume_name\": \"\",\n \"volume_size_bytes\": 123,\n \"weights\": {\n \"region\": 1000,\n \"spread\": 0\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.machines.dev/v1/platform/placements")
.header("Content-Type", "application/json")
.body("{\n \"org_slug\": \"personal\",\n \"compute\": {\n \"cpu_kind\": \"<string>\",\n \"cpus\": 123,\n \"gpu_kind\": \"<string>\",\n \"gpus\": 123,\n \"host_dedication_id\": \"<string>\",\n \"kernel_args\": [\n \"<string>\"\n ],\n \"max_memory_mb\": 123,\n \"memory_mb\": 123,\n \"required_host_features\": [\n \"<string>\"\n ]\n },\n \"count\": 123,\n \"region\": \"lhr,eu\",\n \"volume_name\": \"\",\n \"volume_size_bytes\": 123,\n \"weights\": {\n \"region\": 1000,\n \"spread\": 0\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.machines.dev/v1/platform/placements")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"org_slug\": \"personal\",\n \"compute\": {\n \"cpu_kind\": \"<string>\",\n \"cpus\": 123,\n \"gpu_kind\": \"<string>\",\n \"gpus\": 123,\n \"host_dedication_id\": \"<string>\",\n \"kernel_args\": [\n \"<string>\"\n ],\n \"max_memory_mb\": 123,\n \"memory_mb\": 123,\n \"required_host_features\": [\n \"<string>\"\n ]\n },\n \"count\": 123,\n \"region\": \"lhr,eu\",\n \"volume_name\": \"\",\n \"volume_size_bytes\": 123,\n \"weights\": {\n \"region\": 1000,\n \"spread\": 0\n }\n}"
response = http.request(request)
puts response.read_body{
"regions": [
{
"concurrency": 123,
"count": 123,
"region": "<string>"
}
]
}