LateLate API
Utilities

Media


Get a presigned URL for direct file upload (up to 5GB)

Get a presigned URL to upload files directly to cloud storage. This is the recommended method for uploading files of any size, especially files larger than ~4MB.

How it works:

  1. Call this endpoint with the filename and content type
  2. Receive an uploadUrl (presigned) and publicUrl
  3. PUT your file directly to the uploadUrl
  4. Use the publicUrl in your posts

Benefits:

  • Supports files up to 5GB
  • Files upload directly to storage (faster, no server bottleneck)
  • No 413 errors from server body size limits

Example:

// Step 1: Get presigned URL
const response = await fetch('https://getlate.dev/api/v1/media/presign', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    filename: 'my-video.mp4',
    contentType: 'video/mp4'
  })
});
const { uploadUrl, publicUrl } = await response.json();

// Step 2: Upload file directly to storage
await fetch(uploadUrl, {
  method: 'PUT',
  body: file,
  headers: { 'Content-Type': 'video/mp4' }
});

// Step 3: Use publicUrl when creating your post
// The publicUrl is ready to use immediately after upload completes
POST
/v1/media/presign
AuthorizationBearer <token>

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

In: header

filenamestring

Name of the file to upload

contentTypestring

MIME type of the file

Value in"image/jpeg" | "image/jpg" | "image/png" | "image/webp" | "image/gif" | "video/mp4" | "video/mpeg" | "video/quicktime" | "video/avi" | "video/x-msvideo" | "video/webm" | "video/x-m4v" | "application/pdf"
size?integer

Optional file size in bytes for pre-validation (max 5GB)

Response Body

application/json

application/json

application/json

curl -X POST "https://getlate.dev/api/v1/media/presign" \  -H "Content-Type: application/json" \  -d '{    "filename": "my-video.mp4",    "contentType": "video/mp4"  }'
{
  "uploadUrl": "<presigned-upload-url>",
  "publicUrl": "https://media.getlate.dev/temp/1234567890_abc123_my-video.mp4",
  "key": "temp/1234567890_abc123_my-video.mp4",
  "type": "video"
}

{
  "error": "filename and contentType are required"
}

{
  "error": "Unauthorized"
}