Drive
Upload a file
POST/api/v1/drive/files
Who can use this: Any signed-in accountAs Markdown
The body is a multipart form, the kind a browser sends, with the file in a field named file; the name it has there becomes its name in Drive. Drive works out the real type from the contents, whatever the upload claims. Fine for everyday files; for a big one, or over a shaky connection, use Start a big upload instead. homelab-cli switches to that for files over 8 MiB.
Parameters
| Name | Where | What it is |
|---|---|---|
| file required | body | The file itself, as a multipart form field (with cURL, -F file=@notes.txt). |
| folder_id | body | A form field naming the folder to put it in. Leave it out for the top level. |
| client_mtime | body | A form field with the file's own date, in seconds since 1970, so a search by date finds it (or client_mtime_ms, in milliseconds). A date before 1990, or more than a day ahead, is ignored. |
Good to know
- With no file field the answer is 400, and a folder that isn't yours answers 404.
- An upload that would take you past your storage limit is refused with 413.