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

# Regions

> A VM or browser runs in US East (Ashburn). Amsterdam (EU) is coming back later; a create that names ams runs in Ashburn and the answer's region says ash.

| Location | `region` | Where |
| - | - | - |
| US East (Ashburn) | `ash` | Where a create starts. Machines in Northern Virginia. A browser here reports the `America/New_York` time zone and `en-US`. |
| Europe (Amsterdam) | `ams` | Coming back later. Accepted, served in Ashburn. |

`eu` and `eu-central` (for `ams`) and `us-east` and `ashburn` (for `ash`) are accepted as aliases, in any case. The API
always answers with the region's own id, `ams` or `ash`.

## See which regions are open

`GET /regions` lists the regions, each with `available`: whether a machine there is taking new VMs right now. The Dashboard
reads the same list, so its Location picker shows only the regions you can start in.

```bash theme={"theme":"css-variables"}
curl -sS https://api.styne.ai/regions -H "authorization: Bearer $STYNE_API_KEY"
```

## Choose a region

On a sandbox, add `region` to the create body.
On a browser session, send it in the body of `POST /browsers`.

```bash theme={"theme":"css-variables"}
curl -sS https://api.styne.ai/sandboxes \
  -H "authorization: Bearer $STYNE_API_KEY" \
  -H "content-type: application/json" \
  -d '{"templateID": "base", "region": "ash"}'
```

```bash theme={"theme":"css-variables"}
curl -sS https://api.styne.ai/browsers \
  -H "authorization: Bearer $STYNE_API_KEY" \
  -H "content-type: application/json" \
  -d '{"region": "ash"}'
```

The Styne SDKs take `region` (`styne.Client(region="ash")`, `new Styne({ region: "ash" })`) or `STYNE_REGION`. That picks the regional API host
`https://<region>.api.styne.ai` and is the region of every create that names none; without it the SDKs use the `ash` host. Snapshot creates stay in the snapshot's region.

The E2B SDKs have no region argument. They keep working unchanged and start in Ashburn. To name a region from
an SDK, put it in the metadata of the create: `metadata={"styne.region": "ash"}`.

The create answer and `GET` of a sandbox or a browser session carry `region`, so you can always read where a VM runs. The
Dashboard shows the same in a Region column in the lists.

## What stays in a region

* A fork, a resume and a snapshot start stay on the node that holds the VM's files, so they run in the region of the original.
* Your plan's limits (concurrent sandboxes and hours) count across all regions together.
* While Amsterdam is dark, every create runs in Ashburn, and `region` in the answer says so.
* A volume is kept in the region it was created in, on one machine of it; a sandbox that mounts it starts on that machine. Naming the other region answers `422 volume_region_mismatch`.
* A snapshot is kept in the region it was taken in. Starting it names no region, or the same one; naming the other region
  answers `422 snapshot_region_mismatch`.

## Errors

| Status | `code` | When |
| - | - | - |
| 422 | `unknown_region` | `region` is not a region id or an alias. |
| 422 | `snapshot_region_mismatch` | A create started a snapshot in another region than the one it is kept in. Leave `region` out. |
| 503 | `region_unavailable` | No machine in that region is taking new VMs right now. Retry after the `Retry-After` seconds. |


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