Upload a file
const url = 'https://firma.company-gpt.com/companygpt/rag/api/files';const form = new FormData();form.append('file', 'file');form.append('collectionId', '2489E9AD-2EE2-8E00-8EC9-32D5F69181C0');form.append('metadata', 'example');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
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://firma.company-gpt.com/companygpt/rag/api/files \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: multipart/form-data' \ --form file=@file \ --form collectionId=2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --form metadata=exampleUpload a new file to a collection. The file will be queued for indexing. Only the collection owner or a collection admin may upload.
Request Body: multipart/form-data
file(required): The file to upload (binary)collectionId(required): Target collection UUIDmetadata(optional): JSON-encoded object merged into the file’s source metadata
Authorizations
Abschnitt betitelt „Authorizations“Request Bodyrequired
Abschnitt betitelt „Request Bodyrequired“File upload request (multipart/form-data)
object
File to upload
Target collection ID. Required — uploads with no collection are rejected (400).
Optional JSON-encoded object merged into the file’s source metadata (e.g. custom ACL fields)
Responses
Abschnitt betitelt „Responses“File uploaded and an index job queued
Response for POST /files (handlers.UploadResponse)
object
File metadata (mirrors handlers.FileInfo)
object
Unique file identifier
Original file name
Path in blob storage
File size in bytes
MIME type
File processing status
Associated collection ID
Associated collection name
ISO 8601 creation timestamp
ISO 8601 last update timestamp
ISO 8601 last indexing timestamp
Source-specific metadata (ACL fields, SharePoint item info, etc.); omitted/empty for files with no metadata
object
ID of the indexing job queued for this upload
Example
{ "file": { "status": "pending" }}Invalid request (missing file, missing/invalid collectionId, invalid metadata JSON)
object
Error message
Examplegenerated
{ "error": "example"}Unauthorized
object
Error message
Examplegenerated
{ "error": "example"}Collection not found or caller lacks write access (404 used instead of 403 to avoid revealing collection existence)
object
Error message
Examplegenerated
{ "error": "example"}File too large
object
Error message
Examplegenerated
{ "error": "example"}