Use the Knowledge API and Memory Graph
The knowledge domain stores collections, documents, chunks, ingestion jobs, entities, and relationships. Customer apps can add Markdown or plain text documents, run ingestion, query with citations, and inspect graph records.
Create a collection
curl -X POST "$P6M_URL/v1/knowledge/collections" \
-H "Authorization: Bearer $P6M_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"orgId": "'"$ORG_ID"'",
"workspaceId": "'"$WORKSPACE_ID"'",
"enabledServiceId": "'"$KNOWLEDGE_SERVICE_ID"'",
"name": "Product Docs",
"slug": "product-docs"
}'
Add a Markdown document
curl -X POST "$P6M_URL/v1/knowledge/documents" \
-H "Authorization: Bearer $P6M_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"orgId": "'"$ORG_ID"'",
"workspaceId": "'"$WORKSPACE_ID"'",
"enabledServiceId": "'"$KNOWLEDGE_SERVICE_ID"'",
"collectionId": "'"$COLLECTION_ID"'",
"title": "Refund policy",
"contentType": "text/markdown",
"sourceUri": "app://docs/refund-policy",
"content": "# Refund policy\n\nCustomers can request a refund within 14 days."
}'
Ingest the document
curl -X POST "$P6M_URL/v1/knowledge/documents/$DOCUMENT_ID/ingest" \
-H "Authorization: Bearer $P6M_API_KEY" \
-H 'Content-Type: application/json' \
-d '{}'
Ingestion creates searchable chunks, citations, entities, and relationships.
Query with citations
curl -X POST "$P6M_URL/v1/knowledge/query" \
-H "Authorization: Bearer $P6M_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"orgId": "'"$ORG_ID"'",
"workspaceId": "'"$WORKSPACE_ID"'",
"enabledServiceId": "'"$KNOWLEDGE_SERVICE_ID"'",
"collectionId": "'"$COLLECTION_ID"'",
"query": "refund window",
"limit": 5
}'
Show the returned citation metadata in your app so users can inspect where an answer came from.
Inspect Memory Graph
The v1 implementation uses deterministic local text search and conservative extraction. The API contract is search with citations plus graph records, so future embedding or model-assisted extraction can be added without changing customer app flows.
What is charged
Knowledge charges are based on ingestion, search, graph storage, and retained document data:
- document creation
- ingestion job creation
- stored chunks created by ingestion
- knowledge queries
- graph entities stored
- graph relationships stored
- retained knowledge storage
- request compute used to process knowledge API calls
Future model-assisted extraction or embedding providers may add provider-specific compute costs. The API is designed so those costs can be mapped to meters without changing customer app code.