Developer API
File Upload
V2

File Upload

Create a presigned upload URL and use the returned file object in page or block writes.

POST /v2/files/upload-urlGET /v2/files/download-url

File Upload

Use Case

Use this endpoint to create a presigned upload URL. Upload the bytes to that URL, then use the returned internal object key when creating or updating page content.

Upload URL 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.
content_length number Yes File size in bytes. Maximum is 104857600 (100 MB).

Request Example

{
  "parent": {
    "page_id": "11111111-1111-4111-8111-111111111111"
  },
  "filename": "launch-plan.pdf",
  "content_type": "application/pdf",
  "content_length": 524288
}

Response Example

{
  "object": "file_upload",
  "id": "upload_15151515-1515-4515-8515-151515151515",
  "upload_url": "https://upload.example.com/presigned-url",
  "oss_name": "s3/15151515-1515-4515-8515-151515151515/launch-plan.pdf",
  "file_url": "https://cdn2.buildin.ai/s3/15151515-1515-4515-8515-151515151515/launch-plan.pdf",
  "size": 524288,
  "expiry_time": "2026-04-09T10:30:00.000Z",
  "method": "PUT",
  "headers": {
    "Content-Type": "application/pdf"
  }
}

Behavior

  • The request body must include parent.page_id.
  • The presigned URL is time limited.
  • Upload file bytes directly to upload_url using the returned method and headers.
  • After a successful upload, use the returned oss_name and size in an internal file, image, audio, or video block write. Do not use file_url as an external file URL; it is a compatibility field.
  • This endpoint does not upload file bytes through the Buildin JSON API.

Errors

  • 400 validation_error: missing parent, filename, content type, or content length; unsupported MIME type; or a file over 100 MB or workspace capacity.
  • 401 unauthorized: invalid or expired token.
  • 403 forbidden: missing pages.write or no access to parent page.
  • 404 not_found: parent page does not exist.

Download URL Endpoint

Use this endpoint to create a temporary authenticated URL for a file already referenced by a block the token can read.

Item Value
Method GET
Path /v2/files/download-url
Request body None
Returns Temporary file URL object
Scope blocks.read
Query parameter Type Required Description
block_id UUID Yes Readable block that references the file.
oss_name string Yes Exact internal object key from the block's file.oss_name; URLs are rejected.
filename string No Suggested download filename.
img_process string No Optional image processing directive.
x_oss_process string No Optional object-storage processing directive.
{
  "object": "file",
  "name": "launch-plan.pdf",
  "type": "file",
  "file": {
    "url": "https://cdn2.buildin.ai/s3/15151515-1515-4515-8515-151515151515/launch-plan.pdf?token=...",
    "expiry_time": "2026-04-09T10:30:00.000Z",
    "oss_name": "s3/15151515-1515-4515-8515-151515151515/launch-plan.pdf"
  },
  "ttl": 1800
}
  • The API verifies both blocks.read and that oss_name is referenced by block_id; it cannot mint URLs for arbitrary object keys.
  • compressed_file is included only when a same-workspace compressed variant exists.
  • ttl is the URL lifetime in seconds. Fetch the URL again after it expires.

Prerequisites

Next Steps

References