Upload File to object storage
const url = 'https://dashboard.quantcdn.io/api/v3/organizations/example/ai/files';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"content":"example","requestUploadUrl":false,"size":1,"filename":"diagram.png","contentType":"image/png","metadata":{"collectionId":"col-123","tags":["architecture","generated"]}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://dashboard.quantcdn.io/api/v3/organizations/example/ai/files \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "content": "example", "requestUploadUrl": false, "size": 1, "filename": "diagram.png", "contentType": "image/png", "metadata": { "collectionId": "col-123", "tags": [ "architecture", "generated" ] } }'Uploads a file to object storage for later retrieval.
*
* Two Upload Modes:
*
* 1. Direct Upload (≤7MB): Send base64-encoded content in request body.
*
* 2. Presigned URL Upload (any size): Set requestUploadUrl: true to get a presigned PUT URL, then upload directly to object storage.
*
* Supported Content Types:
* - Images: image/png, image/jpeg, image/gif, image/webp, image/svg+xml
* - Documents: application/pdf, text/plain, text/markdown, text/html
* - Code: text/javascript, application/json, text/css, text/yaml
* - Archives: application/zip, application/gzip
* - Video: video/mp4, video/webm (use presigned URL for large files)
*
* Metadata:
* Attach any custom metadata for filtering. artifactType is auto-populated from contentType if not provided.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The organisation ID
Request Bodyrequired
Section titled “Request Bodyrequired”object
Base64-encoded file content (for direct upload). Required unless using requestUploadUrl.
Set to true to get a presigned upload URL instead of uploading directly.
File size in bytes. Optional but recommended for presigned uploads.
Original filename
Example
diagram.pngMIME type of the file
Example
image/pngCustom metadata for filtering. Any fields allowed.
object
Example
{ "collectionId": "col-123", "tags": [ "architecture", "generated" ]}Responses
Section titled “Responses”File uploaded or presigned URL generated
object
Object storage URI (direct upload only)
Presigned download URL (direct upload only)
Presigned PUT URL (presigned upload only)
Object storage key (presigned upload only)
URL expiry in seconds (presigned upload only)
object
Examplegenerated
{ "fileId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "s3Uri": "example", "url": "https://example.com", "uploadUrl": "https://example.com", "s3Key": "example", "expiresIn": 1, "filename": "example", "contentType": "example", "size": 1, "metadata": {}, "createdAt": "2026-04-15T12:00:00Z"}Invalid request parameters
Access denied
File too large (use requestUploadUrl for large files)
Failed to upload file
