POST/user/files/upload

Upload a single file to user storage

Uploads a single file to the authenticated user's storage by sending the file as the raw request body. Supply the URL-encoded full file path in path; an existing file with the same name is overwritten. Use X-SFTPGO-MTIME to provide the file modification time in Unix timestamp milliseconds.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

3 parameters
pathstringrequired
URL-encoded full path for the file to upload. The parent directory must exist unless `mkdir_parents` is used to create it.
mkdir_parentsbooleanoptional
Whether to create parent directories that do not exist.
X-SFTPGO-MTIMEintegeroptional
File modification time as a Unix timestamp in milliseconds.

8 status codes
201Returns an object containing a message and, if applicable, an error description.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
400Returned when the request is invalid.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
401Returned when the request is unauthorized.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
403Returned when access to the upload location is forbidden.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
413Returned when the maximum allowed upload size is exceeded.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
429Returned when the request limit is exceeded; you can retry the request later.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
500Returned when an internal server error occurs.
errorstringoptional
error description if any
messagestringoptional
message, can be empty
defaultUnexpected Error
errorstringoptional
error description if any
messagestringoptional
message, can be empty

Error handling

The path query parameter must be URL encoded and identify the full file path; its parent directory must exist unless you use the mkdir_parents query parameter to create missing parent directories. Send the file as the raw request body, not as multipart form data. A 400 is returned for a bad request, a 401 when the request is unauthorized, a 403 when access is forbidden, a 413 when the maximum allowed size is exceeded, a 429 when the request limit is exceeded, and a 500 for an internal server error.