Skip to main content

POST /initialize_file_upload

Initializes chunked video upload in Core API. This is step 1 of 3 in the upload flow:

  1. initialize_file_upload
  2. send_file_chunk (repeat for all chunks)
  3. finalize_file_upload

Please note that a good tool for splitting your video file into chunks is the Linux program split that is used as follows:

split -d --bytes=4194304 supervideo.mp4 supervideo.mp4.chunk

The above command creates the files supervideo.mp4.chunk00, supervideo.mp4.chunk01, supervideo.mp4.chunk02 with a size of 4194304 bytes and the file supervideo.mp4.chunk03 (last chunk) with a size of 157927 bytes.

Endpoint

POST https://api-eu.valossa.com/core/1.0/initialize_file_upload

Content Type

Use multipart/form-data.

Form Fields

FieldTypeRequiredDescription
api_keystringYesYour Valossa API key
file_size_bytesintegerYesTotal size of the file to upload in bytes

Response

Successful response (200) returns:

FieldTypeDescription
upload_idstringUpload identifier used in next steps
file_chunk_size_bytesintegerRequired chunk size for send_file_chunk

Example

curl -F "api_key=YOUR_API_KEY" \
-F "file_size_bytes=12740839" \
https://api-eu.valossa.com/core/1.0/initialize_file_upload

Example Response

{
"upload_id": "7c62bc7b-e143-4a81-aa83-a7eb0ec37077",
"file_chunk_size_bytes": 4194304
}

Notes

  • Chunks must match file_chunk_size_bytes, except the final chunk may be smaller.
  • Save upload_id; it is required by both send_file_chunk and finalize_file_upload.