Direct Thumbnail Upload

Upload thumbnail directly to Gumlet

Prefer the official SDKs when available:

Using REST API (Thumbnail Upload)

1. Create a Thumbnail upload URL

Use the REST API and get the upload_url from Update thumbnail via upload API. Replace asset_id with the video asset ID.

import Gumlet from '@gumlet/nodejs-sdk';

const client = new Gumlet({
  apiKey: process.env['API_KEY'],
});

const videoAsset = await client.videoAssets.thumbnailUpload('<asset_id>');

console.log(videoAsset.upload_url);
import os

from gumlet import Gumlet

client = Gumlet(
    api_key=os.environ.get("API_KEY"),
)

video_asset = client.video_assets.thumbnail_upload(
    asset_id="<asset_id>",
)

print(video_asset.upload_url)
curl --request POST \
     --url https://api.gumlet.com/v1/video/assets/<asset_id>/thumbnail \
     --header 'Authorization: Bearer <YOUR_API_KEY>' \
     --header 'accept: application/json'

2. Upload a thumbnail file

Once you have the upload_url, make a PUT request that includes the image file in the body. This upload goes to the pre-signed URL (not through the Gumlet SDK client).

import { readFile } from 'node:fs/promises';

const uploadUrl = '<upload_url>';
const file = await readFile('thumbnail.jpg');

const response = await fetch(uploadUrl, {
  method: 'PUT',
  headers: {
    'Content-Type': 'image/jpeg',
  },
  body: file,
});

if (!response.ok) {
  throw new Error(`Upload failed: ${response.status} ${response.statusText}`);
}

console.log('Upload complete');
import requests

upload_url = "<upload_url>"

with open("thumbnail.jpg", "rb") as image_file:
    response = requests.put(
        upload_url,
        headers={"Content-Type": "image/jpeg"},
        data=image_file,
    )

response.raise_for_status()
print("Upload complete")
curl --location --request PUT '<upload_url>' \
--data-binary '@thumbnail.jpg'

On successful upload, you will get a 200 OK response.