---
title: "Question"
method: POST
path: "/v1/graphs/question"
tags: ["KG API"]
---

# Question

`POST /v1/graphs/question`

Ask a question to specified Knowledge Graphs.

## Request body

- QuestionRequest
  - `graph_ids` string[], required — The unique identifiers of the Knowledge Graphs to query.
  - `subqueries` boolean — Specify whether to include subqueries.
  - `question` string, required — The question to answer using the Knowledge Graph.
  - `stream` boolean — Determines whether the model's output should be streamed. If true, the output is generated and sent incrementally, which can be useful for real-time applications.
  - `query_config` GraphQueryConfig — Configuration options for Knowledge Graph queries.
    - `max_subquestions` integer — Maximum number of subquestions to generate when processing complex queries. Set higher to improve detail, set lower to reduce response time. Range: 1-10, Default: 6.
    - `search_weight` integer — Weight given to search results when ranking and selecting relevant information. Higher values (closer to 100) prioritize keyword-based matching, while lower values (closer to 0) prioritize semantic similarity matching. Use higher values for exact keyword searches, lower values for conceptual similarity searches. Range: 0-100, Default: 50.
    - `grounding_level` number, double — Level of grounding required for responses, controlling how closely answers must be tied to source material. Set lower for grounded outputs, higher for creativity. Higher values (closer to 1.0) allow more creative interpretation, while lower values (closer to 0.0) stick more closely to source material. Range: 0.0-1.0, Default: 0.0.
    - `max_snippets` integer — Maximum number of text snippets to retrieve from the Knowledge Graph for context. Works in concert with `search_weight` to control best matches vs broader coverage. While technically supports 1-60, values below 5 may return no results due to RAG implementation. Recommended range: 5-25. Due to RAG system behavior, you may see more snippets than requested. Range: 1-60, Default: 30.
    - `max_tokens` integer — Maximum number of tokens the model can generate in the response. This controls the length of the AI's answer. Set higher for longer answers, set lower for shorter, faster answers. Range: 100-8000, Default: 4000.
    - `keyword_threshold` number, double — Threshold for keyword-based matching when searching Knowledge Graph content. Set higher for stricter relevance, lower for broader range. Higher values (closer to 1.0) require stronger keyword matches, while lower values (closer to 0.0) allow more lenient matching. Range: 0.0-1.0, Default: 0.7.
    - `semantic_threshold` number, double — Threshold for semantic similarity matching when searching Knowledge Graph content. Set higher for stricter relevance, lower for broader range. Higher values (closer to 1.0) require stronger semantic similarity, while lower values (closer to 0.0) allow more lenient semantic matching. Range: 0.0-1.0, Default: 0.7.
    - `inline_citations` boolean — Whether to include inline citations in the response, showing which Knowledge Graph sources were used. Default: false.

## Response `200`

- QuestionResponse
  - `question` string, required — The question that was asked.
  - `answer` string, required — The answer to the question.
  - `sources` Source[], required
    - `file_id` string, required — The unique identifier of the file in your Writer account.
    - `snippet` string, required — The exact text snippet from the source document that was used to support the response.
  - `subqueries` SubQuery[]
    - `query` string, required — The subquery that was generated to help answer the main question.
    - `answer` string, required — The answer to the subquery based on Knowledge Graph content.
    - `sources` Source[], required — Array of source snippets that were used to answer this subquery.
      - `file_id` string, required — The unique identifier of the file in your Writer account.
      - `snippet` string, required — The exact text snippet from the source document that was used to support the response.
  - `references` References — Detailed source information organized by reference type, providing comprehensive metadata about the sources used to generate the response.
    - `files` File[] — Array of file-based references from uploaded documents in the Knowledge Graph.
      - `text` string, required — The exact text snippet from the source document that was used to support the response.
      - `fileId` string, required — The unique identifier of the file in your Writer account.
      - `score` number, required — Internal score used during the retrieval process for ranking and selecting relevant snippets.
      - `page` integer — Page number where this snippet was found in the source document.
      - `cite` string — Unique citation ID that appears in inline citations within the response text (null if not cited).
    - `web` Web[] — Array of web-based references from online sources accessed during the query.
      - `text` string, required — The exact text snippet from the web source that was used to support the response.
      - `url` string, uri, required — The URL of the web page where this content was found.
      - `title` string, required — The title of the web page where this content was found.
      - `score` number, required — Internal score used during the retrieval process for ranking and selecting relevant snippets.

## Changes

- **2025-09-11** `3f87c8deb39e` — 3 info
  - added the new optional request property `query_config`
  - added the optional property `data/references` to the response with the `200` status (media type: text/event-stream)
  - added the optional property `references` to the response with the `200` status (media type: application/json)
- **2025-04-02** `d15316b8a3a0` — 4 info
  - the request property `stream` became optional
  - the request property `subqueries` became optional
  - the `stream` request property default value `false` was added
  - the `subqueries` request property default value `false` was added
- **2025-02-25** `3d3b2fe43375` — 6 breaking
  - the response property `data/sources/items/` became nullable for the status `200` (media type: text/event-stream)
  - the response property `data/subqueries/items/` became nullable for the status `200` (media type: text/event-stream)
  - the response property `data/subqueries/items/sources/items/` became nullable for the status `200` (media type: text/event-stream)
  - the response property `sources/items/` became nullable for the status `200` (media type: application/json)
  - …2 more
- **2024-11-08** `c350270f059b` — 1 info
  - added the media type `text/event-stream` for the response with the status `200`
- **2024-11-08** `9c49d7cc176d` — 1 breaking
  - removed the media type `text/event-stream` for the response with the status `200`

[Full history](https://skmtc.dev/writer/apis/api/changes/v1/graphs/question/post.md)

---

[API](https://skmtc.dev/writer/apis/api.md) · [All operations](https://skmtc.dev/writer/apis/api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/writer/api/revisions/ae230e1d8c09/schema)
