Upload a file
POST
/files
const url = 'https://api.katara.com/v1/files';const form = new FormData();form.append('file', 'file');form.append('extracted_text', 'example');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.katara.com/v1/files \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: multipart/form-data' \ --form file=@file \ --form extracted_text=exampleKeeps a picture, recording, video, PDF or text file of up to 20 MB for your account and
returns its id. Name it in a chat message as a file part with file_id, on this turn and
later ones, instead of sending the file again. Katara gives the model the file in the form it
reads; for a model that cannot read that kind of file, it sends extracted_text when you
gave one. Only your account can use, read or delete the file. Needs an API key;
Long conversations shows the flow.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typemultipart/form-data
object
file
required
string format: binary
extracted_text
The file’s text, for models that cannot read the file itself.
string
Responses
Section titled “Responses”The stored file.
Media typeapplication/json
object
id
required
string
object
required
string
bytes
required
integer
created_at
Unix seconds.
integer
filename
required
string
mime_type
required
string
sha256
string
purpose
string
extracted_text
Whether the file has text for models that cannot read it.
boolean
Example
{ "id": "file_3f9a1c0b7d2e5a6b8c9d0e1f", "object": "file", "mime_type": "application/pdf", "purpose": "user_data"}missing_param, invalid_file (empty or over 20 MB), unsupported_file_type or invalid_param.