Skip to main content
POST
/
files
JavaScript
import Whop from '@whop/sdk';

const client = new Whop({
  apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
});

const file = await client.files.create({ filename: 'filename' });

console.log(file.id);
{
  "id": "file_xxxxxxxxxxxxx",
  "upload_status": "pending",
  "filename": "<string>",
  "content_type": "<string>",
  "size": "123.45",
  "url": "<string>",
  "upload_url": "<string>",
  "upload_headers": {}
}

Authorizations

Authorization
string
header
required

The app API key from an app from the /dashboard/developer page

Body

application/json

Parameters for CreateFile

filename
string
required

The filename of the file

Response

A successful response

A file that has been uploaded or is pending upload

id
string
required

The ID of the file

Example:

"file_xxxxxxxxxxxxx"

upload_status
enum<string>
required

The upload status of the file

Available options:
pending,
processing,
ready,
failed
filename
string | null
required

The name of the file

content_type
string | null
required

The MIME type of the file (e.g., image/jpeg, video/mp4)

size
string | null
required

The size of the file in bytes

Example:

"123.45"

url
string | null
required

The URL to access the file

upload_url
string | null
required

The presigned URL to upload the file to (only on create)

upload_headers
object
required

Headers to include in the upload request (only on create)