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",
"filename": "document.pdf",
"content_type": "image/jpeg",
"size": "123.45",
"url": "<string>",
"upload_url": "https://media.whop.com/uploads/presigned",
"upload_headers": {}
}Create a new file record and receive a presigned URL for uploading content to S3.
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",
"filename": "document.pdf",
"content_type": "image/jpeg",
"size": "123.45",
"url": "<string>",
"upload_url": "https://media.whop.com/uploads/presigned",
"upload_headers": {}
}Documentation Index
Fetch the complete documentation index at: https://docs.whop.com/llms.txt
Use this file to discover all available pages before exploring further.
A company API key, company scoped JWT, app API key, or user OAuth token. You must prepend your key/token with the word 'Bearer', which will look like Bearer ***************************
A successful response
A file that has been uploaded or is pending upload.
The unique identifier for the file.
"file_xxxxxxxxxxxxx"
The current upload status of the file (e.g., pending, ready).
pending, processing, ready, failed The original filename of the uploaded file, including its file extension.
"document.pdf"
The MIME type of the uploaded file (e.g., image/jpeg, video/mp4, audio/mpeg).
"image/jpeg"
The file size in bytes. Null if the file has not finished uploading.
"123.45"
The URL for accessing the file. For public files, this is a permanent CDN URL. For private files, this is a signed URL that expires. Null if the file has not finished uploading.
Whether the file is publicly accessible or requires authentication.
public, private The presigned URL to upload the file contents to. Only present in the response from the create mutation.
"https://media.whop.com/uploads/presigned"
Headers to include in the upload request. Only present in the response from the create mutation.
Was this page helpful?