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

# Set when a computer ends

> Give a computer a set number of hours. It stops when its time is up, and an hourly computer prepays the run from your credit.

By default a computer runs until you stop or delete it. Give it an end and it stops by itself when its time is up. An end is a whole number of hours, from 1 to 720 (30 days).

> [!NOTE]
>
> Only Linux and Windows computers, on your plan or billed by the hour, can have an end. Mac, iPhone, Android and device computers can’t.

## Pick an end in the dashboard

In the **New computer** sheet, the **Ends** row says **Never**. Press **Change** next to it and pick one:

| Choice | Ends |
| - | - |
| **Never** | Runs until you stop or delete it (the default) |
| **1 hour** | 1 hour after it launches |
| **4 hours** | 4 hours after it launches |
| **1 day** | 24 hours after it launches |
| **7 days** | 168 hours after it launches |
| **Custom** | Type a whole number of hours, 1 to 720 |

The price line under it says what the end costs, as described in [What an end costs](#what-an-end-costs).

## When time is up

1. **It stops.** Its disk is kept, the same as when you stop it yourself.
2. **It is deleted 7 days later**, unless you start it. Its page and its tile say **Its time ran out. Deleted on** the date **unless you start it.**
3. **Starting it brings it back** as an ordinary computer: its end is cleared. To give it a new end instead, start it from the API with one, as described in [Start or resume with an end](#start-or-resume-with-an-end).

A computer you stop yourself before its end keeps that end. Start it again and it still stops at that time. If it is still stopped when the time comes, it is deleted 7 days later unless you start it.

## Keep it, or change the end

While a computer has an end ahead, its page and its tile say how long it has left, for example **Ends in 3h 12m**. Press **Keep it** beside it to take the end off. The computer then runs until you stop or delete it. Anyone who can change the workspace’s computers can keep one.

To move the end to another time, use the API, as described in [Move or clear the end](#move-or-clear-the-end).

## From the API

Every call below uses an API key: replace `$WORKSPACE_ID` with your workspace and `$COMPUTER_ID` with the computer’s UUID.

### Create a computer with an end

Send `ends_in_hours`, 1 to 720. Leave it out, or send `null`, and the computer never ends.

```bash theme={null}
curl -X POST https://www.orgo.ai/api/computers \
  -H "Authorization: Bearer $ORGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"workspace_id": "'"$WORKSPACE_ID"'", "name": "agent-1", "ram": 8, "ends_in_hours": 4}'
```

The `201` carries `ends_at`, when it stops. An hourly computer also carries `prepaid_until` and `prepaid_cents`, as described in [By the hour, the run is prepaid](#by-the-hour-the-run-is-prepaid). If the computer was made but can’t have an end, `ends_at` is `null` and `ends_warning` says why: `This computer can’t have an end, so it keeps running until you stop it.` See [Create computer](https://docs.orgo.ai/api-reference/computers/create.md).

### Move or clear the end

`PATCH /computers/{id}` takes one of:

* `ends_in_hours`: 1 to 720, counted from now.
* `ends_at`: an ISO 8601 time in the future, at most 720 hours away.
* `"ends_at": null`: no end. The computer runs until you stop or delete it.

```bash theme={null}
# Ends 8 hours from now
curl -X PATCH https://www.orgo.ai/api/computers/$COMPUTER_ID \
  -H "Authorization: Bearer $ORGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ends_in_hours": 8}'

# Keep it: no end
curl -X PATCH https://www.orgo.ai/api/computers/$COMPUTER_ID \
  -H "Authorization: Bearer $ORGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ends_at": null}'
```

Send one of the two fields, not both. The answer carries the computer’s `id`, `name`, `ends_at`, `ended_at` and `deletes_at`. An hourly computer’s answer also carries `prepaid_until` and `prepaid_cents`, and `prepay_returned_cents` when some of its prepay came back. Any change clears a stopped computer’s ended mark, so `"ends_at": null` also keeps a computer whose time ran out, without starting it. Sending back the `ends_at` the computer already has changes nothing, so you can PATCH the object [Get computer](https://docs.orgo.ai/api-reference/computers/get.md) gave you. See [Update computer](https://docs.orgo.ai/api-reference/computers/update.md).

### Start or resume with an end

[Start computer](https://docs.orgo.ai/api-reference/computers/start.md) and [Resume computer](https://docs.orgo.ai/api-reference/computers/resume.md) (for a sleeping computer) take `ends_in_hours` or `ends_at` in the body, checked the same way as on PATCH. The hours count from when the computer is running, not from the request, because a start can take minutes.

```bash theme={null}
curl -X POST https://www.orgo.ai/api/computers/$COMPUTER_ID/start \
  -H "Authorization: Bearer $ORGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ends_in_hours": 2}'
```

A bad end is refused before anything starts. The end is set once the computer is running. If it can’t be set then, the start still succeeds and the answer carries `end_not_set` with an `error` and a `code`. With `async`, the `202` says `end_pending`. A resume that is still under way answers `202` with `end_not_set` and code `STILL_RESUMING`: set the end with PATCH once it is running.

### Read the end

[Get computer](https://docs.orgo.ai/api-reference/computers/get.md) returns:

| Field | Meaning |
| - | - |
| `ends_at` | When it stops. `null`: never. |
| `ended_at` | When it was stopped because its time ran out. `null` otherwise. |
| `deletes_at` | When a computer whose time ran out is deleted unless you start it. |
| `prepaid_until` | An hourly computer with a prepaid run: when the run ends. `null` otherwise. |
| `prepaid_cents` | What is held for that run, in cents. `null` otherwise. |

## What an end costs

How a computer is paid for decides what its end costs. See [How a computer is paid for](https://docs.orgo.ai/guides/billing.md#how-a-computer-is-paid-for).

### On your plan, nothing extra

A computer on your plan costs nothing more with an end. The sheet says **Included in your plan.** The end only decides when it stops. A plan computer given an end later stays on the plan.

### By the hour, the run is prepaid

An hourly computer with an end pays for its whole run up front, from your credit: its running rate times the hours. For a Medium Linux computer with a 4 hour end, the sheet says **Prepay $0.22 from your credit: $0.055/hr for 4 hours. Unused time comes back. Then $0.0034/hr while kept 7 days.** On the computer, the line beside its end says **Prepaid $0.22 until** and the time.

* **It never runs out of credit before its end.** The prepay covers the whole run.
* **Unused time comes back** to your credit, once: when it stops before its end, is deleted, is kept, moves onto your plan, or its end moves earlier. **Keep it** says how much came back.
* **A later end prepays the extra.** Without enough credit, the change answers `402` and nothing changes.
* **It leaves an hour for your other hourly computers.** A prepay never takes the credit your other hourly computers need for their next hour. When that applies, the sheet adds **Needs** an amount **more for an hour of your other computers**.
* **After its end** it is stopped and billed at the stopped rate while it is kept, then deleted 7 days later.
* **A start without an end** bills by the minute, as any hourly computer does. A start with an end prepays once the computer is running.

**Usage** counts a prepay on the day it was made, less what came back.

To launch an hourly computer with an end from the API, send `"billing_mode": "hourly"` with `ends_in_hours`. Only the workspace owner can launch by the hour, and on a paid account only signed in or with a key that has Billing write (an MCP sign-in, or a key without Billing write, gets `403` with code `HOURLY_NEEDS_BILLING`). Send an `Idempotency-Key` with a UUID, so a retry launches it once.

```bash theme={null}
curl -X POST https://www.orgo.ai/api/computers \
  -H "Authorization: Bearer $ORGO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"workspace_id": "'"$WORKSPACE_ID"'", "name": "agent-1", "billing_mode": "hourly", "ram": 8, "ends_in_hours": 4}'
```

The `201` says what was prepaid:

```json theme={null}
{
  "id": "…",
  "ends_at": "2026-10-28T22:00:00.000Z",
  "prepaid_until": "2026-10-28T22:00:00.000Z",
  "prepaid_cents": 22,
  "…": "…"
}
```

On a paid plan, a launch by the hour is only for a computer your plan can’t take. One that fits answers `409` with code `FITS_PLAN`: `This computer fits your plan. Launch it on the plan.` Leave out `billing_mode` and it launches on the plan.

#### Who can prepay

Only the workspace owner can prepay. On a paid account, or one set to pay for every computer from credit, that means signed in or with a key that has Billing write, not through an MCP sign-in. Anyone else who can change the workspace’s computers can still set or move an end: nothing more is held, the time past what is prepaid is billed by the minute, and the answer carries `prepay_warning`.

A first end on a running hourly computer is never refused for credit. When your credit can’t prepay it, the end is still set, the time to it is billed by the minute, and the answer carries `prepay_warning`: `The new end is set, and the time to it is billed by the minute: your credit does not cover prepaying all of it.`

## Errors

| Status | `code` | Meaning |
| - | - | - |
| `400` | `INVALID_ENDS` | The end is not 1 to 720 whole hours, is in the past, is more than 720 hours away, both `ends_at` and `ends_in_hours` were sent, or an end was sent to Stop. The `error` says which. |
| `400` | `ENDS_NOT_SUPPORTED` | `Only Linux and Windows computers can have an end.` |
| `402` | `insufficient_credit` | Your credit can’t prepay the run, for example `This needs $0.22 of credit for 4 hours. You have $0.10.` on create, or `Moving the end needs $0.22 more credit. You have $0.10.` on a later end. The body carries `needed_cents` and `available_cents`, and `keep_cents` when part of it is an hour of your other hourly computers. Nothing changed. |
| `403` | `workspace_read_only` | Your access to the workspace is view only. |
| `403` | `computer_key`, `computer_scope` | A computer’s own key, or a key for one computer, can’t set an end. Use a key for your account. |
| `409` | `COMPUTER_BUSY` | `This computer is busy right now, so its end did not change. Try again in a minute.` |
| `409` | `OPERATION_IN_PROGRESS` | A start without this end is already under way. Set the end once it is running. |
| `503` | `ENDS_UNAVAILABLE` | `Ends aren’t set up on this server yet. Try again later, or leave the end out.` |


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