Skip to main content
POST
/
api
/
knowledge-retrieval
/
dify
/
retrieval
Dify External Knowledge API - Retrieval endpoint. Searches CodeAlive repositories and workspaces for relevant code artifacts. (Auth policies: ApiKeyOrJwt)
curl --request POST \
  --url https://app.codealive.ai/api/knowledge-retrieval/dify/retrieval \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "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"
      }
    ]
  }
}
'
{
  "records": [
    {
      "content": "Simple code example for Dify integration",
      "score": 0.95,
      "title": "AuthenticationService.cs",
      "metadata": {
        "path": "src/Services/AuthenticationService.cs",
        "description": "symbol in AuthenticationService.cs from My Repository",
        "file_extension": ".cs",
        "data_source_id": "67f664fd4c2a00698a52bb6f",
        "data_source_name": "My Repository",
        "data_source_type": "repository",
        "artifact_kind": "symbol",
        "start_line": 15,
        "start_character": 4,
        "end_line": 28,
        "end_character": 5
      }
    },
    {
      "content": "Simple model example",
      "score": 0.78,
      "title": "LoginRequest.cs",
      "metadata": {
        "path": "src/Models/LoginRequest.cs",
        "description": "symbol in LoginRequest.cs from My Repository",
        "file_extension": ".cs",
        "data_source_id": "67f664fd4c2a00698a52bb6f",
        "data_source_name": "My Repository",
        "data_source_type": "repository",
        "artifact_kind": "symbol"
      }
    }
  ]
}

Authorizations

Authorization
string
header
required

API Key authentication using Bearer token. Example: "Authorization: Bearer {apiKey}"

Body

Dify retrieval request with knowledge_id, query, and filters

knowledge_id
string | null
query
string | null
retrieval_setting
object
metadata_condition
object

Response

Successfully retrieved search results

records
object[] | null