> For the complete documentation index, see [llms.txt](https://docs.bugbug.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bugbug.io/public-api-reference/files.md).

# Files

## List project files

> Returns uploaded files from the project's Files library.

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"PaginatedV2ProjectFileList":{"type":"object","required":["count","results"],"properties":{"count":{"type":"integer"},"next":{"type":"string","nullable":true,"format":"uri"},"previous":{"type":"string","nullable":true,"format":"uri"},"results":{"type":"array","items":{"$ref":"#/components/schemas/V2ProjectFile"}}}},"V2ProjectFile":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"name":{"type":"string","readOnly":true},"extension":{"type":"string","readOnly":true},"size":{"type":["integer","null"],"readOnly":true},"url":{"type":"string"},"folderId":{"type":["string","null"],"format":"uuid"},"testsCount":{"type":"integer","readOnly":true,"default":0},"created":{"type":"string","format":"date-time","readOnly":true},"modified":{"type":"string","format":"date-time","readOnly":true}},"required":["created","extension","folderId","id","modified","name","size","testsCount","url"]}}},"paths":{"/api/v2/projects/{project_pk}/files/":{"get":{"operationId":"v2_projects_files_list","description":"Returns uploaded files from the project's Files library.","summary":"List project files","parameters":[{"in":"query","name":"extension","schema":{"type":"string"},"description":"Comma-separated list of extensions, e.g. `pdf,png`."},{"in":"query","name":"folderId","schema":{"type":"string"},"description":"Only files placed directly in this folder (kind `file`)."},{"in":"query","name":"noFolder","schema":{"type":"boolean"},"description":"Only files placed in the root (without a folder)."},{"in":"query","name":"ordering","schema":{"type":"string","enum":["-created","-extension","-name","-size","created","extension","name","size"]},"description":"Sort field. Prefix with `-` for descending order."},{"in":"query","name":"page","schema":{"type":"integer"},"description":"Page number."},{"in":"query","name":"page_size","schema":{"type":"integer"},"description":"Number of files per page (max 100)."},{"in":"query","name":"pagination","schema":{"type":"string"},"description":"Set to `off` to return all files without pagination."},{"in":"path","name":"project_pk","schema":{"type":"string","format":"uuid"},"required":true},{"in":"query","name":"query","schema":{"type":"string"},"description":"Case-insensitive search by file name."},{"in":"query","name":"recursive","schema":{"type":"boolean"},"description":"With `folderId`, also include files from nested folders."}],"tags":["Files"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedV2ProjectFileList"}}},"description":""},"401":{"description":"Authentication credentials were not provided."},"404":{"description":"Project or file not found."}}}}}}
```

## Upload project file

> Uploads a file to the project's Files library. The returned \`id\` can be used as \`projectArtifactId\` of an \`uploadFile\` step. The maximum file size is 10 MB.

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"V2ProjectFileUpload":{"type":"object","properties":{"file":{"type":"string","format":"uri"},"name":{"type":"string","default":"","maxLength":255},"folderId":{"type":["string","null"],"format":"uuid"}},"required":["file"]},"V2ProjectFile":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"name":{"type":"string","readOnly":true},"extension":{"type":"string","readOnly":true},"size":{"type":["integer","null"],"readOnly":true},"url":{"type":"string"},"folderId":{"type":["string","null"],"format":"uuid"},"testsCount":{"type":"integer","readOnly":true,"default":0},"created":{"type":"string","format":"date-time","readOnly":true},"modified":{"type":"string","format":"date-time","readOnly":true}},"required":["created","extension","folderId","id","modified","name","size","testsCount","url"]}}},"paths":{"/api/v2/projects/{project_pk}/files/":{"post":{"operationId":"v2_projects_files_create","description":"Uploads a file to the project's Files library. The returned `id` can be used as `projectArtifactId` of an `uploadFile` step. The maximum file size is 10 MB.","summary":"Upload project file","parameters":[{"in":"path","name":"project_pk","schema":{"type":"string","format":"uuid"},"required":true}],"tags":["Files"],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/V2ProjectFileUpload"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2ProjectFile"}}},"description":""},"400":{"description":"File too large or invalid folder."},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Project or file not found."}}}}}}
```

## GET /api/v2/projects/{project\_pk}/files/{id}/

> Get project file

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"V2ProjectFile":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"name":{"type":"string","readOnly":true},"extension":{"type":"string","readOnly":true},"size":{"type":["integer","null"],"readOnly":true},"url":{"type":"string"},"folderId":{"type":["string","null"],"format":"uuid"},"testsCount":{"type":"integer","readOnly":true,"default":0},"created":{"type":"string","format":"date-time","readOnly":true},"modified":{"type":"string","format":"date-time","readOnly":true}},"required":["created","extension","folderId","id","modified","name","size","testsCount","url"]}}},"paths":{"/api/v2/projects/{project_pk}/files/{id}/":{"get":{"operationId":"v2_projects_files_retrieve","summary":"Get project file","parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid"},"description":"A UUID string identifying this project artifact.","required":true},{"in":"path","name":"project_pk","schema":{"type":"string","format":"uuid"},"required":true}],"tags":["Files"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2ProjectFile"}}},"description":""},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Project or file not found."}}}}}}
```

## Delete project file

> Deletes the file. \`uploadFile\` steps using it are kept but lose their file.

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}}},"paths":{"/api/v2/projects/{project_pk}/files/{id}/":{"delete":{"operationId":"v2_projects_files_destroy","description":"Deletes the file. `uploadFile` steps using it are kept but lose their file.","summary":"Delete project file","parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid"},"description":"A UUID string identifying this project artifact.","required":true},{"in":"path","name":"project_pk","schema":{"type":"string","format":"uuid"},"required":true}],"tags":["Files"],"responses":{"204":{"description":"No response body"},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Project or file not found."}}}}}}
```

