Chunked upload

POST /api/2.0/files/{folderId}/upload/create_session

Request

Creates a session to upload large files in multiple chunks to the folder with the ID specified in the request.

Note: Each chunk can have different length but the length should be multiple of 512 and greater or equal to 10 mb. Last chunk can have any size. After the initial response to the request with the 200 OK status, you must get the location field value from the response. Send all your chunks to this location. Each chunk must be sent in the exact order the chunks appear in the file. After receiving each chunk, the server will respond with the current information about the upload session if no errors occurred. When the number of bytes uploaded is equal to the number of bytes you sent in the initial request, the server responds with the 201 Created status and sends you information about the uploaded file.

Headers

Acceptenum of string

Can be one of: application/json.

Content-Typeenum of string

Can be one of: application/json.

Path

folderIdstring

Folder ID

Body

fileNamestring

File name

fileSizeinteger

File length in bytes

relativePathstring

Relative path to the folder

encryptedboolean

Specifies whether to encrypt a file or not

Examples

POST /api/2.0/files/%7BfolderId%7D/upload/create_session HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: example.com
curl --request POST \
  --url https://example.com/api/2.0/files/%7BfolderId%7D/upload/create_session \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json'

Responses

200

Information about created session which includes:

  • id: unique ID of this upload session
  • created: UTC time when the session was created
  • expired: UTC time when the session will expire if no chunks are sent before that time
  • location: URL where you should send your next chunk
  • bytes_uploaded: number of bytes uploaded for the specific upload ID
  • bytes_total: total number of bytes which will be uploaded

Get Help

  • If you have any questions about ONLYOFFICE Workspace, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).