Skip to main content
Upload files to Whop for use in courses, forums, profiles, and more. The SDK provides a simple upload method that handles the entire process for you.
import fs from 'fs';

const file = await client.files.upload({
  file: fs.readFileSync('./photo.jpg'),
  filename: 'photo.jpg',
});

console.log(file.id); // file_xxxxxxxxxxxxx
console.log(file.url); // URL to access the file
The upload method:
  1. Creates a file record with a presigned URL
  2. Uploads your file to storage
  3. Polls until processing is complete
  4. Returns the ready file with its final URL

Using uploaded files

Once uploaded, use the file ID in any API call that accepts file attachments:
await client.courses.update({
  id: 'course_xxx',
  thumbnail: { id: file.id },
});

File properties

PropertyDescription
idUnique identifier (e.g., file_xxxxxxxxxxxxx)
filenameOriginal filename
content_typeMIME type (e.g., image/jpeg)
byte_sizeFile size in bytes
urlURL to access the file
upload_statusStatus: pending, processing, ready, or failed