ForjinnForjinn
API Reference

Document Store — Manage Vector Knowledge Bases

Create and manage Forjinn document stores: upload and chunk documents, configure vector store and embeddings, run semantic search, and track ingestion jobs.

Document stores are the knowledge bases that power RAG (Retrieval-Augmented Generation) in your chatflows. A document store holds one or more document loaders, processes their content into chunks, embeds those chunks, and upserts them into a vector store. You can then connect a document store to any chatflow to give it access to that knowledge.

Document store statuses

StatusMeaning
EMPTYNewly created, no documents loaded
NEWDocuments added but not yet processed
SYNCFully processed and up to date
SYNCINGProcessing in progress
STALESource documents have changed since last sync
UPSERTINGEmbedding and inserting into the vector store
UPSERTEDSuccessfully upserted into the vector store

The document store object

idstring

UUID of the document store.

namestring

Display name.

descriptionstring

Human-readable description of this store's contents.

statusstring

Current processing status (see table above).

loadersarray

Array of configured document loaders. Each loader describes a data source, its chunking splitter, and its sync state.

totalChunksinteger

Total number of document chunks across all loaders.

totalCharsinteger

Total character count across all chunks.

vectorStoreConfigobject

Configuration of the connected vector store provider.

embeddingConfigobject

Configuration of the embedding model.

whereUsedarray

Chatflows that reference this document store.

createdDatestring

ISO 8601 creation timestamp.

updatedDatestring

ISO 8601 last-updated timestamp.


Create a document store

POST /api/v1/document-store/store
namestringRequired

Display name for the document store.

descriptionstring

Optional description of the store's contents.

curl -X POST https://your-forjinn-instance.com/api/v1/document-store/store \
  -H "Authorization: Bearer fj-abc123def456" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product Documentation",
    "description": "Forjinn user guides and API reference content."
  }'
const response = await fetch('https://your-forjinn-instance.com/api/v1/document-store/store', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer fj-abc123def456',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'Product Documentation',
    description: 'Forjinn user guides and API reference content.',
  }),
});

const store = await response.json();

Response200 OK

{
  "id": "c3d4e5f6-a7b8-9012-cdef-012345678901",
  "name": "Product Documentation",
  "description": "Forjinn user guides and API reference content.",
  "status": "EMPTY",
  "loaders": [],
  "totalChunks": 0,
  "totalChars": 0,
  "whereUsed": [],
  "createdDate": "2024-05-01T10:00:00.000Z",
  "updatedDate": "2024-05-01T10:00:00.000Z"
}

List document stores

GET /api/v1/document-store/store

Returns all document stores in your active workspace.

curl https://your-forjinn-instance.com/api/v1/document-store/store \
  -H "Authorization: Bearer fj-abc123def456"
const response = await fetch('https://your-forjinn-instance.com/api/v1/document-store/store', {
  headers: { 'Authorization': 'Bearer fj-abc123def456' },
});

const stores = await response.json();

Response200 OK — array of document store objects.


Get a document store

GET /api/v1/document-store/store/:id
idstringRequired

UUID of the document store.

curl https://your-forjinn-instance.com/api/v1/document-store/store/c3d4e5f6-a7b8-9012-cdef-012345678901 \
  -H "Authorization: Bearer fj-abc123def456"
const id = 'c3d4e5f6-a7b8-9012-cdef-012345678901';
const response = await fetch(`https://your-forjinn-instance.com/api/v1/document-store/store/${id}`, {
  headers: { 'Authorization': 'Bearer fj-abc123def456' },
});

const store = await response.json();

Response200 OK — single document store object including loader details.


Update a document store

PUT /api/v1/document-store/store/:id
idstringRequired

UUID of the document store to update.

namestring

Updated display name.

descriptionstring

Updated description.

curl -X PUT https://your-forjinn-instance.com/api/v1/document-store/store/c3d4e5f6-a7b8-9012-cdef-012345678901 \
  -H "Authorization: Bearer fj-abc123def456" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "All product documentation including changelogs."
  }'
const id = 'c3d4e5f6-a7b8-9012-cdef-012345678901';
const response = await fetch(`https://your-forjinn-instance.com/api/v1/document-store/store/${id}`, {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer fj-abc123def456',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ description: 'All product documentation including changelogs.' }),
});

const updated = await response.json();

Delete a document store

DELETE /api/v1/document-store/store/:id
idstringRequired

UUID of the document store to delete.

Deleting a document store removes all its loaders, chunks, and vector store configuration. Chatflows connected to this store will lose their knowledge base.

curl -X DELETE https://your-forjinn-instance.com/api/v1/document-store/store/c3d4e5f6-a7b8-9012-cdef-012345678901 \
  -H "Authorization: Bearer fj-abc123def456"
const id = 'c3d4e5f6-a7b8-9012-cdef-012345678901';
await fetch(`https://your-forjinn-instance.com/api/v1/document-store/store/${id}`, {
  method: 'DELETE',
  headers: { 'Authorization': 'Bearer fj-abc123def456' },
});
// 200 OK on success

Query the vector store

Run a semantic similarity search against a document store's embedded content.

POST /api/v1/document-store/vectorstore/query
storeIdstringRequired

UUID of the document store to query.

querystringRequired

The natural-language query to search for.

topKinteger

Number of results to return (default: 4).

curl -X POST https://your-forjinn-instance.com/api/v1/document-store/vectorstore/query \
  -H "Authorization: Bearer fj-abc123def456" \
  -H "Content-Type: application/json" \
  -d '{
    "storeId": "c3d4e5f6-a7b8-9012-cdef-012345678901",
    "query": "How do I configure rate limiting?",
    "topK": 5
  }'
const response = await fetch('https://your-forjinn-instance.com/api/v1/document-store/vectorstore/query', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer fj-abc123def456',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    storeId: 'c3d4e5f6-a7b8-9012-cdef-012345678901',
    query: 'How do I configure rate limiting?',
    topK: 5,
  }),
});

const results = await response.json();

Response200 OK

[
  {
    "pageContent": "Rate limiting can be configured per chatflow in Settings → Rate Limits. Set a maximum number of requests per minute...",
    "metadata": {
      "source": "admin-guide.pdf",
      "page": 12,
      "chunkNo": 3
    },
    "score": 0.91
  },
  {
    "pageContent": "To prevent abuse, each chatflow has an independent rate limit. The default is 100 requests per minute.",
    "metadata": {
      "source": "api-reference.md",
      "chunkNo": 7
    },
    "score": 0.87
  }
]

Check processing job status

Document ingestion (chunking and upserting) is asynchronous. Use this endpoint to poll for the status of a processing job.

GET /api/v1/document-store/job-status/:jobId
jobIdstringRequired

The job ID returned when you initiated a processing or upsert operation.

curl https://your-forjinn-instance.com/api/v1/document-store/job-status/job-abc-123 \
  -H "Authorization: Bearer fj-abc123def456"
const jobId = 'job-abc-123';
const response = await fetch(
  `https://your-forjinn-instance.com/api/v1/document-store/job-status/${jobId}`,
  { headers: { 'Authorization': 'Bearer fj-abc123def456' } }
);

const status = await response.json();

Response200 OK

{
  "jobId": "job-abc-123",
  "status": "COMPLETED",
  "totalChunks": 248,
  "processedChunks": 248
}

Poll this endpoint until status is COMPLETED or FAILED before treating the store as ready to query.

On this page