Skip to main content
post/datasets/{dataset_id}/retrieve
Request example
Response
post/datasets/{dataset_id}/retrieve

Authorization

Authorizationstringheaderrequired#

Every request authenticates with an API key: Authorization: Bearer {API_KEY}. App endpoints take an app API key; knowledge endpoints take a knowledge base API key (Get Started).

Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP 401 (unauthorized).

Path parameters

dataset_idstringrequired#
Knowledge base ID, from List Knowledge Bases. For a scoped key, copy the ID from the Dify URL.

Body

application/json
attachment_idsstring[]#
List of attachment IDs to include in the retrieval context.
external_retrieval_modelobject#
Retrieval settings for external knowledge bases.
querystringrequired#
Search query text.

Length: max 250

retrieval_modelobject#

Responses

application/json
Retrieval results.
queryobject#
The original query object.
recordsobject[]#
List of matched retrieval records.