Upload Asset

Uploads a new file to the system and stores it under the authenticated user's workspace. Supports images, documents, audio, and video files. Assets are available via a unique ID after upload.

POST

POST

https://api.cortado.com/v1/assets/upload

Request

This endpoint accepts multipart/form-data with the file attached in the file field. Optional fields allow tagging or grouping assets under specific categories. Authentication is required to ensure the user’s permission.

Body Parameters

Parameters

Type

Description

file

file

The file to upload (image, video, etc.)

label

string

Optional label or category for the asset

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';

async function uploadAsset(file: File, label?: string) {
  const formData = new FormData();
  formData.append('file', file);
  if (label) formData.append('label', label);

  const res = await axios.post('https://api.cortado.com/v1/assets/upload', formData, {
    headers: {
      Authorization: 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'multipart/form-data'
    }
  });

  return res.data;
}

main.ts

import axios from 'axios';

async function uploadAsset(file: File, label?: string) {
  const formData = new FormData();
  formData.append('file', file);
  if (label) formData.append('label', label);

  const res = await axios.post('https://api.cortado.com/v1/assets/upload', formData, {
    headers: {
      Authorization: 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'multipart/form-data'
    }
  });

  return res.data;
}

main.ts

import axios from 'axios';

async function uploadAsset(file: File, label?: string) {
  const formData = new FormData();
  formData.append('file', file);
  if (label) formData.append('label', label);

  const res = await axios.post('https://api.cortado.com/v1/assets/upload', formData, {
    headers: {
      Authorization: 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'multipart/form-data'
    }
  });

  return res.data;
}

Response

Returns the uploaded asset’s metadata including its unique ID, type, size, and access URL. Can be used immediately in other requests, views, or shared with clients via public access links.

main.ts

{
  "id": "asset_64f1b2cc",
  "type": "image/png",
  "size": 183920,
  "url": "https://cdn.cortado.com/assets/asset_64f1b2cc.png",
  "uploadedAt": "2025-07-14T10:42:00Z"
}

main.ts

{
  "id": "asset_64f1b2cc",
  "type": "image/png",
  "size": 183920,
  "url": "https://cdn.cortado.com/assets/asset_64f1b2cc.png",
  "uploadedAt": "2025-07-14T10:42:00Z"
}

main.ts

{
  "id": "asset_64f1b2cc",
  "type": "image/png",
  "size": 183920,
  "url": "https://cdn.cortado.com/assets/asset_64f1b2cc.png",
  "uploadedAt": "2025-07-14T10:42:00Z"
}

Was this helpful?

Dismiss

Was this helpful?

Dismiss

Last updated on

Jul 25, 2025