---
title: "Store the working folder of a local mirror, so its chat can continue in the cloud without the computer [write]"
method: POST
path: "/sessions/{id}/mirror/environment"
---

# Store the working folder of a local mirror, so its chat can continue in the cloud without the computer \[write\]

`POST /sessions/{id}/mirror/environment`

## Request

- Base URL: `https://api.agentsky.dev/v1`
- URL: `https://api.agentsky.dev/v1/sessions/{id}/mirror/environment`
- Auth: HTTP bearer

Only for a session created with local_mirror, and only by its owner. Body {file_id, name, files}: file_id is a gzipped tar laid out as `<name>/…` that the owner uploaded to their personal files (POST /files/uploads without a workspace). It is copied into the session's private storage, checked against the upload's size and sha256 (422 environment_mismatch), and replaces the folder stored before; the same folder again is a no-op. The folder may hold secrets: it is never public, and it is restored into /workspace/<name> only in a continuation its owner starts. A file the caller did not upload personally answers 404; a session that is not a mirror 409 not_a_mirror_session, one already continued 409 continued_in_cloud, an archived one 410. Up to 2 GiB (413 archive_too_large). Nothing runs and nothing is billed.

## Path parameters

- `id` string, required

## Request body

- object
  - `file_id` string, required
  - `name` string, required: The folder's name: 1 to 80 letters, digits, spaces, dots, dashes or underscores
  - `files` integer, required

## Response `200`

Stored

- object
  - `sha256` string
  - `size_bytes` integer
  - `name` string
  - `files` integer
  - `staged_at` string, date-time

## Other responses

- `default`: Error — { error: { code, message, request_id } }

## Changes

- **2026-11-02** `e5e8f0229a99`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/agentsky/apis/agentsky-developer-api/changes/sessions/:id/mirror/environment/post.md)

---

[API](https://skmtc.dev/agentsky/apis/agentsky-developer-api.md) - [All operations](https://skmtc.dev/agentsky/apis/agentsky-developer-api/llms.txt) - [OpenAPI document](https://skmtc.dev/agentsky/apis/agentsky-developer-api/revisions/0d435187cd55?raw)
