microscopic-stone-6467
05/05/2025, 6:16 AMbash
curl --location --request PUT 'https://api.botpress.cloud/v1/files' \
--header 'Content-Type: application/json' \
--header 'Authorization: bearer PAT' \
--header 'x-bot-id: BOT_ID' \
--data '{
"index": true,
"indexing": {
"configuration": {
"summarization": {
"modelType": "balanced"
}
}
},
"key": "kb-332b00b26e/1022533.txt",
"size": 123,
"content": "// content goes here"
}'
When I checked the status of the documents uploaded it shows empty in studio and in dashboard it shows uploading (attached few screenshots)
Let me know If i'm making mistake.
Plan details:
Plus plan
Add ons on extra collaborator.
https://cdn.discordapp.com/attachments/1368833813186351164/1368833813555187774/screenshot_2025-05-05_at_11.40.21.png?ex=6819a954&is=681857d4&hm=3deda2a33f97587dab50887fc1259deee1c3ed9ed73ffc389c69921c59074056&
https://cdn.discordapp.com/attachments/1368833813186351164/1368833814163488818/screenshot_2025-05-05_at_11.39.142.png?ex=6819a954&is=681857d4&hm=d0e663bd36b110b11af1b541a1d972492994c1390333f2f74b7eed25e02e5d52&prehistoric-airplane-85682
05/05/2025, 5:44 PMmicroscopic-stone-6467
05/06/2025, 11:10 AMmicroscopic-stone-6467
05/06/2025, 2:49 PMprehistoric-airplane-85682
05/06/2025, 3:18 PMmicroscopic-stone-6467
05/09/2025, 11:23 AMuploading_pending status forever, doesn't change to indexed status. is there any issue with file api??prehistoric-airplane-85682
05/09/2025, 2:05 PMmicroscopic-stone-6467
05/09/2025, 2:29 PMdef upload_file(file_path, api_key, bot_id, kbId, kbName):
"""Upload a single file to Botpress Cloud Files API"""
url = "https://api.botpress.cloud/v1/files"
filename = os.path.basename(file_path)
try:
with open(file_path, "r", encoding="utf-8") as f:
content = f.read()
size = len(content.encode("utf-8"))
payload = {
"index": True,
"indexing": {"configuration": {"summarization": {"modelType": "balanced"}}},
"key": f"{kbId}/{filename}",
"size": size,
"content": content,
"tags": {
"knowledgeBaseName": kbName,
"source": "knowledge-base",
"kbId": kbId,
"title": filename,
},
"contentType": "text/plain",
}
headers = {
"Content-Type": "application/json",
"Authorization": f"bearer {api_key}",
"x-bot-id": bot_id,
}
response = requests.put(url, headers=headers, data=json.dumps(payload))
print(f"Uploaded {filename}: {response.status_code}")
return response.status_code == 200
except Exception as e:
print(f"Error uploading {filename}: {str(e)}")
return Falseprehistoric-airplane-85682
05/09/2025, 6:34 PMmicroscopic-stone-6467
05/11/2025, 3:25 PMcold-fireman-53
05/12/2025, 7:41 AMprehistoric-airplane-85682
05/12/2025, 1:25 PMmicroscopic-stone-6467
05/13/2025, 6:53 AMmicroscopic-stone-6467
05/13/2025, 8:38 AMmicroscopic-stone-6467
05/13/2025, 8:38 AMdef upload_file(file_path, api_key, bot_id, kbId, kbName):
"""Upload a single file to Botpress Cloud Files API"""
url = "https://api.botpress.cloud/v1/files"
filename = os.path.basename(file_path)
try:
with open(file_path, "r", encoding="utf-8") as f:
content = f.read()
size_in_bytes = int(len(content.encode("utf-8")))
payload = {
"index": True,
"indexing": {
"configuration": {
# "summarization": {"modelType": "balanced"},
"vision": {"indexPages": True, "transcribePages": True},
}
},
"key": f"{kbId}/{filename}",
"size": size_in_bytes,
"content": content,
"tags": {
"knowledgeBaseName": kbName,
"source": "knowledge-base",
"kbId": kbId,
"title": filename,
"modalities": '["text","image"]',
},
"contentType": "text/plain; charset=utf-8",
}
headers = {
"Content-Type": "application/json",
"Authorization": f"bearer {api_key}",
"x-bot-id": bot_id,
}
response = requests.put(url, headers=headers, data=json.dumps(payload))
print(f"Uploaded {filename}: {response.status_code}")
return response.status_code == 200
except Exception as e:
print(f"Error uploading {filename}: {str(e)}")
return Falsemicroscopic-stone-6467
05/14/2025, 1:27 PM