Light Logo
Uploads

Create an upload

This endpoint creates an upload. To complete an upload, split the file into parts, upload each part to the corresponding upload URL using a PUT request, record the ETag if returned in the response header for each uploaded part, and then complete the upload by submitting the etags to the upload completion endpoint.

POST
/uploads
AuthorizationBearer <token>

In: header

sizeSize

The size of the file to upload in bytes. This should be the exact size of the file. Any mismatch will result in an error or a corrupt file being uploaded.

Range0 < value
mime_typeMime Type

The MIME type of the file.

Response Body

from wriftai import Clientwriftai = Client()upload = wriftai.uploads.create(    {        "size": 10485760,        "mime_type": "video/mp4",    },)print(upload.id)print(upload.part_size)print(upload.urls)
{
  "urls": [
    "https://example.com/upload/part-1",
    "https://example.com/upload/part-2"
  ],
  "id": "upload-abc123",
  "part_size": 5242880
}
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}