Utilities

Media

Upload media files (images, videos, PDFs) up to 5GB total

Upload media files using one of two methods depending on file size:

Method 1: Direct Multipart Upload (Small files ≤ ~4MB)

  • Send files directly as multipart/form-data
  • Suitable for small images and files under ~4MB
  • Simple curl/fetch request works fine
  • May fail with 413 error for larger files due to server body size limits

Method 2: Client-Upload Flow (Large files > ~4MB, up to 5GB)

  • Use the @vercel/blob/client library's upload() function
  • The library automatically handles token exchange with this endpoint
  • Uploads directly to blob storage (bypasses server body limits)
  • Supports chunked/multipart uploads for very large files
  • Required for files larger than ~4MB to avoid 413 errors

Example (Method 2 - Large files):

import { upload } from '@vercel/blob/client';

const blob = await upload('video.mp4', fileData, {
  access: 'public',
  handleUploadUrl: 'https://getlate.dev/api/v1/media',
  headers: { Authorization: 'Bearer YOUR_API_KEY' },
  multipart: true,  // recommended for files > 100MB
  contentType: 'video/mp4'
});
console.log(blob.url);  // Use this URL in your posts

Allowed Content Types:

  • Images: image/jpeg, image/jpg, image/png, image/webp, image/gif
  • Videos: video/mp4, video/mpeg, video/quicktime, video/avi, video/x-msvideo, video/webm, video/x-m4v
  • Documents: application/pdf

Size Limits:

  • Individual file: up to 5GB
  • Multipart method: practical limit ~4MB (use client-upload for larger files)
POST
/v1/media
AuthorizationBearer <token>

API key authentication - use your Late API key as a Bearer token

In: header

files?array<file>

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://getlate.dev/api/v1/media" \  -H "Content-Type: application/json" \  -d '{}'
{
  "files": [
    {
      "type": "image",
      "url": "https://storage.getlate.dev/uploads/abc123/image1.jpg",
      "filename": "product-photo.jpg",
      "size": 245678,
      "mimeType": "image/jpeg"
    },
    {
      "type": "video",
      "url": "https://storage.getlate.dev/uploads/abc123/video1.mp4",
      "filename": "promo-video.mp4",
      "size": 15234567,
      "mimeType": "video/mp4"
    }
  ]
}
{
  "error": "string",
  "note": "string"
}
{
  "error": "Unauthorized"
}
{
  "error": "string",
  "maxSize": "5GB",
  "note": "This error typically occurs when the total request size exceeds server limits. Try uploading fewer files or smaller files. For files larger than ~4MB, use the JSON client-upload flow instead of multipart/form-data."
}