#12427·onyx

UNSTRUCTURED_API_URL is ignored — self-hosted instance never used, all calls go to api.unstructured.io

Author: AsifKagan8Created Jun 25, 2026Updated Sep 25, 2026
LabelsStale

bug: When UNSTRUCTURED_API_URL is set to point at a self-hosted Unstructured instance, all API calls still go to https://api.unstructured.io. Requests fail with HTTP 401 and fall back to basic extraction, defeating the purpose of self-hosting.

root cause: backend/onyx/file_processing/unstructured.py — UnstructuredClient is constructed without server_url:

unstructured_client = UnstructuredClient(api_key_auth=get_unstructured_api_key())

The SDK defaults to https://api.unstructured.io when server_url is omitted. UNSTRUCTURED_API_URL is defined and used elsewhere in the codebase but never passed to the SDK client here.

Fix:

_url = os.environ.get("UNSTRUCTURED_API_URL", "")
_kwargs: dict = {"api_key_auth": get_unstructured_api_key()}
if _url:
    _kwargs["server_url"] = _url
unstructured_client = UnstructuredClient(**_kwargs)

Version: Confirmed in v4.1.1 through v4.1.7 and current main.