Skip to main content

Upload a file

Overview

Creating documents is a 3 step process.

1. Create a library document record

Create a Library document record and receive a signed upload URL to PUT bytes directly to Storage.

  • Endpoint: POST /api/publicv1/projects/:projectId/library/files
  • Auth Header: Authorization: API_KEY
  • Returns: { documentId, storageLink, mimeType, path, createdDate, dir }

Inputs

FieldTypeRequiredNotes
originalnamestringyesDisplay name, e.g. "report.pdf"
fileTypestringyesOne of: pdf, docx, pptx, txt, csv, png, jpg/jpeg, gif, webp
dirstringyesExisting folder ID (or "root")

List folder IDs via GET /api/publicv1/projects/:projectId/library/dirs.

Example request (curl)

curl -X POST "https://app.intellectible.com/api/publicv1/projects/PROJECT_ID/library/files" \
-H "Authorization: API_KEY" \
-H "Content-Type: application/json" \
-d '{
"originalname": "report.pdf",
"fileType": "pdf",
"dir": "-OXhwq1nm9Csj16TxxcF"
}'

Next steps...

Upload bytes to the signed URL you received in Step 1 (use the exact mimeType returned).
Complete the upload by calling the finalize endpoint with the path from Step 1.


2. Upload bytes

  • Method: PUT <storageLink>
  • Headers: Content-Type: <mimeType from Step 1> and Content-Length: <file size in bytes>
  • Body: raw file bytes

Tip: If you upload 0 bytes or use the wrong Content-Type, the object won’t be finalized properly and downloads may fail.


3. Complete (finalize) the upload

Tell the server your bytes are in Storage so it can read the object, set the real size, clear updating, and either index (documents) or thumbnail (images).

  • Endpoint POST /api/publicv1/projects/:projectId/library/files:complete

  • Auth Authorization: API_KEY

Body (JSON)

FieldTypeRequiredDefaultNotes
pathstringyesExact value from Step 1. Format: libraryDocuments/<projectId>/<documentId>.<ext>.
preventSearchbooleannofalseIf true, skip indexing/embedding so the file won’t be searchable.