# Share a saved snapshot

> Create its share code, returned as shareCode. Anyone holding it, in any team, can start a sandbox from this disk with from, paying their own start and machine time; you keep paying for the snapshot. Calling again returns the same code until it is revoked.

`POST https://api.zavu.dev/v1/sandbox-snapshots/{snapshotId}/share`

Create its share code, returned as `shareCode`. Anyone holding it, in any team, can start a sandbox from this disk with `from`, paying their own start and machine time; you keep paying for the snapshot. Calling again returns the same code until it is revoked.

## Parameters

- `snapshotId` (path, string, required): Saved snapshot ID.

## Responses

### 200

Shared.

- `snapshot` (object, required): A sandbox's disk frozen under a name. $0.07 per started UTC day while you keep it, charged from your balance; the first day at save, refunded if the save fails. At most 20 per team.
  - `id` (string, required)
  - `name` (string, required)
  - `status` (string, required): - `saving`: the disk is being captured. It cannot be started from or deleted yet. - `ready`: start sandboxes from it with `from`. - `failed`: the save did not finish; its first day was refunded. See `failureReason`. One of: `saving`, `ready`, `failed`.
  - `size` (string, required): Machine size, and its price per hour of machine time: - `small`: 2 vCPU, 4 GB RAM. $0.0225/h. - `default`: 4 vCPU, 8 GB RAM. $0.045/h. - `large`: 8 vCPU, 16 GB RAM. $0.09/h. One of: `small`, `default`, `large`.
  - `sizeBytes` (integer, nullable): Bytes on disk, once known.
  - `sourceSandboxId` (string, required): The sandbox whose disk this is.
  - `shareCode` (string, required, nullable): The code another team passes as `from` to start from this snapshot, while it is shared. Null when it is not. Treat it as a secret: whoever holds it can copy this disk.
  - `costTotal` (number, required): USD charged for it so far.
  - `failureReason` (string, nullable)
  - `createdAt` (string<date-time>, required)
  - `updatedAt` (string<date-time>, required)

### 401

Unauthorized.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 404

Snapshot not found, or it belongs to another project.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 409

`snapshot_not_ready`: only a ready snapshot can be shared.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

## Example

```bash
curl -X POST "https://api.zavu.dev/v1/sandbox-snapshots/snapshot_abc123/share" \
  -H "Authorization: Bearer $ZAVUDEV_API_KEY"
```

```typescript
import Zavudev from "@zavudev/sdk";

const zavu = new Zavudev({ apiKey: process.env.ZAVUDEV_API_KEY });

const result = await zavu.sandboxes.snapshots.share("snapshot_abc123");

console.log(result);
```
