[GH-ISSUE #2762] [BUG]: Upload file API in FastAPI is incorrect #1777

Closed
opened 2026-02-22 18:26:29 -05:00 by yindo · 1 comment
Owner

Originally created by @maria-ny on GitHub (Dec 4, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2762

How are you running AnythingLLM?

Docker (local)

What happened?

Going to http://localhost:3001/api/docs shows that to upload a document you need to call url: "http://localhost:3001/v1/document/upload"

When running upload file/document in AnythingLLM application and capturing network calls, I see that the url is: "http://localhost:3001/api/workspace/{workspace_slug}/upload"

Maybe relevant to #2473 issue

Are there known steps to reproduce?

import httpx
import asyncio

async def upload_to_anythingllm():
    # Configuration
    workspace_slug = "test_workspace"
    file_data = "This is a test file's content as a string.".encode("utf-8")
    filename = "test_file.txt"
    url = f"http://localhost:3001/api/workspace/{workspace_slug}/upload" # WORKING
    #url = "http://localhost:3001/v1/document/upload" # NOT WORKING

    files = {
        "file": (f"{filename}", file_data, "application/octet-stream"),
    }

    headers = {
        "accept": "*/*",
        "authorization": "INSERT_TOKEN",  
    }

    async with httpx.AsyncClient() as client:
        response = await client.post(url, headers=headers, files=files)

    print(f"Response Status Code: {response.status_code}")
    print(f"Response Text: {response.text}")

if __name__ == "__main__":
    asyncio.run(upload_to_anythingllm())
Originally created by @maria-ny on GitHub (Dec 4, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/2762 ### How are you running AnythingLLM? Docker (local) ### What happened? Going to http://localhost:3001/api/docs shows that to upload a document you need to call url: "http://localhost:3001/v1/document/upload" When running upload file/document in AnythingLLM application and capturing network calls, I see that the url is: "http://localhost:3001/api/workspace/{workspace_slug}/upload" Maybe relevant to #2473 issue ### Are there known steps to reproduce? ``` import httpx import asyncio async def upload_to_anythingllm(): # Configuration workspace_slug = "test_workspace" file_data = "This is a test file's content as a string.".encode("utf-8") filename = "test_file.txt" url = f"http://localhost:3001/api/workspace/{workspace_slug}/upload" # WORKING #url = "http://localhost:3001/v1/document/upload" # NOT WORKING files = { "file": (f"{filename}", file_data, "application/octet-stream"), } headers = { "accept": "*/*", "authorization": "INSERT_TOKEN", } async with httpx.AsyncClient() as client: response = await client.post(url, headers=headers, files=files) print(f"Response Status Code: {response.status_code}") print(f"Response Text: {response.text}") if __name__ == "__main__": asyncio.run(upload_to_anythingllm()) ```
yindo added the possible bug label 2026-02-22 18:26:29 -05:00
yindo closed this issue 2026-02-22 18:26:29 -05:00
Author
Owner

@timothycarambat commented on GitHub (Dec 4, 2024):

One is for the developer api and the other is for the frontend application API. Not the same because they are not the same endpoint and shouldn't be used interchangeably

@timothycarambat commented on GitHub (Dec 4, 2024): One is for the _developer_ api and the other is for the frontend application API. Not the same because they are not the same endpoint and shouldn't be used interchangeably
yindo changed title from [BUG]: Upload file API in FastAPI is incorrect to [GH-ISSUE #2762] [BUG]: Upload file API in FastAPI is incorrect 2026-06-05 14:42:37 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#1777