Skip to main content
POST
/
pricing
/
compute
Get pricing for an instance
curl --request POST \
  --url https://pricing.baselinehq.cloud/pricing/compute \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "availability_zone": "<string>",
  "fallback_to_base_pricing": true,
  "id": "<string>",
  "instance_type": "<string>",
  "operating_system": "<string>",
  "region": "<string>",
  "vm": {
    "cpu_cores": 123,
    "ram_gb": 123
  }
}
'
import requests

url = "https://pricing.baselinehq.cloud/pricing/compute"

payload = {
"availability_zone": "<string>",
"fallback_to_base_pricing": True,
"id": "<string>",
"instance_type": "<string>",
"operating_system": "<string>",
"region": "<string>",
"vm": {
"cpu_cores": 123,
"ram_gb": 123
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
availability_zone: '<string>',
fallback_to_base_pricing: true,
id: '<string>',
instance_type: '<string>',
operating_system: '<string>',
region: '<string>',
vm: {cpu_cores: 123, ram_gb: 123}
})
};

fetch('https://pricing.baselinehq.cloud/pricing/compute', 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://pricing.baselinehq.cloud/pricing/compute",
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([
'availability_zone' => '<string>',
'fallback_to_base_pricing' => true,
'id' => '<string>',
'instance_type' => '<string>',
'operating_system' => '<string>',
'region' => '<string>',
'vm' => [
'cpu_cores' => 123,
'ram_gb' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);

$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://pricing.baselinehq.cloud/pricing/compute"

payload := strings.NewReader("{\n \"availability_zone\": \"<string>\",\n \"fallback_to_base_pricing\": true,\n \"id\": \"<string>\",\n \"instance_type\": \"<string>\",\n \"operating_system\": \"<string>\",\n \"region\": \"<string>\",\n \"vm\": {\n \"cpu_cores\": 123,\n \"ram_gb\": 123\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-API-Key", "<api-key>")
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://pricing.baselinehq.cloud/pricing/compute")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"availability_zone\": \"<string>\",\n \"fallback_to_base_pricing\": true,\n \"id\": \"<string>\",\n \"instance_type\": \"<string>\",\n \"operating_system\": \"<string>\",\n \"region\": \"<string>\",\n \"vm\": {\n \"cpu_cores\": 123,\n \"ram_gb\": 123\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://pricing.baselinehq.cloud/pricing/compute")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"availability_zone\": \"<string>\",\n \"fallback_to_base_pricing\": true,\n \"id\": \"<string>\",\n \"instance_type\": \"<string>\",\n \"operating_system\": \"<string>\",\n \"region\": \"<string>\",\n \"vm\": {\n \"cpu_cores\": 123,\n \"ram_gb\": 123\n }\n}"

response = http.request(request)
puts response.read_body
{
  "architecture": "<string>",
  "availability_zone": "<string>",
  "cost_per_hour": 123,
  "cpu_cores": 123,
  "cpu_cores_cost_per_hour": 123,
  "created_at": "<string>",
  "id": "<string>",
  "instance_type": "<string>",
  "operating_system": "<string>",
  "period_billing_hours": 123,
  "provider": "<string>",
  "ram_gb": 123,
  "ram_gb_cost_per_hour": 123,
  "raw_pricing_data": {},
  "region": "<string>",
  "service": "<string>",
  "tags": {},
  "updated_at": "<string>",
  "usage_type": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}

Authorizations

X-API-Key
string
header
required

API key with "bl_" prefix (e.g. "bl_<api_key>")

Body

application/json

Instance

availability_zone
string
fallback_to_base_pricing
boolean
id
string
instance_type
string
operating_system
string
provider
enum<string>
Available options:
GCP,
AWS,
DigitalOcean,
Azure,
Hetzner,
OVHCloud,
Base
region
string
service
enum<string>
Available options:
ComputeEngine,
AmazonEC2,
Droplet,
AzureCompute,
AzureManagedDisks,
HetznerCompute,
OVHPublicCloud,
BaseCompute,
BaseDisks,
AmazonEBS,
ComputeEnginePersistentDisk
usage_type
enum<string>
Available options:
SPOT_PREEMPTIBLE,
ONDEMAND,
RESERVED,
ONDEMAND_CUSTOM,
SPOT_PREEMPTIBLE_CUSTOM,
RESERVED_CUSTOM,
SOLE_TENANCY,
CUSTOM,
EXTENDED
vm
object

Response

Pricing for a given instance

architecture
string
availability_zone
string
cost_per_hour
number
cpu_cores
number
cpu_cores_cost_per_hour
number
created_at
string
id
string
instance_type
string
operating_system
string
period_billing_hours
number
provider
string
ram_gb
number
ram_gb_cost_per_hour
number
raw_pricing_data
object
region
string
service
string
tags
object
updated_at
string
usage_type
string