# Rentals

Source: https://bflops.com/docs/api/rentals

Start a quoted machine or cluster, watch it, extend it and stop it.



## Start a rental [#start-a-rental]

<Endpoint method="POST" path="/api/v1/rentals" />

Starts what a quote priced. Needs a key with a **GPU daily limit**.

| Field       | Type    | Required | What it is                                                                                            |
| ----------- | ------- | -------- | ----------------------------------------------------------------------------------------------------- |
| `quote_id`  | string  | Yes      | From [`POST /quotes`](/docs/api/quotes), within 60 seconds                                            |
| `ssh_key`   | string  | Yes      | Your SSH public key, one line. See [SSH keys](/docs/ssh-keys)                                         |
| `app`       | string  | No       | `pytorch` (the default), `jupyter`, `comfyui`, `ollama` or `stable-diffusion`. See [Apps](/docs/apps) |
| `ttl_hours` | number  | No       | Hours until it stops by itself: 1 to 168, 24 by default                                               |
| `data`      | boolean | No       | Mount [/data](/docs/storage). Only where the quote's `data_allowed` is `true`                         |

Send an `Idempotency-Key` header so a retry never starts a second machine. See [Safe retries](/docs/api#safe-retries).

```bash
curl https://bflops.com/api/v1/rentals \
  -H "Authorization: Bearer $BFLOPS_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: train-2026-11-27" \
  -d '{"quote_id": "q_9d2c4e1f0a7b4c8e9f1a2b3c4d5e6f70", "ssh_key": "ssh-ed25519 AAAA... you@laptop", "ttl_hours": 4}'
```

It answers `201` at once with the rental in `starting`. The same request again answers `200` with the same rental.

## The rental [#the-rental]

```json title="201"
{
  "rental": {
    "id": 1042,
    "status": "running",
    "kind": "on_demand",
    "gpu_model": "H100 SXM",
    "gpus": 8,
    "nodes": 1,
    "cluster": false,
    "data": false,
    "app": "pytorch",
    "per_hour_usd": "17.52",
    "cost_usd": "2.92",
    "billed_seconds": 600,
    "ssh": "ssh -p 40022 root@203.0.113.7",
    "tunnel": {
      "command": "ssh -N -L 8888:localhost:8888 -p 40022 root@203.0.113.7",
      "url": "http://localhost:8888"
    },
    "node_access": [],
    "requested_at": "2026-11-27T09:30:12.000Z",
    "started_at": "2026-11-27T09:31:40.000Z",
    "ends_at": "2026-11-27T13:31:40.000Z",
    "ended_at": null,
    "end_reason": null,
    "price_rise": null,
    "can_stop": true,
    "can_extend": true
  }
}
```

| Field                        | What it means                                                                                                                    |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `status`                     | `starting`, `running`, `paused` (billing paused: no check passed for 10 minutes), `stopping`, `ended` or `failed` (never billed) |
| `ssh`, `tunnel`              | How to connect, once `running`. `null` before                                                                                    |
| `node_access`                | For a cluster: each node's `rank`, `ssh` and `private_ip`                                                                        |
| `cost_usd`, `billed_seconds` | What it has cost so far, and the seconds billed                                                                                  |
| `ends_at`                    | When it stops by itself; `null` for one started on the site                                                                      |
| `end_reason`                 | Why it ended. See below                                                                                                          |
| `price_rise`                 | A coming price change: the new `per_hour_usd` and `at` when it applies                                                           |

### Why a rental ended [#why-a-rental-ended]

| `end_reason`      | Meaning                                 |
| ----------------- | --------------------------------------- |
| `renter_stop`     | You or your key stopped it              |
| `balance_empty`   | Your balance ran out                    |
| `spend_cap`       | A daily limit was reached               |
| `ended_on_time`   | `ttl_hours` ran out                     |
| `preempted`       | An interruptible machine was taken back |
| `stopped_by_host` | The machine stopped on its host's side  |
| `key_revoked`     | The key that started it was revoked     |
| `paused`          | New machines were paused for safety     |
| `policy`          | It broke our [Terms](/terms)            |
| `canceled`        | It was cancelled before it started      |
| `start_failed`    | It failed to start. Never billed        |

## List rentals [#list-rentals]

<Endpoint method="GET" path="/api/v1/rentals" />

Your rentals, newest first, in `data`. Add `?status=active` for those still going, and `limit` (1 to 200, 50 by default).

## One rental [#one-rental]

<Endpoint method="GET" path="/api/v1/rentals/{id}" />

Answers `{ "rental": { ... }, "events": [ ... ] }`. Each event has a `kind` and an `at` time, with details such as `reason` where they apply. Read it every 10 seconds or so while it starts.

## Stop a rental [#stop-a-rental]

<Endpoint method="POST" path="/api/v1/rentals/{id}/stop" />

Billing ends at once. The machine is deleted with everything outside /data, and `status` turns `ended` shortly after. Stopping again changes nothing. No body.

## Extend a rental [#extend-a-rental]

<Endpoint method="POST" path="/api/v1/rentals/{id}/extend" />

Adds hours to `ends_at` of a machine a key started, while it is `starting` or `running`. It never goes past 7 days from now. Takes an `Idempotency-Key`.

```json title="Body"
{ "hours": 12 }
```

`hours` is 1 to 168. A rental started on the site cannot be extended: it runs until you stop it. Such a call gets `409` `not_extendable`.

## Errors you may get [#errors-you-may-get]

| Code                                   | Status | What to do                                                   |
| -------------------------------------- | ------ | ------------------------------------------------------------ |
| `read_only_key`                        | 403    | Give the key a GPU daily limit on [API keys](/keys)          |
| `expired`, `price_moved`, `quote_used` | 409    | Get a new quote and start again                              |
| `balance_short`                        | 402    | [Top up](/docs/top-up), then start again                     |
| `machine_unavailable`                  | 409    | Someone else rented it first. List again                     |
| `agent_cap`                            | 429    | The key runs 4 machines or 1 cluster already. Stop one first |
| `key_daily_limit`                      | 429    | Wait for the next UTC day, or raise the limit                |
| `data_unavailable`, `data_in_use`      | 409    | See [Keep files with /data](/docs/storage)                   |

All codes: [Errors](/docs/api/errors).
