# Region

> Regions: where a resource runs and keeps its data, in NoClick's own names (`us-east`, `us-west`, `eu`, `ap`, and `in` for machines), never a cloud's.

A resource takes its region when it's created and keeps it: the `region=`
you pass, else (for a child agent) its parent's, else your account's default
region, else none, which means wherever NoClick has capacity. Pass
`region=other.region` to put two resources together.

```python
for region in noclick.regions():
    print(region.name, region.label, region.default)
with noclick.Sandbox.create(region="eu") as sb:
    print(sb.region)   # eu
```

## Region

```typescript
interface Region
```

A place NoClick runs resources and keeps their data; `region=` takes its `name`.

| Attribute | Type | Description |
| --- | --- | --- |
| `name` | `RegionName` | What `region` takes. |
| `label` | `string` | For people: `US East`, `US West`, `Europe`, `Asia-Pacific`. |
| `location` | `string` | Where it is, in words. |
| `kinds` | `RegionKind[]` | The kinds of resource it places today: `sandbox`, `agent`, `bucket`, `database`, `project` (an app) and `machine` everywhere, `browser` everywhere but `us-west`, `dict` and `queue` in `us-east`. |
| `default` | `boolean` | Whether it's your account's default region, which a resource takes when you name none. |
| `raw` | `JsonObject` | The response JSON exactly as the API sent it. |

Types:

```typescript
type RegionName = "us-east" | "us-west" | "eu" | "ap" | "in";

/**
 * The resource kinds placed by region today: `project` is an app; `browser` in `us-east`, `eu` and
 * `ap`; `dict` and `queue` in `us-east`; `in` (India) places `machine` alone; the rest everywhere but `in`.
 */
type RegionKind =
  | "sandbox" | "agent" | "bucket" | "database" | "project" | "machine" | "browser" | "dict" | "queue";

type JsonObject = { [key: string]: unknown };
```

## regions

```typescript
function regions(
  options?: { kind?: RegionKind; client?: NoClick },
): Promise<Region[]>
```

Every region, or those that place `kind` (another kind throws `InvalidRequest` naming those
that are). Dicts and queues are kept in `us-east` only for now, and browsers run everywhere but
`us-west`. Your account's default is set in the console. Needs the scope of any kind it places:
`sandboxes`, `agents`, `storage`, `databases`, `apps`, `machines`, `browsers`, `dicts`, `queues` or
`volumes`.

    const where = await regions({ kind: "agent" });

Parameters:

- `options.client` (`NoClick`): The client to send with; defaults to the module client built from `NOCLICK_API_KEY`.
- `options.kind` (`RegionKind`)

Returns: Each region's `name` (what `region=` takes), its `label` and `location`, the
`kinds` it places, and whether it's your account's `default`.

Types:

```typescript
/**
 * The resource kinds placed by region today: `project` is an app; `browser` in `us-east`, `eu` and
 * `ap`; `dict` and `queue` in `us-east`; `in` (India) places `machine` alone; the rest everywhere but `in`.
 */
type RegionKind =
  | "sandbox" | "agent" | "bucket" | "database" | "project" | "machine" | "browser" | "dict" | "queue";
```
