/api/v2/files
  • 23 Jul 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

/api/v2/files

  • Dark
    Light
  • PDF

Article summary

Post
/api/v2/files

Endpoint to upload files.

Files are saved to the persistent storage, parsed, chunked and embedded.

The file is indexed as a document in the SQL database, with its chunks,

and related to its owner, company and collection for permission application.

To specify a workspace, set 'collection_type' to one of the following:

  • 'private' for a personal workspace
  • 'company' for a company workspace
  • 'workspace' for other workspaces

If 'workspace' is specified, 'workspace_id' must be provided. If 'collection_type' is not specified, it defaults to 'company'.

Body parameters

UploadAFile

Upload a file

{
  "purpose": "documents",
  "file": "@document.pdf",
  "collection_type": "workspace",
  "workspace_id": 1
}
object
file
string (uri) Required
purpose
string 
Max length255
chunk_size
integer 
chunk_overlap
number (double) 
collection_type
string 
  • private - private
  • company - company
  • workspace - workspace
Valid values[ "private", "company", "workspace" ]
workspace_id
integer 
object
file
string (uri) Required
purpose
string 
Max length255
chunk_size
integer 
chunk_overlap
number (double) 
collection_type
string 
  • private - private
  • company - company
  • workspace - workspace
Valid values[ "private", "company", "workspace" ]
workspace_id
integer 
object
file
string (uri) Required
purpose
string 
Max length255
chunk_size
integer 
chunk_overlap
number (double) 
collection_type
string 
  • private - private
  • company - company
  • workspace - workspace
Valid values[ "private", "company", "workspace" ]
workspace_id
integer 
Responses
201

FileUploadedSuccessfully

File uploaded successfully

{
  "id": 1,
  "object": "list",
  "bytes": 20032,
  "created_at": 1631533200,
  "filename": "document.pdf",
  "purpose": "documents",
  "status": "success"
}
object
id
integer 
object
string 
bytes
integer 
created_at
integer 
filename
string 
purpose
string 
status
string 

Was this article helpful?