Skip to main content
POST
/
preview
/
v2
/
order_preview
Estimate an order
curl --request POST \
  --url https://api.sfcompute.com/preview/v2/order_preview \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "requirements": {
    "accelerator": [
      "H100"
    ]
  },
  "start_at": 1738972800,
  "duration_seconds": 1,
  "node_count": 123,
  "pool": "pool_k3R-nX9vLm7Qp2Yw5Jd8F"
}
'
import requests

url = "https://api.sfcompute.com/preview/v2/order_preview"

payload = {
"requirements": { "accelerator": ["H100"] },
"start_at": 1738972800,
"duration_seconds": 1,
"node_count": 123,
"pool": "pool_k3R-nX9vLm7Qp2Yw5Jd8F"
}
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({
requirements: {accelerator: ['H100']},
start_at: 1738972800,
duration_seconds: 1,
node_count: 123,
pool: 'pool_k3R-nX9vLm7Qp2Yw5Jd8F'
})
};

fetch('https://api.sfcompute.com/preview/v2/order_preview', 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/preview/v2/order_preview",
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([
'requirements' => [
'accelerator' => [
'H100'
]
],
'start_at' => 1738972800,
'duration_seconds' => 1,
'node_count' => 123,
'pool' => 'pool_k3R-nX9vLm7Qp2Yw5Jd8F'
]),
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/preview/v2/order_preview"

payload := strings.NewReader("{\n \"requirements\": {\n \"accelerator\": [\n \"H100\"\n ]\n },\n \"start_at\": 1738972800,\n \"duration_seconds\": 1,\n \"node_count\": 123,\n \"pool\": \"pool_k3R-nX9vLm7Qp2Yw5Jd8F\"\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/preview/v2/order_preview")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"requirements\": {\n \"accelerator\": [\n \"H100\"\n ]\n },\n \"start_at\": 1738972800,\n \"duration_seconds\": 1,\n \"node_count\": 123,\n \"pool\": \"pool_k3R-nX9vLm7Qp2Yw5Jd8F\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sfcompute.com/preview/v2/order_preview")

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 \"requirements\": {\n \"accelerator\": [\n \"H100\"\n ]\n },\n \"start_at\": 1738972800,\n \"duration_seconds\": 1,\n \"node_count\": 123,\n \"pool\": \"pool_k3R-nX9vLm7Qp2Yw5Jd8F\"\n}"

response = http.request(request)
puts response.read_body
{
  "post_order_body": {
    "pool": "<string>",
    "instance_sku": "isku_k3R-nX9vLm7Qp2Yw5Jd8F",
    "allocation_schedule_delta": [
      {
        "start_at": 1738972800,
        "node_count": 123,
        "end_at": 1738972800
      }
    ],
    "limit_price_dollars_per_node_hour": "<string>",
    "allow_standing": true,
    "allow_partial": true
  },
  "fee": {
    "flat_dollars_per_node_hour": "<string>",
    "percentage_bps": 123
  },
  "type": "quoted",
  "notices": [
    {
      "start_at": 1738972800,
      "end_at": 1738972800,
      "title": "<string>",
      "description": "<string>",
      "type": "maintenance_window",
      "action_message": "<string>"
    }
  ]
}
{
"error": {
"type": "authentication_error",
"message": "<string>"
}
}
{
"error": {
"type": "unprocessable_entity",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}
{
"error": {
"type": "api_error",
"message": "<string>"
}
}

Authorizations

Authorization
string
header
required

Create an API token using sf tokens create or at https://sfcompute.com/account/api-keys.

Body

application/json
requirements
object
required

Key/value filters on instance SKU properties.

Valid keys and values are published at GET /v2/instance_sku_property_catalog.

Empty map = no constraints.

Example:
{ "accelerator": ["H100"] }
start_at
integer<int64>
required

Order start. Must align to a 60-second boundary.

Example:

1738972800

duration_seconds
integer<u-int64>
required

Order duration in seconds. Must be a positive multiple of 60.

Required range: x >= 0
node_count
integer<int32>
required

Number of nodes. Must be positive.

pool
null | string

Pool that receives compute when the order fills. Omit to get an estimate without pinning to a pool. The response body then returns a placeholder you must replace before submitting to /v2/orders.

Pattern: (pool_[0-9a-zA-Z_-]{1,21})|(sfc:pool:[a-zA-Z0-9._-]+(:[a-zA-Z0-9._-]+){2,2})
Example:

"pool_k3R-nX9vLm7Qp2Yw5Jd8F"

Response

Estimate result.

post_order_body
object
required

Ready-to-submit body for POST /v2/orders. Posting this body verbatim will fill at the estimated price.

fee
object
required

Fee policy for the matched instance SKU.

type
string
default:quoted
required
read-only
Allowed value: "quoted"
notices
object[]

Maintenance windows for the matched instance SKU overlapping the order's delivery window.