Skip to content

FileUploadsAPI

Defined in: src/api/fileUploads.api.ts:30

FileUploads API client for uploading files to Notion.

new FileUploadsAPI(client): FileUploadsAPI

Defined in: src/api/fileUploads.api.ts:36

NotionClient

FileUploadsAPI

BaseAPI<NotionFileUpload, FileUpload>.constructor

complete(completeUrl): Promise<FileUpload>

Defined in: src/api/fileUploads.api.ts:92

Complete the file upload after uploading to the URL.

string

The complete URL from initiate()

Promise<FileUpload>

The completed file upload object

https://developers.notion.com/reference/complete-a-file-upload


initiate(options): Promise<FileUpload>

Defined in: src/api/fileUploads.api.ts:48

Initiate a file upload and get the upload URL.

InitiateFileUploadOptions

File metadata (filename, content type, size)

Promise<FileUpload>

The file upload object with upload URL

https://developers.notion.com/reference/create-a-file-upload


retrieve(fileUploadId): Promise<FileUpload>

Defined in: src/api/fileUploads.api.ts:166

Get the status of a file upload.

string

The ID of the file upload

Promise<FileUpload>

The file upload object with current status

https://developers.notion.com/reference/retrieve-a-file-upload


upload(uploadUrl, fileData, contentType): Promise<void>

Defined in: src/api/fileUploads.api.ts:70

Upload file data to the upload URL. This method sends a PUT request directly to the upload URL. It does not go through the Notion API.

string

The upload URL from initiate()

FileData

The file data to upload

string

The MIME type of the file

Promise<void>

https://developers.notion.com/reference/upload-a-file


uploadFile(filename, fileData, contentType): Promise<FileUpload>

Defined in: src/api/fileUploads.api.ts:129

Helper method to upload a file in one call. This combines initiate, upload, and complete steps.

string

The filename

FileData

The file data

string

The MIME type

Promise<FileUpload>

The completed file upload object