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

# Write files

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

## Request

- Base URL: `https://api.vercel.com`
- URL: `https://api.vercel.com/v2/sandboxes/sessions/{sessionId}/fs/write`
- Auth: HTTP bearer

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`

## Changes

- **2026-10-23** `0ab54ee1bd2e`: 1 info
  - removed the non-success response with the status `500`
- **2026-09-01** `606993b34ea5`: 1 warning, 1 info
  - deleted the `header` request parameter `'x-Cwd'`
  - added the new optional `header` request parameter `x-cwd`
- **2026-06-11** `14b4658f819e`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/vercel/apis/vercel-api/changes/v2/sandboxes/sessions/:sessionId/fs/write/post.md)

---

[API](https://skmtc.dev/vercel/apis/vercel-api.md) - [All operations](https://skmtc.dev/vercel/apis/vercel-api/llms.txt) - [OpenAPI document](https://skmtc.dev/vercel/apis/vercel-api/revisions/60686c0e1f6a?raw)
