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

# Run While Funded

> Create a sandbox with credits and no fixed lifetime, so it keeps running while your balance covers it, and read how far it is funded.

A sandbox paid with credits can run for as long as your balance covers it. BoxRouter reserves one
hour at a time and renews the reservation before each hour ends. You don't pick a lifetime.

**Before You Begin:** `BOXROUTER_API_KEY` set and a client installed, as in the [quickstart](https://boxrouter.ai/docs/quickstart.md),
and [credits](https://boxrouter.ai/docs/credits.md) in your balance.

| To Do This | Use | Go To |
| - | - | - |
| Run while the balance lasts | Leave out `lifetime_seconds` | [Create It](#create-it) |
| Read how far it is funded | `funded_until` | [Create It](#create-it) |
| See how it is reserved | `charge.funding` | [What a Reservation Is](#what-a-reservation-is) |

## Create It

Leave out `lifetime_seconds` and set `resources.extendable_lifetime`. `funded_until` is when the current
reservation ends:

```python Python theme={"theme":"css-variables"}
from boxrouter import BoxRouter

with BoxRouter() as client:
    with client.sandboxes.create(resources={"extendable_lifetime": True}) as box:
        print(box.funded_until.isoformat())
```

```typescript TypeScript theme={"theme":"css-variables"}
import { BoxRouter } from '@boxrouter/sdk';

await using client = new BoxRouter();
await using box = await client.sandboxes.create({ resources: { extendable_lifetime: true } });
console.log(box.funded_until);
```

```bash CLI theme={"theme":"css-variables"}
(
  set -euo pipefail
  id=$(boxrouter create --resources '{"extendable_lifetime":true}')
  trap 'boxrouter destroy "$id" >/dev/null' EXIT
  boxrouter get "$id" | jq -er '.funded_until | strings'
)
```

```bash HTTP theme={"theme":"css-variables"}
(
  set -euo pipefail
  API=${BOXROUTER_BASE_URL:-https://api.boxrouter.ai/api/v1}
  AUTH="Authorization: Bearer $BOXROUTER_API_KEY"
  body=$(curl -sSf -X POST "$API/sandboxes" -H "$AUTH" -H "Content-Type: application/json" \
    -d '{"resources": {"extendable_lifetime": true}}')
  id=$(jq -er '.id | strings | select(length > 0)' <<<"$body")
  trap 'curl -sSf -X DELETE "$API/sandboxes/$id" -H "$AUTH" >/dev/null' EXIT
  jq -er '.funded_until | strings' <<<"$body"
)
```

Output

```text theme={"theme":"css-variables"}
2026-11-07T14:00:00.048274Z
```

Python writes the offset as `+00:00`. `funded_until` moves an hour later at each renewal. If your
available balance can't cover the next hour, the sandbox ends at `funded_until`.
[Top up automatically](https://boxrouter.ai/docs/credits.md#top-up-automatically) or set a
[low-balance alert](https://boxrouter.ai/docs/credits.md#get-low-balance-alerts) to stay ahead of it. A sandbox paid with your own
provider account has no `funded_until`.

On a route that can't extend a lifetime, or when you set `lifetime_seconds`, BoxRouter reserves the
whole [lifetime](https://boxrouter.ai/docs/lifecycle.md#lifetime) when the sandbox starts.

## What a Reservation Is

A reservation is held from your balance, not spent. It shows as `reserved` until the provider's records
set the charge, and the charge is the provider's cost, never the reservation. A read of the sandbox
says how it is reserved in `charge.funding`:

| `charge.funding` | What It Means |
| - | - |
| `fixed` | You set `lifetime_seconds`, and all of it was reserved at creation. |
| `rolling` | You left it out, and BoxRouter reserves an hour at a time. |
| `ending_unfunded` | A renewal wasn't funded, so the sandbox ends at `funded_until`. |

See [what a sandbox was charged](https://boxrouter.ai/docs/credits.md#see-what-a-sandbox-was-charged) for the rest of `charge`.

## Next Steps

> [card] [Buy and Manage Credits](https://boxrouter.ai/docs/credits.md)
>
> Buy credits, top up automatically and get low-balance alerts.

> [card] [Understand the Lifecycle](https://boxrouter.ai/docs/lifecycle.md)
>
> How a lifetime starts, ends and is extended.

> [card] [Create a Sandbox](https://boxrouter.ai/docs/sandboxes.md)
>
> Size, lifetime and labels for the sandbox you create.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.