> 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-1.1.x-english/developer-docs/api-reference/files.md).

# Files

Manage files used by agents or users. These endpoints support file uploads, previews, and importing files directly from URLs.

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

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

```
GET https://docs.workfx.ai/workfx-1.1.x-english/developer-docs/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.
