Dify External Knowledge API - Retrieval endpoint.
Searches CodeAlive repositories and workspaces for relevant code artifacts. (Auth policies: ApiKeyOrJwt)
Dify
Dify External Knowledge API - Retrieval endpoint. Searches CodeAlive repositories and workspaces for relevant code artifacts. (Auth policies: ApiKeyOrJwt)
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/json
Important: 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:
- For repositories: Go to Repositories page, click the copy button next to the repository
- For workspaces: Go to Workspaces page, click the copy button next to the workspace
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:
- 1001: Invalid request format or validation error
- 1002: Authorization failed - access denied to specified data source
- 1003: Knowledge base not found
- 1004: Authentication failed - invalid or missing API key
- 2001: Internal server error
POST
Dify External Knowledge API - Retrieval endpoint.
Searches CodeAlive repositories and workspaces for relevant code artifacts. (Auth policies: ApiKeyOrJwt)
Authorizations
API Key authentication using Bearer token. Example: "Authorization: Bearer {apiKey}"
Body
Dify retrieval request with knowledge_id, query, and filters
Response
Successfully retrieved search results