> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sfcompute.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Orders

> Buy and sell compute time

<Warning>
  This feature is in [public preview](/preview/roadmap).
</Warning>

Orders are how you acquire and release compute time. A buy order increases your pool's allocation
schedule. A sell order decreases it and returns credits to your balance.

## Buy orders

Place a buy order to get compute time on a pool. `--max-rate` is the most you'll pay **in dollars per node
per hour**. You can also use `--max-price` to set a maximum total for the order instead.

```bash theme={null}
sf orders create --side buy --pool dev --nodes 1 --start now --duration 1h --max-rate 20.00
```

If the market has availability at your rate, the order fills immediately. If not, the order is
cancelled by default (immediate-or-cancel).

To keep the order on the book until it fills or you cancel it, use `--allow-standing`.

```bash theme={null}
sf orders create --side buy --pool dev --nodes 1 --start now --duration 1h \
  --max-rate 20.00 --allow-standing
```

## Pin to an instance SKU

Every order is pinned to a single instance SKU; the order fills only on that SKU. Pass
`--instance-sku <id>` to pick one directly:

```bash theme={null}
sf orders create --side buy --pool dev --nodes 1 --start now --duration 1h \
  --max-rate 20.00 \
  --instance-sku isku_4UpxzQw7A8N
```

Running `sf orders create` without `--instance-sku` opens an interactive picker that shows every
registered SKU's name, id, and properties. Run `sf instance-skus list` to browse them beforehand.
See [Instance SKUs](/preview/instance-skus) for the full model.

## Sell orders

Sell back compute time you own. This is useful when you have allocated time you no longer need.

```bash theme={null}
sf orders create --side sell --pool dev --nodes 1 \
  --start now --stop "in 1h" --min-rate 8.00 --allow-standing
```

When a sell order fills, credits are added to your balance and your pool's allocation decreases.
Instances on that pool that no longer have allocated time will terminate.

<Note>
  Sell orders are not guaranteed to fill. Use `--allow-standing` to keep the order on the book until a
  buyer matches.
</Note>

## Sell fees

A resale fee is deducted from the fill price when a sell order executes. The fee is dynamic and can
change at any time. You receive the fill price minus the fee as credits.

There are no fees on buy orders.

## Order statuses

| Status    | Description                                                |
| --------- | ---------------------------------------------------------- |
| pending   | Submitted, not yet processed                               |
| filled    | Executed successfully                                      |
| standing  | Waiting for a match on the order book                      |
| cancelled | No match found (immediate-or-cancel) or manually cancelled |
| rejected  | Validation or system error                                 |

## Check an order

```bash theme={null}
sf orders get {order-id}
```

```
│ ORDER ID   ordr__JLBu4arl_9nSLMfF2Ole
│ SIDE       buy
│ STATUS     filled
│ POOL       dev (pool_nuO4nVSM8O3NnsRE7udBe)
│ INSTANCES  1
│ PERIOD     Mar 19, 5pm → 6pm
└ RATE       $20.00/node/hr (filled)
```

## List orders

```bash theme={null}
# List orders in the active workspace
sf orders list
```

To list orders across your entire organization, use `--all`:

```bash theme={null}
sf orders list --all
```

```
SIDE  STATUS     PERIOD   NODES  RATE             POOL      ID
sell  filled     Mar 19       1  ≥$8.00/node/hr   dev       ordr_hYuOEmXW...
buy   filled     Mar 19       1  ≤$20.00/node/hr  dev       ordr__JLBu4ar...
buy   cancelled  Mar 12       1  ≤$20.00/node/hr  dev       ordr_Qj69x65v...
```

Filter by side or status.

```bash theme={null}
sf orders list --side buy --status filled
```

Filter by time range.

```bash theme={null}
# Orders from the last 7 days
sf orders list --created-after 7d

# Orders within a specific window
sf orders list --created-after 2025-03-01 --created-before 2025-03-08

# Orders from a specific calendar month
sf orders list --month 2025-05
```

`--created-after` and `--created-before` accept a datetime, Unix timestamp, or a duration like `24h` or `7d` (meaning 24 hours or 7 days ago, respectively). You can also use `--since` and `--until` as aliases.

## Cancel an order

Cancel a standing order that hasn't filled yet.

```bash theme={null}
sf orders cancel {order-id}
```

## Time formats

Order start and end times snap to hour boundaries. The CLI accepts several time formats:

* `now` — current time
* `in 6h`, `in 2d` — relative time
* `tomorrow`, `mar 15` — natural language dates
* `2025-03-15T10:00:00Z` — ISO 8601
* Unix timestamps

Duration can be specified instead of an end time: `1h`, `7d`, `2w`.

### API reference

See the [Orders API](/preview/api-reference/orders/list-orders) for programmatic access.
