Uploading small files
The Direct Upload method lets you securely upload private files to Notion-managed storage via the API. Once uploaded, these files can be reused and attached to pages, blocks, or database properties.
This guide walks you through the upload lifecycle:
- Create a file upload object
- Send the file content to Notion
- Attach the file to content in your workspace
💡 Tip: Upload once, attach many times. You can reuse the same file_upload ID across multiple blocks or pages.
Step 1: Create a File Upload object
Before uploading any content, start by creating a File Upload object. This returns a unique id and upload_url used to send the file.
**🧠 Tip: **Save the id — You’ll need it to upload the file in Step 2 and attach it in Step 3.
Example requests
This snippet sends a POST request to create the upload object.
Example Response
Step 2: Upload file contents
Next, use the upload_url or File Upload object id from Step 1 to send the binary file contents to Notion.
Tips:
- The only required field is the file contents under the
filekey. - Unlike other Notion APIs, the Send File Upload endpoint expects a Content-Type of multipart/form-data, not application/json.
- Include a boundary in the
Content-Typeheader [for the Send File Upload API] as described in RFC 2388 and RFC 1341.
Most HTTP clients (e.g.fetch,ky) handle this automatically if you includeFormDatawith your file and don’t pass an explicitContent-Typeheader.
Example requests
This uploads the file directly from your local system.
Example response
⏳ Reminder
Files must be attached within 1 hour of upload or they’ll be automatically moved to an
archivedstatus.
Step 3: Attach the file to a page or block
Once the file’s status is uploaded, it can be attached to any location that supports file objects using the File Upload object id.
This step uses standard Notion API endpoints; there’s no special upload-specific API for attaching. Just pass a file object with a type of file_upload and include the id that you received earlier in Step 1.
You can use the file upload id with the following APIs:
- Create a page
- Attach files to a database property with the
filestype - Include uploaded files in
childrenblocks (e.g., file/image blocks inside a new page)
- Attach files to a database property with the
- Update page properties
- Update existing
filesproperties on a database page - Set page
iconorcover
- Update existing
- Append block children
- Add a new block to a page — like a file, image, audio, video, or PDF block that uses an uploaded file
- Update a block
- Change the file attached to an existing file block (e.g., convert an image with an external URL to one that uses a file uploaded via the API)
Example: add an image block to a page
This example uses the Append block children API to create a new image block in a page and attach the uploaded file.
Example: add a file block to a page
example uses the Append block children API to create a new file block in a page and attach the uploaded file.
Example: attach a file property to a page in a database
This example uses the Update page properties API to add the uploaded file to a files property on a page that lives in a Notion data source.
Example: Set a page cover
This example uses the Update page properties API to add the uploaded file as a page cover.
✅ You’ve successfully uploaded and attached a file using Notion’s Direct Upload method.
File lifecycle and reuse
When a file is first uploaded, it has an expiry_time, one hour from the time of creation, during which it must be attached.
Once attached to any page, block, or database in your workspace:
- The
expiry_timeis removed. - The file becomes a permanent part of your workspace.
- The
statusremainsuploaded.
Even if the original content is deleted, the file_upload ID remains valid and can be reused to attach the file again.
Currently, there is no way to delete or revoke a file upload after it has been created.
Downloading an uploaded file
Attaching a file upload gives you access to a temporary download URL via the Notion API.
These URLs expire after 1 hour.
To refresh access, re-fetch the page, block, or database where the file is attached.
📌** Tip: **A file becomes persistent and reusable after the first successful attachment — no need to re-upload.
Tips and troubleshooting
- URL expiration: Notion-hosted files expire after 1 hour. Always re-fetch file objects to refresh links.
- Attachment deadline: Files must be attached within 1 hour of upload, or they’ll expire.
- Size limit: This guide only supports files up to 20 MB. Larger files require a multi-part upload.
- Block type compatibility: Files can be attached to image, file, video, audio, or pdf blocks — and to
filesproperties on pages.