Knowledge Retrieval - Retrieve
KnowledgeBase retrieves relevant data from backing stores.
POST {endpoint}/knowledgebases('{knowledgeBaseName}')/retrieve?api-version=2026-04-01
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
endpoint
|
path | True |
string (uri) |
The endpoint URL of the search service. |
|
knowledge
|
path | True |
string |
The name of the knowledge base. |
|
api-version
|
query | True |
string minLength: 1 |
The API version to use for this operation. |
Request Header
| Name | Required | Type | Description |
|---|---|---|---|
| Accept |
The Accept header. |
||
| x-ms-client-request-id |
string (uuid) |
An opaque, globally-unique, client-generated string identifier for the request. |
Request Body
| Name | Type | Description |
|---|---|---|
| includeActivity |
boolean |
Indicates retrieval results should include activity information. |
| intents | KnowledgeRetrievalIntent[]: |
A list of intended queries to execute without model query planning. |
| knowledgeSourceParams | KnowledgeSourceParams[]: |
A list of runtime parameters for the knowledge sources. |
| maxOutputSizeInTokens |
integer (int32) |
Limits the maximum size of the content in the output. |
| maxRuntimeInSeconds |
integer (int32) |
The maximum runtime in seconds. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
Successful retrieval response. |
|
| Other Status Codes |
Partial retrieval response. |
|
| Other Status Codes |
An unexpected error response. |
Security
api-key
Type:
apiKey
In:
header
OAuth2Auth
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
Scopes
| Name | Description |
|---|---|
| https://search.azure.com/.default |
Examples
|
Knowledge |
|
Knowledge |
KnowledgeBaseRetrieve
Sample request
POST https://exampleservice.search.windows.net/knowledgebases('base-example-index')/retrieve?api-version=2026-04-01
{
"maxRuntimeInSeconds": 60,
"maxOutputSizeInTokens": 100000,
"includeActivity": true,
"knowledgeSourceParams": [
{
"filterAddOn": "foo eq bar",
"knowledgeSourceName": "ks-example-index",
"includeReferences": true,
"includeReferenceSourceData": true,
"rerankerThreshold": 2.1,
"kind": "searchIndex"
}
]
}
Sample response
{
"response": [
{
"content": [
{
"type": "text",
"text": "[{...}]"
}
]
}
],
"activity": [
{
"type": "modelQueryPlanning",
"id": 0,
"inputTokens": 11,
"outputTokens": 22,
"elapsedMs": 10
},
{
"type": "searchIndex",
"id": 1,
"knowledgeSourceName": "ks-example-index",
"queryTime": "2025-01-01T00:08:45.045Z",
"count": 2,
"elapsedMs": 1234,
"searchIndexArguments": {
"search": "hello world",
"filter": "foo eq bar",
"sourceDataFields": [
{
"name": "category"
},
{
"name": "description"
},
{
"name": "ownerId"
},
{
"name": "id"
}
],
"searchFields": [],
"semanticConfigurationName": "testconfig"
}
},
{
"type": "searchIndex",
"id": 2,
"knowledgeSourceName": "ks-example-index",
"queryTime": "2025-01-01T00:08:45.045Z",
"count": 2,
"elapsedMs": 1234,
"searchIndexArguments": {
"search": "hello world two",
"filter": "foo eq bar",
"sourceDataFields": [
{
"name": "category"
},
{
"name": "description"
},
{
"name": "ownerId"
},
{
"name": "id"
}
],
"searchFields": [],
"semanticConfigurationName": "testconfig"
}
},
{
"type": "agenticReasoning",
"id": 3,
"reasoningTokens": 74
},
{
"type": "modelAnswerSynthesis",
"id": 4,
"inputTokens": 664,
"outputTokens": 1328,
"elapsedMs": 10
}
],
"references": [
{
"type": "searchIndex",
"id": "83dd7d40",
"activitySource": 1,
"sourceData": {
"id": "myDocKey1",
"title": "high_doc",
"content": "hello world"
},
"rerankerScore": 3.5,
"docKey": "myDocKey1"
},
{
"type": "searchIndex",
"id": "83dd7d41",
"activitySource": 1,
"sourceData": {
"id": "myDocKey2",
"title": "low_doc",
"content": "goodbye world"
},
"rerankerScore": 2.7,
"docKey": "myDocKey2"
}
]
}
{
"response": [
{
"content": [
{
"type": "text",
"text": "[{...}]"
}
]
}
],
"activity": [
{
"type": "modelQueryPlanning",
"id": 0,
"inputTokens": 11,
"outputTokens": 22,
"elapsedMs": 10
},
{
"type": "searchIndex",
"id": 1,
"knowledgeSourceName": "ks-example-index",
"queryTime": "2025-01-01T00:08:45.045Z",
"count": 2,
"elapsedMs": 1234,
"searchIndexArguments": {
"search": "hello world",
"filter": "foo eq bar",
"sourceDataFields": [
{
"name": "category"
},
{
"name": "description"
},
{
"name": "ownerId"
},
{
"name": "id"
}
],
"searchFields": [],
"semanticConfigurationName": "testconfig"
}
},
{
"type": "web",
"id": 2,
"knowledgeSourceName": "ks-preview-web",
"queryTime": "2025-01-01T00:08:45.045Z",
"count": 10,
"elapsedMs": 2345,
"error": {
"code": "403",
"message": "The error message",
"details": [],
"additionalInfo": [
{
"type": "SomeErrorType",
"info": {
"someProperty": "Some value"
}
}
]
}
},
{
"type": "agenticReasoning",
"id": 3,
"reasoningTokens": 74
},
{
"type": "modelAnswerSynthesis",
"id": 4,
"inputTokens": 664,
"outputTokens": 1328,
"elapsedMs": 10
}
],
"references": [
{
"type": "searchIndex",
"id": "83dd7d40",
"activitySource": 1,
"sourceData": {
"id": "myDocKey1",
"title": "high_doc",
"content": "hello world"
},
"rerankerScore": 3.5,
"docKey": "myDocKey1"
},
{
"type": "searchIndex",
"id": "83dd7d41",
"activitySource": 1,
"sourceData": {
"id": "myDocKey2",
"title": "low_doc",
"content": "goodbye world"
},
"rerankerScore": 2.7,
"docKey": "myDocKey2"
}
]
}
KnowledgeBaseRetrieveWithIntents
Sample request
POST https://exampleservice.search.windows.net/knowledgebases('base-example-index')/retrieve?api-version=2026-04-01
{
"intents": [
{
"search": "foo",
"type": "semantic"
}
],
"maxRuntimeInSeconds": 60,
"maxOutputSizeInTokens": 100000,
"includeActivity": true,
"knowledgeSourceParams": [
{
"filterAddOn": "foo eq bar",
"knowledgeSourceName": "ks-example-index",
"includeReferences": true,
"includeReferenceSourceData": true,
"rerankerThreshold": 2.1,
"kind": "searchIndex"
}
]
}
Sample response
{
"response": [
{
"content": [
{
"type": "text",
"text": "[{...}]"
}
]
}
],
"activity": [
{
"type": "searchIndex",
"id": 0,
"knowledgeSourceName": "ks-example-index",
"queryTime": "2025-01-01T00:08:45.045Z",
"count": 2,
"elapsedMs": 1234,
"searchIndexArguments": {
"search": "foo",
"filter": "foo eq bar",
"sourceDataFields": [
{
"name": "category"
},
{
"name": "description"
},
{
"name": "ownerId"
},
{
"name": "id"
}
],
"searchFields": [],
"semanticConfigurationName": "testconfig"
}
},
{
"type": "agenticReasoning",
"id": 1,
"reasoningTokens": 37
}
],
"references": [
{
"type": "searchIndex",
"id": "83dd7d40",
"activitySource": 0,
"sourceData": {
"id": "myDocKey1",
"title": "high_doc",
"content": "hello world"
},
"rerankerScore": 3.5,
"docKey": "myDocKey1"
},
{
"type": "searchIndex",
"id": "83dd7d41",
"activitySource": 0,
"sourceData": {
"id": "myDocKey2",
"title": "low_doc",
"content": "goodbye world"
},
"rerankerScore": 2.7,
"docKey": "myDocKey2"
}
]
}
{
"response": [
{
"content": [
{
"type": "text",
"text": "[{...}]"
}
]
}
],
"activity": [
{
"type": "searchIndex",
"id": 0,
"knowledgeSourceName": "ks-example-index",
"queryTime": "2025-01-01T00:08:45.045Z",
"count": 2,
"elapsedMs": 1234,
"searchIndexArguments": {
"search": "foo",
"filter": "foo eq bar",
"sourceDataFields": [
{
"name": "category"
},
{
"name": "description"
},
{
"name": "ownerId"
},
{
"name": "id"
}
],
"searchFields": [],
"semanticConfigurationName": "testconfig"
}
},
{
"type": "web",
"id": 1,
"knowledgeSourceName": "ks-preview-web",
"queryTime": "2025-01-01T00:08:45.045Z",
"count": 10,
"elapsedMs": 2345,
"error": {
"code": "403",
"message": "The error message",
"details": [],
"additionalInfo": [
{
"type": "SomeErrorType",
"info": {
"someProperty": "Some value"
}
}
]
}
},
{
"type": "agenticReasoning",
"id": 2,
"reasoningTokens": 37
}
],
"references": [
{
"type": "searchIndex",
"id": "83dd7d40",
"activitySource": 0,
"sourceData": {
"id": "myDocKey1",
"title": "high_doc",
"content": "hello world"
},
"rerankerScore": 3.5,
"docKey": "myDocKey1"
},
{
"type": "searchIndex",
"id": "83dd7d41",
"activitySource": 0,
"sourceData": {
"id": "myDocKey2",
"title": "low_doc",
"content": "goodbye world"
},
"rerankerScore": 2.7,
"docKey": "myDocKey2"
}
]
}
Definitions
| Name | Description |
|---|---|
| Accept |
The Accept header. |
|
Azure |
Specifies runtime parameters for a azure blob knowledge source |
|
Error |
The resource management error additional info. |
|
Error |
The error detail. |
|
Error |
Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). |
|
Indexed |
Specifies runtime parameters for a indexed OneLake knowledge source |
|
Knowledge |
The type of activity record. |
|
Knowledge |
Represents an agentic reasoning activity record. |
|
Knowledge |
Represents the arguments the azure blob retrieval activity was run with. |
|
Knowledge |
Represents a azure blob retrieval activity record. |
|
Knowledge |
Represents an Azure Blob Storage document reference. |
|
Knowledge |
The resource management error additional info. |
|
Knowledge |
The error details. |
|
Knowledge |
Image content. |
|
Knowledge |
Represents the arguments the indexed OneLake retrieval activity was run with. |
|
Knowledge |
Represents a indexed OneLake retrieval activity record. |
|
Knowledge |
Represents an indexed OneLake document reference. |
|
Knowledge |
The natural language message style object. |
|
Knowledge |
The type of message content. |
|
Knowledge |
Image message type. |
|
Knowledge |
Text message type. |
|
Knowledge |
Represents an LLM web summarization activity record. |
|
Knowledge |
The type of reference. |
|
Knowledge |
The input contract for the retrieval request. |
|
Knowledge |
The output contract for the retrieval response. |
|
Knowledge |
Represents the arguments the search index retrieval activity was run with. |
|
Knowledge |
Represents a search index retrieval activity record. |
|
Knowledge |
Represents an Azure Search document reference. |
|
Knowledge |
Represents the arguments the web retrieval activity was run with. |
|
Knowledge |
Represents a web retrieval activity record. |
|
Knowledge |
Represents a web document reference. |
|
Knowledge |
The kind of knowledge base configuration to use. |
|
Knowledge |
A semantic query intent. |
|
Knowledge |
The kind of the knowledge source. |
|
Search |
Field reference for a search index. |
|
Search |
Specifies runtime parameters for a search index knowledge source |
|
Web |
Specifies runtime parameters for a web knowledge source |
Accept
The Accept header.
| Value | Description |
|---|---|
| application/json;odata.metadata=minimal |
AzureBlobKnowledgeSourceParams
Specifies runtime parameters for a azure blob knowledge source
| Name | Type | Description |
|---|---|---|
| includeReferenceSourceData |
boolean |
Indicates whether references should include the structured data obtained during retrieval in their payload. |
| includeReferences |
boolean |
Indicates whether references should be included for data retrieved from this source. |
| kind |
string:
azure |
The type of the knowledge source. |
| knowledgeSourceName |
string |
The name of the index the params apply to. |
| rerankerThreshold |
number (float) |
The reranker threshold all retrieved documents must meet to be included in the response. |
ErrorAdditionalInfo
The resource management error additional info.
| Name | Type | Description |
|---|---|---|
| info |
searchservice.knowledgeretrieval.retrieve |
The additional info. |
| type |
string |
The additional info type. |
ErrorDetail
The error detail.
| Name | Type | Description |
|---|---|---|
| additionalInfo |
The error additional info. |
|
| code |
string |
The error code. |
| details |
The error details. |
|
| message |
string |
The error message. |
| target |
string |
The error target. |
ErrorResponse
Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.).
| Name | Type | Description |
|---|---|---|
| error |
The error object. |
IndexedOneLakeKnowledgeSourceParams
Specifies runtime parameters for a indexed OneLake knowledge source
| Name | Type | Description |
|---|---|---|
| includeReferenceSourceData |
boolean |
Indicates whether references should include the structured data obtained during retrieval in their payload. |
| includeReferences |
boolean |
Indicates whether references should be included for data retrieved from this source. |
| kind |
string:
indexed |
The type of the knowledge source. |
| knowledgeSourceName |
string |
The name of the index the params apply to. |
| rerankerThreshold |
number (float) |
The reranker threshold all retrieved documents must meet to be included in the response. |
KnowledgeBaseActivityRecordType
The type of activity record.
| Value | Description |
|---|---|
| searchIndex |
Search index retrieval activity. |
| azureBlob |
Azure Blob retrieval activity. |
| indexedOneLake |
Indexed OneLake retrieval activity. |
| web |