---
title: "Use the memories extracted from the files uploaded to generate an answer. The query can include filters to use only a subset of the memories available."
method: POST
path: "/ask"
tags: ["Microsoft.KernelMemory.ServiceAssembly"]
---

# Use the memories extracted from the files uploaded to generate an answer. The query can include filters to use only a subset of the memories available.

`POST /ask`

Answer a user question using the internal knowledge base.

## Request body

- MemoryQuery
  - `index` string, nullable
  - `question` string, nullable
  - `filters` object[], nullable
  - `minRelevance` number, double
  - `stream` boolean
  - `args` object, nullable

## Response `200`

OK

- MemoryAnswer
  - `streamState` 'error' | 'reset' | 'append' | 'last'
  - `question` string, nullable
  - `noResult` boolean
  - `noResultReason` string, nullable
  - `text` string, nullable
  - `tokenUsage` TokenUsage[], nullable
    - `timestamp` string, date-time
    - `serviceType` string, nullable
    - `modelType` string, nullable
    - `modelName` string, nullable
    - `tokenizerTokensIn` integer, nullable
    - `tokenizerTokensOut` integer, nullable
    - `serviceTokensIn` integer, nullable
    - `serviceTokensOut` integer, nullable
    - `serviceReasoningTokens` integer, nullable
  - `relevantSources` Citation[], nullable
    - `link` string, nullable
    - `index` string, nullable
    - `documentId` string, nullable
    - `fileId` string, nullable
    - `sourceContentType` string, nullable
    - `sourceName` string, nullable
    - `sourceUrl` string, nullable
    - `partitions` Partition[], nullable
      - `text` string, nullable
      - `relevance` number, float
      - `partitionNumber` integer
      - `sectionNumber` integer
      - `lastUpdate` string, date-time
      - `tags` object, nullable

## Other responses

- `401` — Unauthorized
- `403` — Forbidden
- `503` — Service Unavailable

## Changes

- **2025-03-22** `14051507a142` — 1 info
  - added the optional property `tokenUsage` to the response with the `200` status
- **2024-12-17** `f1234181a074` — 4 info
  - api operation id `AnswerQuestion` was added
  - added the new optional request property `stream`
  - added the non-success response with the status `503`
  - added the optional property `streamState` to the response with the `200` status
- **2024-10-19** `10e0db8acfa5` — 3 warning, 2 info
  - removed the request property `stream`
  - removed the optional property `streamState` from the response with the `200` status
  - removed the optional property `tokenUsage` from the response with the `200` status
  - api operation id `AnswerQuestion` removed and replaced with ``
  - …1 more

[Change history](https://skmtc.dev/azure/apis/microsoft-kernelmemory-serviceassembly/changes/ask/post.md)

---

[API](https://skmtc.dev/azure/apis/microsoft-kernelmemory-serviceassembly.md) · [All operations](https://skmtc.dev/azure/apis/microsoft-kernelmemory-serviceassembly/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/azure/microsoft-kernelmemory-serviceassembly/revisions/0c988a89a508/schema)
