Skip to main content
Upload files to Whop for use in courses, forums, profiles, disputes, and more.

How uploads work

Uploading is a two-step flow, and the SDK helps with the first step:
  1. Create a file record. files.create returns the new file’s id plus a presigned upload_url and the upload_headers to send with it.
  2. Send the bytes yourself. PUT the file’s contents to upload_url with those headers. The SDK doesn’t transfer the bytes for you.
Once the bytes land, the file processes and its upload_status becomes ready. You can attach the id to a resource right away, and use files.retrieve to poll for the final url.

Initialize the SDK

Upload a file

Create the record, then PUT the bytes to the presigned URL that comes back.

Public and private files

Every file you upload has a visibility that controls access. You choose visibility at upload time and can’t change it later.
Set the visibility before uploading. Public files are cached on Whop’s CDN and accessible to anyone with the URL — there is no way to revoke access. If the content is user-specific or sensitive, keep the default private.

Uploading a public file

Pass a public visibility when creating the file, then upload the bytes the same way:
Attaching a file to a resource moves it to the storage that matches that resource’s own visibility. An explicit visibility mainly matters for files you link to directly without attaching.

Confirm the upload finished

After the bytes land, the file processes asynchronously. Retrieve it until upload_status leaves pending and processing. When it’s ready, read the final url. When it’s failed, stop and surface the error.

Accessing private files

Private file URLs expire. To get a fresh URL, retrieve the file by ID again:

Using uploaded files

Once uploaded, pass the file id in any API call that accepts file attachments:

File properties