> ## Documentation Index
> Fetch the complete documentation index at: https://bmdrm.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Multipart upload

> Upload videos to BMDRM using the HTTP multipart upload for resumable, reliable uploads.

From initializing your upload job to sending the actual video content, you’ll learn how to complete the process smoothly.

## What You’ll Need

Before you begin, ensure you have:

* A [BMDRM](https://dev.bmdrm.com/) account ([Log in](http://dev.bmdrm.com/login) or sign up for a [free trial](https://dev.bmdrm.com/en/register)).
* Have your API key prepared. To learn how to obtain your Upload API key, see [Obtaining your API key](/docs/bmdrm/authentication).

## Understanding the Upload Process

Uploading a video through the HTTP API involves **two main steps:**

1. **Initialize an upload job** (video metadata, number of chunks, and title).
2. Send **chunked video segments** using POST requests

## Initializing an Upload job

Before uploading any video content, you must first **initialize an upload job** in BMDRM. This step is often overlooked, so please ensure it’s completed before proceeding with the upload.

> This step tells BMDRM that you’re about to upload a new video and gives it a title, how many chunks to expect, and optional metadata. It doesn’t upload the video yet, just sets up the “slot” for it.

You can find full details about the available parameters in the [Upload API Reference](/docs/api-reference/upload) (still not documented)

## How to Initialize an upload job:

Make an authenticated POST request to the following endpoint:

```bash theme={null}
POST https://uploads.bmdrm.com/api/public/fileupload/Init
```

**Headers:**

* `API-KEY`: Your **Upload API key**
* `Accept: application/json`
* `Content-Type: application/json`

**Body Parameters:**

* `title`: The name of your video. This will appear in the dashboard UI .
* `description` (optional): The description of the video. This will appear in the dashboard UI.
* `fileSize`: The size of the video file in Bytes.
* `totalChunks`: The total number of chunks of the video file.
* `collectionId` (optional): The ID of a collection in your library where this video should be placed.

**Example request:**

```bash theme={null}
curl --request POST \
  --url 'https://uploads.bmdrm.com/api/public/fileupload/init' \
  --header 'API-KEY: <Your Upload API key>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data-raw '{"title":"BMDRM Demo","totalChunks":5,"fileSize":5025158, "collectionId":"01a07b23-2f6e-712a-a6e4-9a217027fe70" }'
```

**Example Response:**

The response will return a new upload job object, including:

* A unique uploadJobId (guid)

You’ll need the `uploadJobId` from this response in the next step.

## Uploading chunked video segments

Once the video object is created, you can proceed to upload the actual video file.

Full API reference: [Upload API Reference](/docs/api-reference/upload) (still not documented).

**Upload Endpoint:**

```bash theme={null}
POST https://uploads.bmdrm.com/api/public/fileupload/Upload?uploadJobId={uploadJobId}&chunkNumber={chunkNumber}&hash={segment_md5_hash}
```

**Required Parameters:**

* uploadJobId: The unique ID returned when you intialized an upload object.
* chunkNumber: The sequential number of uploaded chunk
* hash: The MD5 hash of the uploaded chunk

**Example curl request:**

```bash theme={null}
curl --request POST \
  --url 'https://uploads.bmdrm.com/api/public/fileupload/Upload?uploadJobId={uploadJobId}&chunkNumber={chunkNumber}&hash={segment_md5_hash}' \
  --header 'API-KEY: <Your Upload API key>' \
  --header 'Accept: */*' \
  --header 'Content-Type: multipart/form-data' \
  --form 'chunkFile=<Chunked segment file in Binary format>'
```

The response should return a \`200 OK\` status code indicating that the video was uploaded successfully.

<Note>
  A **401 Unauthorized** on initialize or upload usually means the `API Key` header is missing or contains an expired key.
</Note>

<Note>
  For files smaller than **1 GB**, you can upload the video in a single request by setting `totalChunks` to `1` in the [**initialization request**](HTTP/multipart#initializing-an-upload-job).
</Note>

**File Format Requirements:**

* When uploading your video file, it must be sent as **raw binary data,** not encoded or wrapped in JSON.
* Don’t send base64 encode the file.
* Send the video as binary in the multi-part form of the request.

**cURL Tip:**

Use the "--form" flag to send the file correctly:

```bash theme={null}
\--form 'chunkFile=<Chunked segment file in Binary format>'
```

If this step is skipped or misconfigured, the upload may silently fail or the video will not process correctly.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.