---
title: Detached
description: What another process needs to adopt a VM handed off by sandbox.detach().
---

What another process needs to adopt a VM handed off by `sandbox.detach()`.

Pass the fields to `Sandbox.adopt(region, microvmId, endpoint, agentToken, port)`. The
token is a method rather than a getter so it is never read by accident, and it is absent
from `toString()`; `JSON.stringify` of the instance carries nothing.

## Accessors

### endpoint

#### Get Signature

```ts
get endpoint(): string;
```

##### Returns

`string`

***

### microvmId

#### Get Signature

```ts
get microvmId(): string;
```

##### Returns

`string`

***

### port

#### Get Signature

```ts
get port(): number;
```

The daemon port the endpoint's proxy tokens are minted for.

##### Returns

`number`

***

### region

#### Get Signature

```ts
get region(): Region;
```

The region the VM runs in, ready to pass to `Sandbox.adopt`.

##### Returns

[`Region`](/microvms-agentd/reference/typescript/classes/region/)

## Methods

### agentToken()

```ts
agentToken(): string;
```

The VM's bearer credential; store it only privately.

#### Returns

`string`

***

### toObject()

```ts
toObject(): DetachedObject;
```

Every field, token included, for a private encrypted store.

#### Returns

[`DetachedObject`](/microvms-agentd/reference/typescript/interfaces/detachedobject/)

***

### toString()

```ts
toString(): string;
```

The record without its secret.

#### Returns

`string`

## Provenance

This page is generated from `bindings/microvms-js/index.d.ts` by TypeDoc 0.28.20 and typedoc-plugin-markdown 4.13.1, run from `site/scripts/gen-reference.mjs` on every `pnpm run sync`, so an edit made here is overwritten by the next run.

To change the page, change the doc comment in the binding's Rust source, then regenerate the declarations with `mise run dts`. `mise run dts:check` fails when the committed file no longer matches the source.