API Upload

Upload requirements

To upload a file to our API, you must meet the following criteria:

  1. The user must have level "Uploader" or higher.
  2. You need to request the 'upload' scope when using OAuth2, or use a private token.

Upload workflow

The full workflow to upload files is as follows:

  1. Register a new upload id using POST /api/upload/id.
  2. Upload files to the upload URL returned with the upload id, this will resolve to POST /api/direct/[upload_id] .
  3. Repeat the upload step for any additional files you need to upload.
  4. Mark the upload as finished using DELETE /api/upload/id.

Example with cURL:

curl -X POST https://example.medialab.app/upload/id \
-F "folder_id=101" \
-H "Authorization: [Bearer|Private-Token] [TOKEN_GOES_HERE]"

  "ulid": "string",
  "expires": "int",
  "expires_in": "int",
  "url_upload_direct": "string",
  "api": {
    "rel": "string",
    "upload": "string",
    "finish": "string"

curl -X POST https://upload.medialab.app/upload/direct \
-F "file=@MyFile.txt" \
-F "folder_id=101" \
-F "title=Video.mp4"

Single call upload

Since we utilize a hybrid cloud infrastructure, it is usually necessary to register an upload first and use the provided upload URL. This is because the upload URL may point to a different domain than the tenant's API domain. For on-premise platforms, it may be possible to upload files using one call and your OAuth2 or Private Token, however it is not recommended. A file can be uploaded using a single POST call to the /api/upload/file endpoint. You will need to provide a valid target folder as parameter, and optionally a custom title for the file.

Example: Public Upload Form

If you are utilizing MediaLab as API back-end for your website, you can integrate a direct upload to MediaLab from your website. Example code for this set-up is available here on GitHub.

Example: Bash Upload

It is also possible to upload files using cURL from a Bash script. An example can be found in our API toolbox available here on GitHub.