# 3.4.1-Offline Upload in Chatflow

## 1. Overview

* **Interface Name**: Support offline uploaded file parsing and flow processing
* **Version number**: v1.0.0

## 2. Information

* **Request method**: POST
* **Request URL**: https\://*DOMAIN*/openapi/v1/chatflow/offline\_upload\_file/
* **Domain**: *Refer to "Service address description"*

## 3. Request parameters

Request header http header field:

| Parameter name        | Type   | Required | Description |
| --------------------- | ------ | -------- | ----------- |
| cybertron-robot-key   | string | Yes      | Robot key   |
| cybertron-robot-token | string | Yes      | Robot token |

Request body field:

| Parameter name       | Type   | Required | Description                                                                                                                 |
| -------------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------- |
| mode                 | int    | no       | work mode 1: file upload mode 2: non file upload mode, default mode 1.                                                      |
| username             | string | Yes      | User account                                                                                                                |
| flow\_uuid           | string | Yes      | flow id                                                                                                                     |
| tenant\_name         | string | Yes      | tenant name, user self-defined, 'AiopsTest' for test, other needs add in backend                                            |
| extra\_params        | string | No       | extra params for store parsed content, as variable used in flow. Required in mode 1                                         |
| file                 | file   | No       | file for upload. Required in mode 1                                                                                         |
| file\_name           | string | No       | file name. Required in mode 1                                                                                               |
| file\_format         | string | No       | mainly support image type, value: "Image","".Required in mode 1                                                             |
| parse\_model         | string | No       | parse model for image, value:"Image Multimodal Model-7B", "Image Multimodal Model-72B", "gpt-4o", "ocr". Required in mode 1 |
| parse\_prompt        | string | No       | prompt for parse, ocr is not required. Required in mode 1                                                                   |
| inputs               | string | No       | variables for flow, json str format. For example: '{"aaa":111,"bbb":222}'                                                   |
| image\_source\_param | string | No       | source file variable in upload node                                                                                         |

## 4. Response field description

HTTP status code: 200 OK

Response field description:

| Field Name | Type   | Description                                                                                                                    |
| ---------- | ------ | ------------------------------------------------------------------------------------------------------------------------------ |
| code       | string | "000000" is normal, other exceptions                                                                                           |
| message    | string | Status description                                                                                                             |
| data       | object | message body                                                                                                                   |
| +id        | int    | file id                                                                                                                        |
| +status    | string | file status; 1:uploading 2:upload finish 3:upload failed 4:parsing 5: parse finish 6:parse failed 7:flow success 8:flow failed |

##

## 5. Example

Request Example:

```bash
curl --location 'https://_DOMAIN_/openapi/v1/chatflow/offline_upload_file/' \
--header 'cybertron-robot-key: qN7xiUN*******dg%3D' \
--header 'cybertron-robot-token: MTczMjc********aWJZbVZIWHA2S3gzRy9wT1U9' \
--header 'username: me@host.com' \
--form 'flow_uuid="xxxxxxx"' \
--form 'tenant_name="1111111"' \
--form 'file=@"/C:/Users/aaa/Desktop/test/audio/820033.wav"' \
--form 'file_name="820033.wav"' \
--form 'extra_params="aaa"'
```

Response example:

```json
{
    "code": "000000",
    "message": "ok",
    "data": {
        "id": 6,
        "status": 4
    }
}
```
