Skip to main content
POST /openapi/memorylake/api/v1/drives/items/upload
Creates a chunked upload session. The response contains an upload_id and one pre-signed PUT URL per chunk. You then upload each chunk directly to its URL, save the returned ETag, and finally call Create Item with item_type: "file" and from: { upload_id, part_etags } to materialize the file in the Library.
This endpoint only reserves storage and returns URLs — it does not move any bytes. The file is not visible in the Library until Create Item succeeds.

Request Body

file_size
integer
required
Total file size in bytes. Minimum 1. The server uses this to decide the chunk layout — number of parts and each part’s byte range.
curl -X POST 'https://app.memorylake.ai/openapi/memorylake/api/v1/drives/items/upload' \
  -H 'Authorization: Bearer sk_xxxxxx' \
  -H 'Content-Type: application/json' \
  -d '{
    "file_size": 10485760
  }'

Response

data
object
{
  "success": true,
  "data": {
    "upload_id": "upl-abc123def456",
    "part_items": [
      {
        "number": 1,
        "size": 5242880,
        "upload_url": "https://storage.example.com/upload?partNumber=1&uploadId=upl-abc123def456"
      },
      {
        "number": 2,
        "size": 5242880,
        "upload_url": "https://storage.example.com/upload?partNumber=2&uploadId=upl-abc123def456"
      }
    ]
  }
}

Uploading chunks

After this call returns, PUT each chunk to its upload_url. The response to every PUT contains an ETag header — you must collect all of them, in order, to complete the upload.
# Read part 1's bytes and PUT them
curl -X PUT 'https://storage.example.com/upload?partNumber=1&uploadId=upl-abc123def456' \
  --data-binary @part1.bin -D -
# → ETag: "d41d8cd98f00b204e9800998ecf8427e"
Do not send an Authorization header when PUTing to upload_url — the URL is already pre-signed. Sending bearer auth may cause the PUT to be rejected by the storage backend.
Pre-signed URLs expire. Finish uploading all chunks and call Create Item promptly after creating the upload session. If URLs expire before you finalize, simply create a new upload session and restart.

Next Step

Create Item

Finalize the upload by creating a file item that references this upload’s upload_id and the collected part_etags.