---
title: "History · intentic sandbox API"
description: "Saved states of the whole workspace, and putting one back. Every route in the history group of the intentic sandbox API, with its input, its answer and a playground."
url: "https://intentic.dev/api/history/"
---

The workspace

# History

Saved states of the whole workspace, and putting one back

**On this page (4 sections)**

- [Points you can go back to](#history-list)
- [What changed since a saved point](#history-diff)
- [One file's before and after across a saved point](#history-fileDiff)
- [Put the workspace back](#history-restore)

The points the sandbox saves as work happens, what changed between one and the next, one file's two sides, and restoring from one.

**GET`/history/snapshots` Points you can go back to**

The saved states of the whole workspace, taken automatically as work happens. This is the timeline behind undoing a change that was never committed.

### What you send

Nothing. Call it as it is.

### What comes back

| Field | Type |
| --- | --- |
| `snapshots` Every point you can go back… | object[] |
| `id` The saved point's id, which is… | string |
| `at` When it was taken, in milliseconds | number |
| `trigger` What caused it | "turn" | "interval" | "pre-restore" | "restore" … (5) |
| `label` What to call it | string |

Try it answered in this tab

curl

```bash
curl "$SANDBOX/history/snapshots" \
 -H "x-intentic-control: $INTENTIC_TOKEN"
```

TypeScript

```typescript
import { sandbox } from "@intentic/sandbox-client";

const result = await sandbox.history.list();
```

**GET`/history/diff` What changed since a saved point**

The files that differ between one saved point and the one before it, taking in everything that happened in between.

### What you send

| Field | Type | Where |
| --- | --- | --- |
| `id` required Which saved point | string | query |

### What comes back

| Field | Type |
| --- | --- |
| `changes` Everything that differs between this saved… | object[] |
| `scope` Which part of the workspace the… | string |
| `path` The path, relative to that scope | string |
| `status` What happened to it | "added" | "modified" | "deleted" | "type-changed" |

Try it answered in this tab

curl

```bash
curl "$SANDBOX/history/diff?id=a1b2c3d4" \
 -H "x-intentic-control: $INTENTIC_TOKEN"
```

TypeScript

```typescript
import { sandbox } from "@intentic/sandbox-client";

const result = await sandbox.history.diff({
 "id": "a1b2c3d4"
});
```

**GET`/history/file-diff` One file's before and after across a saved point**

Both sides of a single file at one point in the timeline.

### What you send

| Field | Type | Where |
| --- | --- | --- |
| `id` required Which saved point | string | query |
| `scope` required Which part of the workspace the… | string | query |
| `path` required The file, relative to that scope | string | query |

### What comes back

| Field | Type |
| --- | --- |
| `before` The whole file as it was | string |
| `after` The whole file as it is… | string |
| `binary` The file is not text, so… | boolean |
| `truncated` The file was too large to… | boolean |

Try it answered in this tab

curl

```bash
curl "$SANDBOX/history/file-diff?id=a1b2c3d4&scope=read&path=src%2Fapp.ts" \
 -H "x-intentic-control: $INTENTIC_TOKEN"
```

TypeScript

```typescript
import { sandbox } from "@intentic/sandbox-client";

const result = await sandbox.history.fileDiff({
 "id": "a1b2c3d4",
 "scope": "read",
 "path": "src/app.ts"
});
```

**POST`/history/restore` Put the workspace back**

Returns every file to how it stood at a saved point. This restores the files; moving a branch is a different thing and lives with the git calls.

### What you send

| Field | Type | Where |
| --- | --- | --- |
| `id` required Which saved point | string | body |

### What comes back

| Field | Type |
| --- | --- |
| `ok` Always true | true |

Try it answered in this tab

curl

```bash
curl -X POST "$SANDBOX/history/restore" \
 -H "x-intentic-control: $INTENTIC_TOKEN" \
 -H "content-type: application/json" \
 -d '{"id":"a1b2c3d4"}'
```

TypeScript

```typescript
import { sandbox } from "@intentic/sandbox-client";

const result = await sandbox.history.restore({
 "id": "a1b2c3d4"
});
```

More in The workspace

[Previous ← Git](https://intentic.dev/api/git/)[Next Chores →](https://intentic.dev/api/chores/)
