Skip to main content
GET
/
preview
/
v2
/
orderbook
/
quote
Get market quote
curl --request GET \
  --url https://api.sfcompute.com/preview/v2/orderbook/quote \
  --header 'Authorization: Bearer <token>'
import requests

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

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.sfcompute.com/preview/v2/orderbook/quote', 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/orderbook/quote",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

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

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.sfcompute.com/preview/v2/orderbook/quote")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "requirements": {
    "accelerator": [
      "H100"
    ]
  },
  "start_at": 1738972800,
  "end_at": 1738972800,
  "requested_at": 1738972800,
  "best_bid": {
    "instance_sku": "isku_k3R-nX9vLm7Qp2Yw5Jd8F",
    "dollars_per_node_hour": "<string>",
    "allocation_schedule_delta": [
      {
        "start_at": 1738972800,
        "node_count": 123,
        "end_at": 1738972800
      }
    ]
  },
  "best_ask": {
    "instance_sku": "isku_k3R-nX9vLm7Qp2Yw5Jd8F",
    "dollars_per_node_hour": "<string>",
    "allocation_schedule_delta": [
      {
        "start_at": 1738972800,
        "node_count": 123,
        "end_at": 1738972800
      }
    ]
  }
}
{
"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.

Query Parameters

requirements
string

URL-safe field[:op]:value triples joined by ;.

start_at
integer<int64>
required

Start of the delivery window. Unix timestamp.

Example:

1738972800

end_at
integer<int64>
required

End of the delivery window. Unix timestamp.

Example:

1738972800

Response

Market quote.

Top-of-book snapshot: the highest resting buy (best_bid) and lowest resting sell (best_ask) for the requested window. Either side may be absent if no orders are resting on it.

requirements
object
required

The hardware requirements the book was filtered by.

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

Start of the delivery window the book covers.

Example:

1738972800

end_at
integer<int64>
required

End of the delivery window the book covers.

Example:

1738972800

requested_at
integer<int64>
required

Server time when the book was sampled.

Example:

1738972800

best_bid
null | object

Highest resting buy. Omitted if no bids are resting. If multiple SKUs tie at the best bid price, this is the lowest instance SKU at that price; use /depth to inspect every SKU at the price level.

best_ask
null | object

Lowest resting sell. Omitted if no asks are resting. If multiple SKUs tie at the best ask price, this is the lowest instance SKU at that price; use /depth to inspect every SKU at the price level.