Skip to content

FileUploadsAPI

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

FileUploads API client for uploading files to Notion.

new FileUploadsAPI(client): FileUploadsAPI

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

NotionClient

FileUploadsAPI

BaseAPI<NotionFileUpload, FileUpload>.constructor

complete(completeUrl): Promise<FileUpload>

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

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:53

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:193

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, partNumber?): Promise<void>

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

Upload file data to the upload URL from initiate(). Sends multipart/form-data through the configured NotionClient.

string

The upload URL from initiate()

FileData

The file data to upload

string

The MIME type of the file

number

The 1-based part number, for a multi-part upload of a file larger than 20 MB. Pass a positive integer.

Promise<void>

If partNumber is not a positive integer.

If the upload endpoint returns an error response.

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


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

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

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