List Deployment Files | Vercel REST API
List Deployment Files
GET https://api.vercel.com/v6/deployments/{id}/files
Allows to retrieve the file structure of the source code of a deployment by supplying the deployment unique identifier. If the deployment was created with the Vercel CLI or the API directly with the files key, it will have a file tree that can be retrievable.
TypeScript Example
const response = await fetch('https://api.vercel.com/v6/deployments/id/files?teamId=string&slug=string', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
'Content-Type': 'application/json',
},
});
const data = await response.json();
console.log(data);
Response
[
{
"children": [
{}
],
"contentType": "application/json",
"mode": "123",
"name": "my-file.json",
"type": "file",
"uid": "2d4aad419917f15b1146e9e03ddc9bb31747e4d0"
}
]
Authentication
Authorization bearer Token - Default authentication mechanism
Path Parameters
idstring Required
The unique deployment identifier
Query Parameters
teamIdstring Optional
The Team identifier to perform the request on behalf of.slugstring Optional
The Team slug to perform the request on behalf of.
Response Codes
- 200 Retrieved the file tree successfully
- 400 One of the provided values in the request query is invalid.
- 401 The request is not authorized.
- 403 You do not have permission to access this resource.
- 404 File tree not found / Deployment not found
Related Vercel Documentation
- Get Deployment File Contents — GET /v8/deployments/{id}/files/{fileId} — Allows to retrieve the content of a file by supplying the file identifier.
- Upload Deployment Files — POST /v2/files — Before you create a deployment you need to upload the required files for that deployment.
- List deployments — GET /v7/deployments — List deployments under the authenticated user or team.
- Get deployment events — GET /v3/deployments/{idOrUrl}/events — Get the build logs of a deployment by deployment ID and build ID.
- Get logs for a deployment — GET /v1/projects/{projectId}/deployments/{deploymentId}/runtime-logs — Returns a stream of logs for a given deployment.