Upload
curl --request POST \
--url https://api.example.com/api/files/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file'import requests
url = "https://api.example.com/api/files/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.example.com/api/files/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import fs from 'fs';
const formData = new FormData();
formData.append('file', await new Response(fs.createReadStream('example-file')).blob());
const url = 'https://api.example.com/api/files/upload';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}, body: formData};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Files
Upload
Upload a file and trigger processing.
Args: file: Uploaded file (multipart form)
Returns: Created file record
POST
/
api
/
files
/
upload
Upload
curl --request POST \
--url https://api.example.com/api/files/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file'import requests
url = "https://api.example.com/api/files/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.example.com/api/files/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import fs from 'fs';
const formData = new FormData();
formData.append('file', await new Response(fs.createReadStream('example-file')).blob());
const url = 'https://api.example.com/api/files/upload';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}, body: formData};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}⌘I