# 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

```typescript
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

```json
[
  {
    "children": [
      {}
    ],
    "contentType": "application/json",
    "mode": "123",
    "name": "my-file.json",
    "type": "file",
    "uid": "2d4aad419917f15b1146e9e03ddc9bb31747e4d0"
  }
]
```

## Authentication

**Authorization** bearer Token - Default authentication mechanism

## Path Parameters

- `id` string Required  
  The unique deployment identifier

## Query Parameters

- `teamId` string Optional  
  The Team identifier to perform the request on behalf of.

- `slug` string 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](/content/docs/rest-api/deployments/get-deployment-file-contents?from=graph&source_path=%2Fdocs%2Frest-api%2Fdeployments%2Flist-deployment-files&source_site=vercel-docs&relationship=semantic&surface=html/index.html) — GET /v8/deployments/{id}/files/{fileId} — Allows to retrieve the content of a file by supplying the file identifier.
- [Upload Deployment Files](/content/docs/rest-api/deployments/upload-deployment-files?from=graph&source_path=%2Fdocs%2Frest-api%2Fdeployments%2Flist-deployment-files&source_site=vercel-docs&relationship=semantic&surface=html/index.html) — POST /v2/files — Before you create a deployment you need to upload the required files for that deployment.
- [List deployments](/content/docs/rest-api/deployments/list-deployments?from=graph&source_path=%2Fdocs%2Frest-api%2Fdeployments%2Flist-deployment-files&source_site=vercel-docs&relationship=semantic&surface=html/index.html) — GET /v7/deployments — List deployments under the authenticated user or team.
- [Get deployment events](/content/docs/rest-api/deployments/get-deployment-events?from=graph&source_path=%2Fdocs%2Frest-api%2Fdeployments%2Flist-deployment-files&source_site=vercel-docs&relationship=semantic&surface=html/index.html) — GET /v3/deployments/{idOrUrl}/events — Get the build logs of a deployment by deployment ID and build ID.
- [Get logs for a deployment](/content/docs/rest-api/logs/get-logs-for-a-deployment?from=graph&source_path=%2Fdocs%2Frest-api%2Fdeployments%2Flist-deployment-files&source_site=vercel-docs&relationship=semantic&surface=html/index.html) — GET /v1/projects/{projectId}/deployments/{deploymentId}/runtime-logs — Returns a stream of logs for a given deployment.
