Upload File
curl --request POST \
--url https://api.example.com/api/files \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '{
"metadata": {}
}'import requests
url = "https://api.example.com/api/files"
payload = { "metadata": {} }
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({metadata: {}})
};
fetch('https://api.example.com/api/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/files"
payload := strings.NewReader("{\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/files")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"filename": "<string>",
"path": "<string>",
"user_id": "<string>",
"meta": {
"name": "<string>",
"content_type": "<string>",
"size": 123,
"data": {}
},
"data": {
"status": "<string>",
"content": "<string>",
"error": "<string>"
},
"status": true,
"created_at": 123,
"updated_at": 123
}Files & Media
Upload File
POST
/
api
/
files
Upload File
curl --request POST \
--url https://api.example.com/api/files \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '{
"metadata": {}
}'import requests
url = "https://api.example.com/api/files"
payload = { "metadata": {} }
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({metadata: {}})
};
fetch('https://api.example.com/api/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/files"
payload := strings.NewReader("{\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/files")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"filename": "<string>",
"path": "<string>",
"user_id": "<string>",
"meta": {
"name": "<string>",
"content_type": "<string>",
"size": 123,
"data": {}
},
"data": {
"status": "<string>",
"content": "<string>",
"error": "<string>"
},
"status": true,
"created_at": 123,
"updated_at": 123
}Upload a file to Open WebUI. The file can be processed in the background for content extraction and embedding generation.
Request
Headers
string
required
Bearer token for authentication
Body
file
required
The file to upload. File type must be allowed based on server configuration.
object | string
Optional metadata for the file. Can be a JSON object or JSON string.Properties:
channel_id(string): Associate file with a channellanguage(string): Language hint for audio transcription- Additional custom metadata as needed
boolean
default:"true"
Whether to process the file for content extraction
boolean
default:"true"
Whether to process the file in the background. If
false, processing happens synchronously.Response
string
Unique identifier for the uploaded file
string
Original filename
string
Storage path of the file
string
ID of the user who uploaded the file
object
object
boolean
Always
true for successful uploadsnumber
Unix timestamp of when the file was created
number
Unix timestamp of when the file was last updated
Example
curl -X POST https://your-domain.com/api/files \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "file=@document.pdf" \
-F 'metadata={"language":"en"}'
Response
{
"status": true,
"id": "550e8400-e29b-41d4-a716-446655440000",
"filename": "document.pdf",
"path": "550e8400-e29b-41d4-a716-446655440000_document.pdf",
"user_id": "user123",
"meta": {
"name": "document.pdf",
"content_type": "application/pdf",
"size": 153600,
"data": {
"language": "en"
}
},
"data": {
"status": "pending"
},
"created_at": 1709856000,
"updated_at": 1709856000
}
File Processing
Whenprocess=true, the file is automatically processed based on its content type:
- Audio files: Transcribed using configured STT engine
- Documents: Text extracted for embedding and search
- Images/Videos: Processed if external content extraction is enabled
GET /api/files/{id}/process/status.