## PATCH /api/v2/projects/{project\_pk}/files/{id}/

> Rename or move project file

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"PatchedV2ProjectFileUpdate":{"type":"object","properties":{"name":{"type":"string","maxLength":255},"folderId":{"type":["string","null"],"format":"uuid"}}},"V2ProjectFile":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"name":{"type":"string","readOnly":true},"extension":{"type":"string","readOnly":true},"size":{"type":["integer","null"],"readOnly":true},"url":{"type":"string"},"folderId":{"type":["string","null"],"format":"uuid"},"testsCount":{"type":"integer","readOnly":true,"default":0},"created":{"type":"string","format":"date-time","readOnly":true},"modified":{"type":"string","format":"date-time","readOnly":true}},"required":["created","extension","folderId","id","modified","name","size","testsCount","url"]}}},"paths":{"/api/v2/projects/{project_pk}/files/{id}/":{"patch":{"operationId":"v2_projects_files_partial_update","summary":"Rename or move project file","parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid"},"description":"A UUID string identifying this project artifact.","required":true},{"in":"path","name":"project_pk","schema":{"type":"string","format":"uuid"},"required":true}],"tags":["Files"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/PatchedV2ProjectFileUpdate"}},"application/json":{"schema":{"$ref":"#/components/schemas/PatchedV2ProjectFileUpdate"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2ProjectFile"}}},"description":""},"400":{"description":"Request body failed validation."},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Project or file not found."}}}}}}
```

## GET /api/v2/projects/{project\_pk}/files/{id}/download/

> Download project file

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}}},"paths":{"/api/v2/projects/{project_pk}/files/{id}/download/":{"get":{"operationId":"v2_projects_files_download_retrieve","summary":"Download project file","parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid"},"description":"A UUID string identifying this project artifact.","required":true},{"in":"path","name":"project_pk","schema":{"type":"string","format":"uuid"},"required":true}],"tags":["Files"],"responses":{"200":{"content":{"application/json":{"schema":{"type":"string","format":"binary"}}},"description":"File content."},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Project or file not found."}}}}}}
```

## Get project file usage

> Returns the number of steps and the tests that use the file.

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"V2ProjectFileUsage":{"type":"object","properties":{"stepsCount":{"type":"integer"},"tests":{"type":"array","items":{"$ref":"#/components/schemas/ProjectFileUsageTest"}}},"required":["stepsCount","tests"]},"ProjectFileUsageTest":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]}}},"paths":{"/api/v2/projects/{project_pk}/files/{id}/usage/":{"get":{"operationId":"v2_projects_files_usage_retrieve","description":"Returns the number of steps and the tests that use the file.","summary":"Get project file usage","parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid"},"description":"A UUID string identifying this project artifact.","required":true},{"in":"path","name":"project_pk","schema":{"type":"string","format":"uuid"},"required":true}],"tags":["Files"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2ProjectFileUsage"}}},"description":""},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Project or file not found."}}}}}}
```

## POST /api/v2/projects/{project\_pk}/files/bulk-delete/

> Delete multiple project files

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"V2ProjectFileBulk":{"type":"object","properties":{"fileIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":500}},"required":["fileIds"]},"V2ProjectFileBulkDeleteResult":{"type":"object","properties":{"deleted":{"type":"integer"},"stepsAffected":{"type":"integer"}},"required":["deleted","stepsAffected"]}}},"paths":{"/api/v2/projects/{project_pk}/files/bulk-delete/":{"post":{"operationId":"v2_projects_files_bulk_delete_create","summary":"Delete multiple project files","parameters":[{"in":"path","name":"project_pk","schema":{"type":"string","format":"uuid"},"required":true}],"tags":["Files"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/V2ProjectFileBulk"}},"application/json":{"schema":{"$ref":"#/components/schemas/V2ProjectFileBulk"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2ProjectFileBulkDeleteResult"}}},"description":""},"400":{"description":"Request body failed validation."},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```

## Move multiple project files to a folder

> Pass \`folderId: null\` to move files to the root.

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"V2ProjectFileBulkMove":{"type":"object","properties":{"fileIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":500},"folderId":{"type":["string","null"],"format":"uuid"}},"required":["fileIds","folderId"]},"V2ProjectFileBulkMoveResult":{"type":"object","properties":{"moved":{"type":"integer"}},"required":["moved"]}}},"paths":{"/api/v2/projects/{project_pk}/files/bulk-move/":{"post":{"operationId":"v2_projects_files_bulk_move_create","description":"Pass `folderId: null` to move files to the root.","summary":"Move multiple project files to a folder","parameters":[{"in":"path","name":"project_pk","schema":{"type":"string","format":"uuid"},"required":true}],"tags":["Files"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/V2ProjectFileBulkMove"}},"application/json":{"schema":{"$ref":"#/components/schemas/V2ProjectFileBulkMove"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2ProjectFileBulkMoveResult"}}},"description":""},"400":{"description":"Request body failed validation."},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```

## GET /api/v2/projects/{project\_pk}/files/extensions/

> List file extensions used in the project

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}}},"paths":{"/api/v2/projects/{project_pk}/files/extensions/":{"get":{"operationId":"v2_projects_files_extensions_retrieve","summary":"List file extensions used in the project","parameters":[{"in":"path","name":"project_pk","schema":{"type":"string","format":"uuid"},"required":true}],"tags":["Files"],"responses":{"200":{"content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}},"description":""},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.bugbug.io/public-api-reference/files.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
