# POST /files URL: https://developers.vsee.io/api/file-upload-api/post/files Auth: User Token — Requires a user access token from login or SSO. Upload file Upload a file with optional metadata ### File Categories (`meta.category`) - `intake_attachment` — Per-visit files, only visible on the visit page. - `user_consent` — User consent documents. - `user_avatar` — User profile picture. - `user_document` — Per-user profile documents, visible under the patient's Documents page and provider's Documents tab. ### Uploading on Behalf of a Patient When using a clinic/admin token to upload for a patient, include: - `meta.target.id` — The patient's user ID - `meta.target.type` — Set to `user` **Example (upload for patient):** ``` curl -X POST https://api.vseepreview.com/api_v3/files \ -H 'X-ApiToken: {admin_token}' \ -H 'X-AccountCode: {account_code}' \ -F file=@/path/to/file.png \ -F meta.target.id=20002340748 \ -F meta.target.type=user \ -F meta.category=user_document ``` Parameters: - X-ApiToken (header, string, required) — API token - X-AccountCode (header, string, required) — Account code Request body (multipart/form-data): - file (string, required) — Binary file content - meta.title (string, optional) — File title - meta.description (string, optional) — File description - meta.target.id (string, optional) — Target ID (user ID or visit ID). Required if uploading for someone else - meta.target.type (string, optional) — Target type (user or visit). Required if uploading for someone else - meta.category (string, optional) — File category (intake_attachment, user_consent, user_avatar, user_document) Example request: ```json { "file": "binary", "meta.title": "string", "meta.description": "string", "meta.target.id": "string", "meta.target.type": "string", "meta.category": "string" } ``` Responses: - 200 — Successful upload ```json { "data": { "id": "5e15d150-19b4-4cbd-b217-332fc71b6977", "name": "p878984.jpg", "size": 40679, "ext": "jpg", "fullpath": "https://vclinic.vseepreview.com/files/view/5e15d150-19b4-4cbd-b217-332fc71b6977?auth_code=e86ceb8b57c91e4db41611f08311a125e2df0b09&time=1578488144", "meta": { "category": "user_document", "target": { "id": "350936", "type": "user" }, "account": { "code": "vclinic" } }, "creator": { "id": "350936", "username": "test+member01@test.com", "email": "test+member01@test.com", "full_name": "Test User" } } } ```