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

# Create Multipart Upload

> Initialize a multipart upload for large files

## Overview

Initiates a multipart upload for files **≥ 5MB** (5,242,880 bytes). Returns an `uploadId` and `key` that must be used for all subsequent operations.

**Multipart Upload Flow:**

1. **Create** - Initialize the upload (this endpoint)
2. **Sign** - Get presigned URLs for each part
3. **Upload** - PUT each part to its URL
4. **Complete** - Finalize the upload
5. **Register** - Create file entry with `/s3/entries`

## Request Body

<ParamField body="filename" type="string" required>
  Original filename
</ParamField>

<ParamField body="mime" type="string" required>
  MIME type
</ParamField>

<ParamField body="size" type="integer" required>
  File size in bytes
</ParamField>

<ParamField body="extension" type="string" required>
  File extension without dot
</ParamField>

<ParamField body="workspaceId" type="integer">
  Workspace ID
</ParamField>

<ParamField body="relativePath" type="string">
  Folder path for auto-creation
</ParamField>

<ParamField body="parentId" type="integer">
  Parent folder ID
</ParamField>

## Response

<ResponseField name="key" type="string">
  S3 key for the upload
</ResponseField>

<ResponseField name="uploadId" type="string">
  Multipart upload ID (required for all subsequent operations)
</ResponseField>

<ResponseField name="acl" type="string">
  Access control (`private`)
</ResponseField>

<ResponseField name="status" type="string">
  Request status (`success`)
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://app.drime.cloud/api/v1/s3/multipart/create \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "filename": "large-video.mp4",
      "mime": "video/mp4",
      "size": 142557981,
      "extension": "mp4",
      "workspaceId": 0
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://app.drime.cloud/api/v1/s3/multipart/create', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      filename: file.name,
      mime: file.type,
      size: file.size,
      extension: file.name.split('.').pop(),
      workspaceId: 0
    })
  });

  const { key, uploadId } = await response.json();

  // Store these for subsequent operations
  console.log(`Upload initialized: ${uploadId}`);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://app.drime.cloud/api/v1/s3/multipart/create',
      headers={'Authorization': 'Bearer YOUR_ACCESS_TOKEN'},
      json={
          'filename': 'large-video.mp4',
          'mime': 'video/mp4',
          'size': 142557981,
          'extension': 'mp4',
          'workspaceId': 0
      }
  )

  data = response.json()
  key = data['key']
  upload_id = data['uploadId']
  print(f'Upload initialized: {upload_id}')
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "key": "uploads/1e4cbca8-165f-4780-9cb7-fc4d8f2e4834/1e4cbca8-165f-4780-9cb7-fc4d8f2e4834",
    "uploadId": "AFNhWKh6Cn6fOryIGSCF4GFVTXB1CnOpdipc0ZHJIHwk9YBgHjLXwXhQkzQ4LmXVkW46cl1ICuQFI4KPBWXt...",
    "acl": "private",
    "status": "success"
  }
  ```
</ResponseExample>

<Note>
  Each part should be \~5MB (5,242,880 bytes) except for the last part which may be smaller.
</Note>
