Skip to main content
POST
/
preview
/
v2
/
orders
Create order
curl --request POST \
  --url https://api.sfcompute.com/preview/v2/orders \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "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
}
'
import requests

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

payload = {
"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
}
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({
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
})
};

fetch('https://api.sfcompute.com/preview/v2/orders', 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/orders",
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([
'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
]),
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/orders"

payload := strings.NewReader("{\n \"pool\": \"<string>\",\n \"instance_sku\": \"isku_k3R-nX9vLm7Qp2Yw5Jd8F\",\n \"allocation_schedule_delta\": [\n {\n \"start_at\": 1738972800,\n \"node_count\": 123,\n \"end_at\": 1738972800\n }\n ],\n \"limit_price_dollars_per_node_hour\": \"<string>\",\n \"allow_standing\": true,\n \"allow_partial\": true\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/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"pool\": \"<string>\",\n \"instance_sku\": \"isku_k3R-nX9vLm7Qp2Yw5Jd8F\",\n \"allocation_schedule_delta\": [\n {\n \"start_at\": 1738972800,\n \"node_count\": 123,\n \"end_at\": 1738972800\n }\n ],\n \"limit_price_dollars_per_node_hour\": \"<string>\",\n \"allow_standing\": true,\n \"allow_partial\": true\n}")
.asString();
require 'uri'
require 'net/http'

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

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 \"pool\": \"<string>\",\n \"instance_sku\": \"isku_k3R-nX9vLm7Qp2Yw5Jd8F\",\n \"allocation_schedule_delta\": [\n {\n \"start_at\": 1738972800,\n \"node_count\": 123,\n \"end_at\": 1738972800\n }\n ],\n \"limit_price_dollars_per_node_hour\": \"<string>\",\n \"allow_standing\": true,\n \"allow_partial\": true\n}"

response = http.request(request)
puts response.read_body
{
  "object": "order",
  "id": "<string>",
  "capacity": {
    "id": "cap_k3R-nX9vLm7Qp2Yw5Jd8F",
    "name": "<string>"
  },
  "pool": {
    "id": "<string>",
    "name": "<string>"
  },
  "allow_standing": true,
  "instance_sku": {
    "object": "instance_sku",
    "id": "isku_k3R-nX9vLm7Qp2Yw5Jd8F",
    "alias": "<string>"
  },
  "allocation_schedule_delta": [
    {
      "start_at": 1738972800,
      "node_count": 123,
      "end_at": 1738972800
    }
  ],
  "filled_allocation_schedule_delta": [
    {
      "start_at": 1738972800,
      "node_count": 123,
      "end_at": 1738972800
    }
  ],
  "limit_price_dollars_per_node_hour": "<string>",
  "created_at": 1738972800,
  "allow_partial": true,
  "created_by": {
    "id": "<string>",
    "email": "<string>",
    "name": "<string>"
  },
  "filled_at": 1738972800,
  "filled_average_price_dollars_per_node_hour": "2.500000",
  "fills": [
    {
      "filled_at": 1738972800,
      "allocation_schedule_delta": [
        {
          "start_at": 1738972800,
          "node_count": 123,
          "end_at": 1738972800
        }
      ],
      "price_dollars_per_node_hour": "<string>",
      "contract": "cont_k3R-nX9vLm7Qp2Yw5Jd8F"
    }
  ],
  "cancelled_at": 1738972800
}
{
"error": {
"type": "authentication_error",
"message": "<string>"
}
}
{
"error": {
"type": "payment_required",
"message": "<string>"
}
}
{
"error": {
"type": "forbidden",
"message": "<string>"
}
}
{
"error": {
"type": "not_found",
"message": "<string>"
}
}
{
"error": {
"type": "unprocessable_entity",
"message": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}
{
"error": {
"type": "api_error",
"message": "<string>"
}
}
{
"error": {
"type": "service_unavailable",
"message": "<string>"
}
}

Authorizations

Authorization
string
header
required

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

Headers

Idempotency-Key
string | null

Unique key to ensure idempotent order creation. If provided, duplicate requests with the same key will not place a new order and return the original order.

Body

application/json
pool
string
required

Target pool that receives compute when filled.

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

"pool_k3R-nX9vLm7Qp2Yw5Jd8F"

side
enum<string>
required
Available options:
sell,
buy
instance_sku
required

Instance SKU this order will fill on. Rejected at submission if the SKU id is not registered.

Pattern: isku_[0-9a-zA-Z_-]{1,21}
Example:

"isku_k3R-nX9vLm7Qp2Yw5Jd8F"

allocation_schedule_delta
object[]
required

Change in capacity if the order fills (added on buy, subtracted on sell). Must be a single time range with both start_at and end_at.

limit_price_dollars_per_node_hour
string
required

Limit price per node-hour. Decimal string (e.g. "1.500000"); rounded to per-minute precision on submission.

Pattern: ^\d+\.\d+$
Example:

"2.500000"

allow_standing
boolean

If true, the order rests on the order book until it fills, is cancelled, or its end time passes. If false, the order is cancelled immediately if it does not fill.

allow_partial
boolean

If true, the order may fill partially — fewer nodes and/or a subset of the requested time window. The filled time may be disjoint.

Response

Order created.

object
string
default:order
required
read-only
Allowed value: "order"
id
string
required
Pattern: ordr_[0-9a-zA-Z_-]{1,21}
Example:

"ordr_k3R-nX9vLm7Qp2Yw5Jd8F"

capacity
object
required

Deprecated — use pool. Target pool that receives or loses compute if this order fills (depending on order type).

pool
object
required

A pool referenced by id and name.

side
enum<string>
required
Available options:
sell,
buy
allow_standing
boolean
required

If true, the order stays in the order book until either fills, is explicitly cancelled, or the order end time is reached resulting in automatic cancellation. If false, the order is cancelled immediately if it doesn't fill.

instance_sku
object
required

Instance SKU this order is pinned to. Carries the SKU's human-readable name when one is registered.

allocation_schedule_delta
object[]
required

Change in capacity if the order fills. Must be a single time range with both start_at and end_at.

filled_allocation_schedule_delta
object[]
required

The portion of the requested schedule that has filled so far. Empty for orders with no fills yet; the unfilled remainder is allocation_schedule_delta minus this.

limit_price_dollars_per_node_hour
string
required

Price rate in dollars per node-hour.

Pattern: ^\d+\.\d+$
Example:

"2.500000"

status
enum<string>
required

The status of an order in the system.

pending = not resolved/processed yet.

filled = order executed.

partially_filled = the order matched part of its requested capacity and remains active for the remainder.

standing = the order is waiting for a match.

cancelled = the order was cancelled either automatically (not a standing order and didn't immediately fill, or current time past end_at) or by explicit cancellation.

rejected = validation/system error occurred.

Available options:
pending,
filled,
partially_filled,
rejected,
cancelled,
standing
created_at
integer<int64>
required

Unix timestamp.

Example:

1738972800

allow_partial
boolean

If true, the order may fill partially — fewer nodes and/or a subset of the requested time window.

created_by
null | object

Principal that placed the order — the human user when known, otherwise the API token that placed it. null for orders that predate attribution. Always present (value-or-null) like other order attributes, since every order conceptually has a creator.

filled_at
null | integer<int64>

Unix timestamp.

Example:

1738972800

filled_average_price_dollars_per_node_hour
null | string

Weighted-average execution price across all fills.

Pattern: ^\d+\.\d+$
Example:

"2.500000"

fills
object[]

Each contract produced by this order. Empty for unfilled orders.

cancelled_at
null | integer<int64>

Unix timestamp.

Example:

1738972800