Asset Thumbnail

Generates a thumbnail image for a specified asset. Accepts asset ID and desired thumbnail dimensions. Returns URL of the generated thumbnail.

POST

POST

https://api.cortado.com/v1/assets/{asset_id}/thumbnail

Request

Requires JSON body with thumbnail dimensions. Asset ID is passed in the path. Authentication is required to ensure the user’s permission.

Body Parameters

Parameters

Type

Description

width

number

Width of the thumbnail in pixels

height

number

Height of the thumbnail in pixels

Based on the steps above, your code might look something like this. It brings together the key concepts covered — from setup and configuration to routing, authentication, or event handling. Feel free to adapt it to suit your specific use case.

main.ts

import axios from 'axios';

interface ThumbnailRequest {
  width: number;
  height: number;
}

async function generateThumbnail(assetId: string, dimensions: ThumbnailRequest) {
  const res = await axios.post(`https://api.cortado.com/v1/assets/${assetId}/thumbnail`, dimensions, {
    headers: {
      Authorization: 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json',
    },
  });

  return res.data;
}

main.ts

import axios from 'axios';

interface ThumbnailRequest {
  width: number;
  height: number;
}

async function generateThumbnail(assetId: string, dimensions: ThumbnailRequest) {
  const res = await axios.post(`https://api.cortado.com/v1/assets/${assetId}/thumbnail`, dimensions, {
    headers: {
      Authorization: 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json',
    },
  });

  return res.data;
}

main.ts

import axios from 'axios';

interface ThumbnailRequest {
  width: number;
  height: number;
}

async function generateThumbnail(assetId: string, dimensions: ThumbnailRequest) {
  const res = await axios.post(`https://api.cortado.com/v1/assets/${assetId}/thumbnail`, dimensions, {
    headers: {
      Authorization: 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json',
    },
  });

  return res.data;
}

Response

Returns metadata of the generated thumbnail including URL and dimensions.

main.ts

{
  "thumbnailUrl": "https://cdn.cortado.com/assets/asset_64f1b2cc_thumbnail.png",
  "width": 200,
  "height": 150
}

main.ts

{
  "thumbnailUrl": "https://cdn.cortado.com/assets/asset_64f1b2cc_thumbnail.png",
  "width": 200,
  "height": 150
}

main.ts

{
  "thumbnailUrl": "https://cdn.cortado.com/assets/asset_64f1b2cc_thumbnail.png",
  "width": 200,
  "height": 150
}

Was this helpful?

Dismiss

Was this helpful?

Dismiss

Last updated on

Jul 19, 2025