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

# Files

## POST /admin/api/v2/files/upload

> Upload File

```json
{"openapi":"3.0.1","info":{"title":"workfx","version":"1.0.0"},"tags":[{"name":"Files"}],"servers":[{"url":"https://api.workfx.ai","description":"Prod Env"}],"security":[],"paths":{"/admin/api/v2/files/upload":{"post":{"summary":"Upload File","deprecated":false,"description":"","operationId":"upload_file_admin_api_v2_files_upload_post","tags":["Files"],"parameters":[{"name":"tenant_id","in":"query","description":"Tenant Id","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Id","title":"Tenant Id"}},{"name":"tenant_unit_id","in":"query","description":"Tenant Unit ID","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Unit ID","title":"Tenant Unit Id"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary","title":"File","description":"Upload file"}},"required":["file"]}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadFileResponse"}}},"headers":{}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"headers":{}}}}}},"components":{"schemas":{"UploadFileResponse":{"properties":{"id":{"type":"string","title":"Id","description":"File id"},"tenant_id":{"type":"string","title":"Tenant Id","description":"Tenant id"},"tenant_unit_id":{"type":"string","title":"Tenant Unit Id","description":"Tenant unit id"},"name":{"type":"string","title":"Name","description":"File name"},"size":{"type":"integer","title":"Size","description":"File size"},"ext":{"type":"string","title":"Ext","description":"File ext"},"file_url":{"type":"string","title":"File Url","description":"File url"},"original_url":{"type":"string","title":"Original Url","description":"Original url"}},"type":"object","required":["id","tenant_id","tenant_unit_id","name","size","ext","file_url","original_url"],"title":"UploadFileResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"type":"object","properties":{}},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"}}}}
```

## GET /admin/api/v2/files/{file\_id}

> Preview File

```json
{"openapi":"3.0.1","info":{"title":"workfx","version":"1.0.0"},"tags":[{"name":"Files"}],"servers":[{"url":"https://api.workfx.ai","description":"Prod Env"}],"security":[],"paths":{"/admin/api/v2/files/{file_id}":{"get":{"summary":"Preview File","deprecated":false,"description":"","operationId":"preview_file_admin_api_v2_files__file_id__get","tags":["Files"],"parameters":[{"name":"file_id","in":"path","description":"File id","required":true,"schema":{"type":"string","description":"File id","title":"File Id"}},{"name":"expires","in":"query","description":"Expires","required":true,"schema":{"type":"string","description":"Expires","title":"Expires"}},{"name":"nonce","in":"query","description":"Nonce","required":true,"schema":{"type":"string","description":"Nonce","title":"Nonce"}},{"name":"sig","in":"query","description":"Sig","required":true,"schema":{"type":"string","description":"Sig","title":"Sig"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{}}}},"headers":{}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"headers":{}}}}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"type":"object","properties":{}},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"}}}}
```

## POST /admin/api/v2/files/remote-url/upload

> Remote Url Upload File

```json
{"openapi":"3.0.1","info":{"title":"workfx","version":"1.0.0"},"tags":[{"name":"Files"}],"servers":[{"url":"https://api.workfx.ai","description":"Prod Env"}],"security":[],"paths":{"/admin/api/v2/files/remote-url/upload":{"post":{"summary":"Remote Url Upload File","deprecated":false,"description":"","operationId":"remote_url_upload_file_admin_api_v2_files_remote_url_upload_post","tags":["Files"],"parameters":[{"name":"tenant_id","in":"query","description":"Tenant Id","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Id","title":"Tenant Id"}},{"name":"tenant_unit_id","in":"query","description":"Tenant Unit ID","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Unit ID","title":"Tenant Unit Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RemoteUrlFileRequest","description":"The remote url"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UploadFileResponse"}}},"headers":{}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"headers":{}}}}}},"components":{"schemas":{"RemoteUrlFileRequest":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"RemoteUrlFileRequest"},"UploadFileResponse":{"properties":{"id":{"type":"string","title":"Id","description":"File id"},"tenant_id":{"type":"string","title":"Tenant Id","description":"Tenant id"},"tenant_unit_id":{"type":"string","title":"Tenant Unit Id","description":"Tenant unit id"},"name":{"type":"string","title":"Name","description":"File name"},"size":{"type":"integer","title":"Size","description":"File size"},"ext":{"type":"string","title":"Ext","description":"File ext"},"file_url":{"type":"string","title":"File Url","description":"File url"},"original_url":{"type":"string","title":"Original Url","description":"Original url"}},"type":"object","required":["id","tenant_id","tenant_unit_id","name","size","ext","file_url","original_url"],"title":"UploadFileResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"type":"object","properties":{}},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"}}}}
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.workfx.ai/workfx-companion-agent-knowledge/developer-docs/api-reference/files.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
