V2
File Upload
Create a presigned upload URL and use the returned file object in page or block writes.
File Upload
Use Case
Use this endpoint to create a presigned upload URL. Upload the bytes to that URL, then use the returned file object when creating or updating page content.
Endpoint
| Item | Value |
|---|---|
| Method | POST |
| Path | /v2/files/upload-url |
| Request body | JSON |
| Returns | Upload URL and file object |
| Scope | pages.write |
Permissions
Requires pages.write. The API also verifies write access to parent.page_id.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
parent.page_id |
string | Yes | Page that will own or reference the uploaded file. |
filename |
string | Yes | Original file name. |
content_type |
string | Yes | MIME type. |
size |
number | No | File size in bytes when known. |
Request Example
{
"parent": {
"page_id": "11111111-1111-4111-8111-111111111111"
},
"filename": "launch-plan.pdf",
"content_type": "application/pdf",
"size": 524288
}
Response Example
{
"upload_url": "https://upload.example.com/presigned-url",
"method": "PUT",
"headers": {
"Content-Type": "application/pdf"
},
"file": {
"type": "file",
"file": {
"url": "https://buildin.ai/files/launch-plan.pdf",
"expiry_time": "2026-04-09T10:30:00.000Z"
},
"name": "launch-plan.pdf"
}
}
Behavior
- The request body must include
parent.page_id. - The presigned URL is time limited.
- Upload file bytes directly to
upload_urlusing the returned method and headers. - After upload, pass the returned
fileobject to file or image block writes where supported. - This endpoint does not upload file bytes through the Buildin JSON API.
Errors
400 validation_error: missing parent, filename, or content type.401 unauthorized: invalid or expired token.403 forbidden: missingpages.writeor no access to parent page.404 not_found: parent page does not exist.