---
title: "Write files"
method: POST
path: "/v2/sandboxes/sessions/{sessionId}/fs/write"
tags: ["sandboxes"]
---

# Write files

`POST /v2/sandboxes/sessions/{sessionId}/fs/write`

Uploads and extracts files to a session's filesystem. Files must be uploaded as a gzipped tarball (`.tar.gz`) with the `Content-Type` header set to `application/gzip`. The tarball contents are extracted to the session's working directory, or to a custom directory specified via the `x-cwd` header.

## Path parameters

- `sessionId` string, required — The unique identifier of the session to write files to.

## Query parameters

- `teamId` string
- `slug` string

## Headers

- `'x-Cwd'` string — The target directory where the tarball contents will be extracted. If not specified, files are extracted to the sandbox home directory.

## Response `200`

The files were successfully written to the session.

- object

## Other responses

- `400` — One of the provided values in the request query is invalid. One of the provided values in the headers is invalid
- `401` — The request is not authorized.
- `403` — You do not have permission to access this resource.
- `404`
- `410`
- `422`
- `429`
- `500`

---

[API](https://skmtc.net/vercel/apis/api.md) · [All operations](https://skmtc.net/vercel/apis/api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/vercel/api/versions/b4d86a3e3479/schema)
