curl --request POST \
--url https://omnicommerce.sg/api/v1/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-fileconst form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://omnicommerce.sg/api/v1/documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://omnicommerce.sg/api/v1/documents"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text){
"ok": true,
"apiVersion": "developer_v1",
"operationId": "<string>",
"status": "accepted",
"warnings": [
"<string>"
],
"recommendations": [
"<string>"
],
"links": {},
"data": {
"document": {
"id": "<string>",
"title": "<string>",
"fileName": "<string>",
"mimeType": "<string>",
"sizeBytes": 0,
"documentType": "datasheet",
"productId": "<string>",
"status": "pending",
"indexedChunkCount": 0,
"pageCount": 0,
"errorMessage": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
},
"queued": true,
"warning": "<string>"
},
"jobId": "<string>",
"productId": "<string>"
}Upload Document
Upload one file to the knowledge base as multipart/form-data. Requires documents:write.
Accepted: PDF up to 20 MB, Word (.docx) and PowerPoint (.pptx) up to 20 MB, Excel (.xlsx/.xlsm) up to 10 MB, images up to 8 MB, CSV and Markdown up to 2 MB. PDFs, Word, PowerPoint, Markdown, and images are indexed in the background; poll GET /api/v1/documents/{documentId} until status is completed. CSV and Excel are stored for agents to read but are not indexed.
curl --request POST \
--url https://omnicommerce.sg/api/v1/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-fileconst form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://omnicommerce.sg/api/v1/documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://omnicommerce.sg/api/v1/documents"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text){
"ok": true,
"apiVersion": "developer_v1",
"operationId": "<string>",
"status": "accepted",
"warnings": [
"<string>"
],
"recommendations": [
"<string>"
],
"links": {},
"data": {
"document": {
"id": "<string>",
"title": "<string>",
"fileName": "<string>",
"mimeType": "<string>",
"sizeBytes": 0,
"documentType": "datasheet",
"productId": "<string>",
"status": "pending",
"indexedChunkCount": 0,
"pageCount": 0,
"errorMessage": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
},
"queued": true,
"warning": "<string>"
},
"jobId": "<string>",
"productId": "<string>"
}Authorizations
Bearer API key for server-to-server access. Session auth is also supported in first-party UI flows.
Body
The file to upload.
Required for session auth. API keys already belong to one organization.
What the document is. bank_statement is never shown to AI.
datasheet, invoice, packing_list, compliance_certificate, test_report, sds, manual, warranty, authorization_letter, shipping_doc, regulation, policy, bank_statement, other Attach the document to one product instead of the whole organization.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$File name to store. Defaults to the uploaded file's name.
1 - 1024Response
The document was stored; indexing is queued.
"developer_v1"accepted, completed, failed Show child attributes
Show child attributes
Show child attributes
Show child attributes