Skip to content
Docs

Write files

POSThttps://api.vercel.com/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.
https://api.vercel.com/v2/sandboxes/sessions/{sessionId}/fs/write
const response = await fetch('https://api.vercel.com/v2/sandboxes/sessions/sessionId/fs/write?teamId=string&slug=string', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json',
},
});
const data = await response.json();
console.log(data);
Response
"value"
AuthorizationbearerToken

Default authentication mechanism

sessionIdstringRequired
The unique identifier of the session to write files to.
teamIdstringOptional
The Team identifier to perform the request on behalf of.
slugstringOptional
The Team slug to perform the request on behalf of.
x-cwdstringOptional
The target directory where the tarball contents will be extracted. If not specified, files are extracted to the sandbox home directory.
200The files were successfully written to the session.
400One of the provided values in the request query is invalid. One of the provided values in the headers is invalid
401The request is not authorized.
403You do not have permission to access this resource.
404Error
410Error
422Error
429Error
500Error