Sandboxes
Write a file into the sandbox. Accepts two body shapes — the SDK picks one based on `Content-Type`:
- application/json (temps-native): {path, contents_b64, mode} — one file, base64-encoded.
- application/gzip (@vercel/sandbox): a gzipped tarball of one-or-more entries, with the target extract dir carried in the x-cwd header. The SDK's writeFile and writeFiles both post here; they differ only in how many entries the tarball contains.
Why merge them on one route: the SDK is hardcoded to POST /fs/write, so splitting tar uploads onto a separate path would force us to break SDK compat. Instead we dispatch on Content-Type, preserve JSON for native callers, and add tar for SDK callers.
post/v1/sandboxes/{id}/fs/write
Request
- Base URL: /api (relative, and the document was published on a file host, not at the API’s origin)
- URL: /api/v1/sandboxes/{id}/fs/write
- Auth: HTTP bearer
Path parameters
idstring required
Request body
Response
File(s) written
Changes
No recorded changes to this operation across all 53 revisions of this API.