Skip to main content

files

Creates, updates, deletes, gets or lists a files resource.

Overview

Namefiles
TypeResource
Idvercel.deployments.files

Fields

The following fields are returned by SELECT queries:

Retrieved the file tree successfully

NameDatatypeDescription
namestringThe name of the file tree entry (example: my-file.json)
childrenarrayThe list of children files of the directory (only valid for the directory type)
contentTypestringThe content-type of the file (only valid for the file type) (example: application/json)
modenumberThe file "mode" indicating file type and permissions.
symlinkstringNot currently used. See file-list-to-tree.ts.
typestringString indicating the type of file tree entry. (example: file)
uidstringThe unique identifier of the file (only valid for the file type) (example: 2d4aad419917f15b1146e9e03ddc9bb31747e4d0)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_deployment_filesselectid, teamIdAllows to retrieve the file structure of a deployment by supplying the deployment unique identifier.
upload_fileexecteamIdContent-Length, x-vercel-digest, x-now-digest, x-now-sizeBefore you create a deployment you need to upload the required files for that deployment. To do it, you need to first upload each file to this endpoint. Once that's completed, you can create a new deployment with the uploaded files. The file content must be placed inside the body of the request. In the case of a successful response you'll receive a status code 200 with an empty body.
get_deployment_file_contentsexecid, fileId, teamIdpathAllows to retrieve the content of a file by supplying the file identifier and the deployment unique identifier. The response body will contain the raw content of the file.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
fileIdstringThe unique file identifier
idstringThe unique deployment identifier
teamIdstringThe Team identifier or slug to perform the request on behalf of.
Content-LengthnumberThe file size in bytes
pathstringPath to the file to fetch (only for Git deployments)
x-now-digeststringThe file SHA1 used to check the integrity
x-now-sizenumberThe file size as an alternative to Content-Length
x-vercel-digeststringThe file SHA1 used to check the integrity

SELECT examples

Allows to retrieve the file structure of a deployment by supplying the deployment unique identifier.

SELECT
name,
children,
contentType,
mode,
symlink,
type,
uid
FROM vercel.deployments.files
WHERE id = '{{ id }}' -- required
AND teamId = '{{ teamId }}' -- required
;

Lifecycle Methods

Before you create a deployment you need to upload the required files for that deployment. To do it, you need to first upload each file to this endpoint. Once that's completed, you can create a new deployment with the uploaded files. The file content must be placed inside the body of the request. In the case of a successful response you'll receive a status code 200 with an empty body.

EXEC vercel.deployments.files.upload_file 
@teamId='{{ teamId }}' --required,
@Content-Length='{{ Content-Length }}',
@x-vercel-digest='{{ x-vercel-digest }}',
@x-now-digest='{{ x-now-digest }}',
@x-now-size='{{ x-now-size }}'
;