# Open WebUI

Use switchfile as the content extraction engine of Open WebUI, so PDFs and Office files reach your knowledge bases as Markdown with their tables intact.

Open WebUI can send uploaded documents to an external service for text extraction. Point it at switchfile and every PDF, Word, PowerPoint or Excel file in a chat or a knowledge base arrives as Markdown. Tables stay tables and headings stay headings, so the model sees the structure of the document.

## Set it up

1. Create an API key in the [dashboard](https://switchfile.io/dashboard/keys).
2. In Open WebUI, open Admin Panel, then Settings, then Documents.
3. Set Content Extraction Engine to External.
4. Enter the URL `https://api.switchfile.io/v1/openwebui` and paste the API key.
5. Save. New uploads go through switchfile from now on; to process files that are already in a knowledge base, upload them again or reindex the knowledge base.

Open WebUI adds `/process` to the URL itself. Do not add it yourself.

## What you get

Each file becomes one document with the Markdown in `page_content`. Formats without a Markdown conversion arrive as plain text. The metadata holds the file name and the conversion ID, and `credits` shows what it cost:

```json
{
  "page_content": "# Annual report\n\n| Year | Revenue |\n| --- | --- |\n| 2025 | 1.2 M |\n",
  "metadata": { "source": "annual report.pdf", "conversion_id": "0b8a7c1e-5d0f-4a51-9f39-2f7f4c1d9a10", "format": "md", "credits": 1 }
}
```

You can call the endpoint yourself to see what Open WebUI receives:

```bash
curl -X PUT https://api.switchfile.io/v1/openwebui/process \
  -H "Authorization: Bearer $SWITCHFILE_API_KEY" \
  -H "Content-Type: application/pdf" \
  -H "X-Filename: annual%20report.pdf" \
  --data-binary @"annual report.pdf"
```

## Price and limits

Each file is billed like a [conversion](https://switchfile.io/docs/simple-api) to Markdown and counts toward your free daily quota and credits. File size limits and [retention](https://switchfile.io/docs/limits#retention) are the same as for every other conversion. The conversion appears in the [dashboard](https://switchfile.io/dashboard) like every other one.

Open WebUI waits for the answer in one request, so a file has 90 seconds. A conversion that takes longer is cancelled and costs nothing; Open WebUI then shows the error `504` with the code `WAIT_TIMEOUT`. Convert very long documents with [POST /v1/convert](https://switchfile.io/docs/simple-api) instead. To add that Markdown file to Open WebUI, switch the content extraction engine back to the default for the upload, because the External engine sends every file to this endpoint, which does not convert Markdown to Markdown.

Files that cannot become text, such as audio or images without a text conversion, get `415` with the code `UNSUPPORTED_MEDIA_TYPE`. Accounts set to [convert without storage](https://switchfile.io/docs/no-store) cannot use this endpoint, because the file is kept for the usual retention period.

If only part of a file could be converted, for example because a scan has more pages than the limit, the text starts with a line saying the result is incomplete, and `metadata` has `incomplete: true` and the notes.

The user details that Open WebUI can forward in `X-OpenWebUI-User-*` headers are ignored and never stored.

## Next

- [Limits and quotas](https://switchfile.io/docs/limits): Rate limits, file sizes, time limits, the free daily quota, quotas per visitor for service keys and how long files are kept.
- [Errors](https://switchfile.io/docs/errors): Error formats of the simple API and of jobs and tasks, every error code with its HTTP status, and what to do about it.
