Upload File

This endpoint is used to directly upload PDF or text files to Supavec. The POST request should be a multipart form request.

POST/upload_file

Query Parameters

Following is a description of all possible query parameters:

  • Name
    chunk_size
    Type
    integer
    Description

    The chunk size (in tokens) applied when splitting the document.

  • Name
    chunk_overlap
    Type
    integer
    Description

    The chunk overlap (in tokens) applied when splitting the document.

JavaScript

const formData = new FormData();
formData.append("file", files[0]); // Accepts PDF (.pdf) or text (.txt) files

const response = await fetch("https://api.supavec.com/upload_file", {
  method: "POST",
  headers: {
    authorization: apiKey,
  },
  body: formData,
});

Response

{
  "success": true,
  "message": "PDF file processed successfully",
  "file_id": "4db6b5d7-b199-4bfd-9914-6991cb4ba3b6",
  "chunks": 2,
  "chunk_size": 1000,
  "chunk_overlap": 200
}

Was this page helpful?