AppMage

KnowledgeBaseAdminRpc

KnowledgeBaseAdminRpc exposes the knowledge base administration and ingestion API used by the UI. It supports document management, chunk editing, file and URL ingestion, ingestion job control, search, fetch operations, quota and statistics queries, and option-list helpers for UI components.

Endpoints

POST /api/rpc (Method: KnowledgeBaseAdminRpc.listDocuments)

  • Description: List documents with optional filters and pagination.

  • Request Body:

{
  "method": "KnowledgeBaseAdminRpc.listDocuments",
  "params": {
    "userId": "string",
    "contactId": "string",
    "docType": "string",
    "sourceType": "string",
    "tags": ["string"],
    "status": "string",
    "collection": "string",
    "search": "string",
    "page": 1,
    "limit": 20,
    "sortBy": "string",
    "sortDir": "string",
    "startTime": "string",
    "endTime": "string",
    "projectId": "string"
  }
}
  • Parameters:
Name Type Required Description
userId String No Filters documents by user ID.
contactId String No Filters documents by contact ID.
docType String No Filters documents by document type.
sourceType String No Filters documents by source type.
tags String[] No Filters documents by tags.
status String No Filters documents by status.
collection String No Filters documents by collection.
search String No Full-text search term.
page Number No Page number for pagination.
limit Number No Page size for pagination.
sortBy String No Field used for sorting.
sortDir String No Sort direction value.
startTime String No Lower bound for time-based filtering.
endTime String No Upper bound for time-based filtering.
projectId String No Filters documents by project ID.
  • Response:
{
  "success": true,
  "data": "service-defined document list result"
}
  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "KnowledgeBaseAdminRpc.listDocuments",
    "params": {
      "collection": "support",
      "page": 1,
      "limit": 20
    }
  }'

POST /api/rpc (Method: KnowledgeBaseAdminRpc.getDocument)

  • Description: Get a single document by ID.

  • Request Body:

{
  "method": "KnowledgeBaseAdminRpc.getDocument",
  "params": {
    "docId": "string"
  }
}
  • Parameters:
Name Type Required Description
docId String Yes Document ID.
  • Response:
{
  "success": true,
  "data": "service-defined document result"
}
  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "KnowledgeBaseAdminRpc.getDocument",
    "params": {
      "docId": "doc_123"
    }
  }'

POST /api/rpc (Method: KnowledgeBaseAdminRpc.updateDocument)

  • Description: Update document metadata such as name, description, collection, and tags.

  • Request Body:

{
  "method": "KnowledgeBaseAdminRpc.updateDocument",
  "params": {
    "docId": "string",
    "updates": {
      "name": "string",
      "description": "string",
      "collection": "string",
      "tags": ["string"]
    }
  }
}
  • Parameters:
Name Type Required Description
docId String Yes Document ID.
updates Object Yes Metadata fields to update.
updates.name String No New document name.
updates.description String No New document description.
updates.collection String | null No New collection value.
updates.tags String[] No New tag list.
  • Response:
{
  "success": true,
  "data": "service-defined update result"
}
  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "KnowledgeBaseAdminRpc.updateDocument",
    "params": {
      "docId": "doc_123",
      "updates": {
        "name": "Updated title",
        "tags": ["faq", "support"]
      }
    }
  }'

POST /api/rpc (Method: KnowledgeBaseAdminRpc.deleteDocument)

  • Description: Soft-delete a document and queue cleanup.

  • Request Body:

{
  "method": "KnowledgeBaseAdminRpc.deleteDocument",
  "params": {
    "docId": "string"
  }
}
  • Parameters:
Name Type Required Description
docId String Yes Document ID.
  • Response:
{
  "success": true,
  "data": "service-defined delete result"
}
  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "KnowledgeBaseAdminRpc.deleteDocument",
    "params": {
      "docId": "doc_123"
    }
  }'

POST /api/rpc (Method: KnowledgeBaseAdminRpc.getDocumentVersions)

  • Description: Get version history for a document.

  • Request Body:

{
  "method": "KnowledgeBaseAdminRpc.getDocumentVersions",
  "params": {
    "docId": "string"
  }
}
  • Parameters:
Name Type Required Description
docId String Yes Document ID.
  • Response:
{
  "success": true,
  "data": "service-defined version history"
}
  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "KnowledgeBaseAdminRpc.getDocumentVersions",
    "params": {
      "docId": "doc_123"
    }
  }'

POST /api/rpc (Method: KnowledgeBaseAdminRpc.reindexDocument)

  • Description: Re-embed all chunks for a document using the current embedding model.

  • Request Body:

{
  "method": "KnowledgeBaseAdminRpc.reindexDocument",
  "params": {
    "docId": "string"
  }
}
  • Parameters:
Name Type Required Description
docId String Yes Document ID.
  • Response:
{
  "success": true,
  "data": "service-defined reindex result"
}
  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "KnowledgeBaseAdminRpc.reindexDocument",
    "params": {
      "docId": "doc_123"
    }
  }'

POST /api/rpc (Method: KnowledgeBaseAdminRpc.getChunks)

  • Description: Get all indexed chunks for a document.

  • Request Body:

{
  "method": "KnowledgeBaseAdminRpc.getChunks",
  "params": {
    "docId": "string"
  }
}
  • Parameters:
Name Type Required Description
docId String Yes Document ID.
  • Response:
{
  "success": true,
  "data": "service-defined chunk list"
}
  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "KnowledgeBaseAdminRpc.getChunks",
    "params": {
      "docId": "doc_123"
    }
  }'

POST /api/rpc (Method: KnowledgeBaseAdminRpc.updateChunk)

  • Description: Update a single chunk's text and trigger re-embedding on the knowledge base side.

  • Request Body:

{
  "method": "KnowledgeBaseAdminRpc.updateChunk",
  "params": {
    "docId": "string",
    "chunkId": "string",
    "text": "string"
  }
}
  • Parameters:
Name Type Required Description
docId String Yes Document ID.
chunkId String Yes Chunk ID.
text String Yes New chunk text. Must be at least 1 character.
  • Response:
{
  "success": true,
  "data": "service-defined update result"
}
  • Example (cURL):
curl -X POST "${APP_BASE_URL}/api/rpc" \
  -H "Content-Type: application/json" \
  -d '{
    "method": "KnowledgeBaseAdminRpc.updateChunk",
    "params": {
      "docId": "doc_123",
      "chunkId": "chunk_1",
      "text": "Updated chunk content"
    }
  }'

POST /api/rpc (Method: KnowledgeBaseAdminRpc.deleteChunk)

  • Description: Delete a single chunk from a document.

  • Request Body:

{
  "method": "KnowledgeBaseAdminRpc.deleteChunk",
  "params": {
    "docId": "