File Upload API

POST /files

Parameters

Parameter

Type

Description

Parameter

Type

Description

file

Binary

File content

meta.category

String

File category. This is to mark the usage of the attachments. For now the possible reasons are 'intake_attachment', 'user_consent', 'user_avatar', 'user_document'

X-ApiToken

String

The token of the user who is uploading the file. They will be considered the file owner.

Intake_attachment file type - these are per-visit files and will only be visible on the visit page.

User_document file type - these files (documents) are per user profile, they will be visible for patients under Documents page and providers also can view it on the patient’s page under Documents tab.

Response

curl -X POST \ https://api.vsee.io/cc/ligeng/api_v3/files \ -H 'X-ApiToken: 4df5b2b7dec8a8c40e142e43c1825502' \ -H 'cache-control: no-cache' \ -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \ -F file=@/Users/teligeng/Pictures/p878984.jpg \ -F meta.category=user_document { "data": { "id": "5e15d150-19b4-4cbd-b217-332fc71b6977", "name": "p878984.jpg", "size": 40679, "ext": "jpg", "fullpath": "https://api.vsee.io/cc/ligeng/files/view/5e15d150-19b4-4cbd-b217-332fc71b6977?auth_code=e86ceb8b57c91e4db41611f08311a125e2df0b09&time=1578488144", "meta": { "category": "user_document", "target": { "id": "350936", "type": "user" }, "account": { "code": "5c47c63907c44f0486a16e1dc71b6977" } }, "creator": { "id": "350936", "username": "ligeng+trial14+member01@vseelab.com", "email": "ligeng+trial14+member01@vseelab.com", "full_name": "Ligeng Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Name" } } }

POST /files/:id

Modify the document information. For now, only 'name' is allowed to be modified.

Parameters

Parameter

Type

Description

Parameter

Type

Description

name

String

File name

Response

curl -X POST \ https://api.vsee.io/cc/ligeng/api_v3/files/5e1598e7-4118-47ca-84da-0923c71b6977 \ -H 'X-ApiToken: 466c809667919d34d371d4c7d389392b' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -F name=test2.jpg { "data": { "id": "5e1598e7-4118-47ca-84da-0923c71b6977", "name": "test2.jpg", "size": 184259, "ext": "jpg", "fullpath": "https:\/\/api.vsee.io\/cc\/ligeng\/files\/view\/5e1598e7-4118-47ca-84da-0923c71b6977?auth_code=ed7e17f29a56cc8c4b2fec812a07e7d30f322b85&time=1579496452", "meta": { "target": { "id": "350936", "type": "user" }, "category": "user_document", "account": { "code": "5c47c63907c44f0486a16e1dc71b6977" } }, "created": 1578473704 } }

DELETE /files/:id

Parameters

Parameter

Type

Description

Parameter

Type

Description

id

String

File id

Response

curl -X DELETE -H "X-ApiToken: c18e9874dccd26482e191f3d7b57d3d8" -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" -F "file=@" "https://api.vsee.me/api_v3/files/57aa6ede-bf6c-4a88-81e1-6bcdac1f0144" -k { "data": true }

GET /files

Retrieve file list

Parameters

Parameter

Type

Description

Parameter

Type

Description

target_id

String

The id of the target which is related to the files. Should be equal to user_id if target_type is user or visit_id if target_type is visit.

target_type

String user | visit

The file of the target which is related to the files. For now the possible values are 'user' and 'visit'

category_type

String

The category type of this file. For now the possible reasons are 'user_document', 'intake_attachment', 'user_consent', 'user_avatar'.

include_shared

Boolean true|false

Include this param will get all the files that tagged user_document and notes files that shared to the user.

Response

GET /files/:id

Retrieve file info including the download link.

Parameters

Parameter

Type

Description

Parameter

Type

Description

:id

String

File id. E.g. _id from Intake attachments array, etc.

Response

data.fullpath - the link to download the file (see https://developers.vsee.com/wiki/spaces/VD/pages/15302716/File+Upload+API#GET-/files/view/:id )

GET /files/view/:id

Download the file itself.

Parameters

Parameter

Type

Description

Parameter

Type

Description

:id

String

File id. E.g. _id from Intake attachments array, etc.

auth_code

String

Auth code returned by other API method

time

String

Timestamp as returned by other API method

size

String

(optional) Resized image dimensions in {W}x{H} format. Example: 320x240. If the file is not image, this parameter will be ignored. Resized Image is always PNG format, Content-type: image/png header will be set in response

Response