Skip to main content
POST
/
api
/
v1
/
document-store
/
vectorstore
/
query
Query Document Store
curl --request POST \
  --url https://api.example.com/api/v1/document-store/vectorstore/query \
  --header 'Content-Type: application/json' \
  --data '
{
  "storeId": "<string>",
  "query": "<string>",
  "k": 123,
  "includeMetadata": true
}
'
{
  "400": {},
  "401": {},
  "403": {},
  "404": {},
  "500": {},
  "documents": [
    {}
  ],
  "pageContent": "<string>",
  "metadata": {},
  "score": 123
}
Query a document store to retrieve relevant documents based on semantic similarity. This is useful for testing retrieval or building custom search interfaces.

Request Body

storeId
string
required
The unique identifier of the document store to query
query
string
required
The search query text
k
number
Number of documents to return. Default: 4
includeMetadata
boolean
Whether to include document metadata. Default: true

Response

documents
array
Array of retrieved documents

Document Object

pageContent
string
The text content of the document chunk
metadata
object
Metadata associated with the document
score
number
Similarity score (0-1, where 1 is most similar)

Example Request

curl -X POST \
  'https://your-flowise-instance.com/api/v1/document-store/vectorstore/query' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "storeId": "store-123",
    "query": "How do I reset my password?",
    "k": 3
  }'

Example Response

{
  "documents": [
    {
      "pageContent": "To reset your password, click on the 'Forgot Password' link on the login page. Enter your email address and you'll receive instructions to create a new password.",
      "metadata": {
        "source": "user-guide.pdf",
        "page": 12,
        "category": "authentication"
      },
      "score": 0.92
    },
    {
      "pageContent": "Password requirements: At least 8 characters, one uppercase letter, one number, and one special character. Passwords expire every 90 days.",
      "metadata": {
        "source": "security-policy.pdf",
        "page": 5,
        "category": "security"
      },
      "score": 0.78
    },
    {
      "pageContent": "If you're having trouble resetting your password, contact support at [email protected] or call 1-800-SUPPORT.",
      "metadata": {
        "source": "faq.txt",
        "category": "support"
      },
      "score": 0.73
    }
  ]
}

Query Parameters

k (Top-K Results)

The k parameter controls how many documents to return:
  • Higher values return more results but may include less relevant documents
  • Lower values return fewer but more relevant results
  • Typical range: 3-10

Score Interpretation

  • 0.9 - 1.0 - Highly relevant
  • 0.7 - 0.9 - Relevant
  • 0.5 - 0.7 - Somewhat relevant
  • < 0.5 - Marginally relevant

Use Cases

  1. Testing Retrieval - Test document store search quality
  2. Custom Search - Build custom search interfaces
  3. Analytics - Analyze document relevance
  4. Debugging - Debug retrieval issues in flows

Error Responses

400
error
Bad Request - Missing required fields (storeId or query)
401
error
Unauthorized - Invalid or missing API key
403
error
Forbidden - Insufficient permissions to query document store
404
error
Not Found - Document store not found
500
error
Internal Server Error - Error querying document store

Build docs developers (and LLMs) love