Skip to main content
POST
/
api
/
v1
/
document-store
/
upsert
/
{storeId}
Upsert to Document Store
curl --request POST \
  --url https://api.example.com/api/v1/document-store/upsert/{storeId} \
  --header 'Content-Type: application/json' \
  --data '
{
  "files": [
    {}
  ],
  "loaderId": "<string>",
  "chunkSize": 123,
  "chunkOverlap": 123,
  "metadata": {}
}
'
{
  "400": {},
  "401": {},
  "403": {},
  "404": {},
  "412": {},
  "500": {},
  "numAdded": 123,
  "numUpdated": 123,
  "numSkipped": 123,
  "numDeleted": 123,
  "addedDocs": [
    {}
  ]
}
Upload and process documents into a document store. This endpoint handles file uploads, chunking, embedding, and upserting to the vector store.

Path Parameters

storeId
string
required
The unique identifier of the document store to upsert documents into

Request Body

This endpoint accepts multipart/form-data for file uploads.
files
array
required
Array of files to upload. Supports PDF, TXT, DOCX, CSV, and other formats depending on configured loaders
loaderId
string
Specific loader ID to use for processing files
chunkSize
number
Size of text chunks (default varies by loader)
chunkOverlap
number
Overlap between chunks (default varies by loader)
metadata
object
Additional metadata to attach to all documents

Response

numAdded
number
Number of new documents added
numUpdated
number
Number of existing documents updated
numSkipped
number
Number of documents skipped
numDeleted
number
Number of documents deleted
addedDocs
array
IDs of added documents

Example Request

curl -X POST \
  'https://your-flowise-instance.com/api/v1/document-store/upsert/store-123' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -F 'files=@/path/to/document.pdf' \
  -F 'files=@/path/to/guide.txt' \
  -F 'chunkSize=1000' \
  -F 'chunkOverlap=200'

Example Request - With Metadata

curl -X POST \
  'https://your-flowise-instance.com/api/v1/document-store/upsert/store-123' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -F 'files=@/path/to/document.pdf' \
  -F 'metadata={"category":"technical","version":"1.0"}'

Example Response

{
  "numAdded": 45,
  "numUpdated": 0,
  "numSkipped": 0,
  "numDeleted": 0,
  "addedDocs": [
    "doc-001",
    "doc-002",
    "doc-003"
  ]
}

Supported File Types

Depending on configured loaders, supported formats include:
  • PDF (.pdf)
  • Text (.txt)
  • Word (.docx)
  • Markdown (.md)
  • CSV (.csv)
  • JSON (.json)
  • HTML (.html)

Processing Steps

  1. Upload - Files are uploaded and validated
  2. Load - Appropriate loader processes the files
  3. Chunk - Content is split into chunks
  4. Embed - Chunks are embedded using configured embedding model
  5. Upsert - Embeddings are upserted to vector store
  6. Index - Documents are indexed for retrieval

Chunking Strategies

  • Fixed Size - Split by character count
  • Recursive - Split by paragraphs, sentences, then characters
  • Semantic - Split by semantic meaning

Error Responses

400
error
Bad Request - Invalid file format or missing required fields
401
error
Unauthorized - Invalid or missing API key
403
error
Forbidden - Insufficient permissions to upsert documents
404
error
Not Found - Document store not found
412
error
Precondition Failed - Missing store ID or workspace ID
500
error
Internal Server Error - Error processing documents

Build docs developers (and LLMs) love