This endpoint implements the Dify External Knowledge API specification, allowing Dify AI applications to query CodeAlive repositories as knowledge bases.
Usage: POST /api/knowledge-retrieval/dify/retrieval
Headers:
Authorization: Bearer {your-codealive-api-key}Content-Type: application/jsonImportant: Finding the knowledge_id
The knowledge_id must be the ID of a repository or workspace from your CodeAlive account.
You can copy the ID from the CodeAlive UI:
Request Format:
{
"knowledge_id": "67f664fd4c2a00698a52bb6f",
"query": "authentication implementation",
"retrieval_setting": {
"top_k": 5,
"score_threshold": 0.7
},
"metadata_condition": {
"logical_operator": "and",
"conditions": [
{
"name": ["file_extension"],
"comparison_operator": "is",
"value": ".cs"
}
]
}
}
Error Codes:
API Key authentication using Bearer token. Example: "Authorization: Bearer {apiKey}"
Dify retrieval request with knowledge_id, query, and filters
Successfully retrieved search results