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: 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.

Authorization

An API key is a token that you provide when making API calls. Include the token in a cookie parameter called asc_auth_key.

Example: asc_auth_key=864FE52C-1C1C-469F-9308-51DAFEFE7436.

Headers

Acceptenum of string

Can be one of: application/json, text/json, text/plain.

Content-Typeenum of string

Can be one of: application/json, application/*+json, text/json.

Path

folderIdintegerformat: int32required

Folder ID

Body

Session parameters

fileNamestring

File name

fileSizeintegerformat: int64

File length in bytes

relativePathstring

Relative path to the folder

createOnobject
utcTimestringformat: date-time

UtcTime

timeZoneOffsetstringformat: date-span

TimeZoneOffset

encryptedboolean

Specifies whether to encrypt a file or not

createNewIfExistboolean

Create new if exists

Examples

POST /api/2.0/files/%7Bfolderid%7D/upload/create_session HTTP/1.1
Accept: application/json
Content-Length: 235
Content-Type: application/json
Host: example.com

{
  "fileName": "some text",
  "fileSize": 1234,
  "relativePath": "some text",
  "createOn": {
    "utcTime": "2008-04-10T06:30:00.0000000+04:00",
    "timeZoneOffset": "00:00:00"
  },
  "encrypted": true,
  "createNewIfExist": true
}
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' \
  --data '{
  "fileName": "some text",
  "fileSize": 1234,
  "relativePath": "some text",
  "createOn": {
    "utcTime": "2008-04-10T06:30:00.0000000+04:00",
    "timeZoneOffset": "00:00:00"
  },
  "encrypted": true,
  "createNewIfExist": true
}'

Responses

200

Information about created session

401

Unauthorized

403

You don't have enough permission to create

Get Help

  • If you have any questions about ONLYOFFICE DocSpace, 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).