curl --location --request POST https://api.writer.com/v1/graphs/question \ --header "Authorization: Bearer <token>" \ --header "Content-Type: application/json" \--data-raw '{"graph_ids":["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"],"question":"What is the generic name for the drug Bavencio?"}'
import os
from writerai import Writer
client = Writer(
# This is the default and can be omitted
api_key=os.environ.get("WRITER_API_KEY"),
)
question = client.graphs.question(
graph_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"],
question="What is the generic name for the drug Bavencio?"
)
print(question.answer)
import Writer from 'writer-sdk';
const client = new Writer({
apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
});
async function main() {
const question = await client.graphs.question({
graph_ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],
question: 'What is the generic name for the drug Bavencio?'
});
console.log(question.answer);
}
main();
{ "question": "What is the generic name for the drug Bavencio?", "answer": "avelumab", "sources": [ { "file_id": "1234", "snippet": "Bavencio is the brand name for avelumab." } ]}
Knowledge Graphs API
Question
Ask a question to specified Knowledge Graphs.
POST
/
v1
/
graphs
/
question
cURL
curl --location --request POST https://api.writer.com/v1/graphs/question \ --header "Authorization: Bearer <token>" \ --header "Content-Type: application/json" \--data-raw '{"graph_ids":["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"],"question":"What is the generic name for the drug Bavencio?"}'
import os
from writerai import Writer
client = Writer(
# This is the default and can be omitted
api_key=os.environ.get("WRITER_API_KEY"),
)
question = client.graphs.question(
graph_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"],
question="What is the generic name for the drug Bavencio?"
)
print(question.answer)
import Writer from 'writer-sdk';
const client = new Writer({
apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted
});
async function main() {
const question = await client.graphs.question({
graph_ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],
question: 'What is the generic name for the drug Bavencio?'
});
console.log(question.answer);
}
main();
{ "question": "What is the generic name for the drug Bavencio?", "answer": "avelumab", "sources": [ { "file_id": "1234", "snippet": "Bavencio is the brand name for avelumab." } ]}
Knowledge Graphs can be deployed org-wide (accessible to every team in the organization) or deployed to specific teams. Both are accessible via the API and SDK.
With an org-scoped API key, control team scope from the request body: pass team_ids on create or update, or filter list with the team_ids query parameter. Omit team_ids on list to see only org-wide Knowledge Graphs.
With a team-scoped API key, every request is automatically restricted to the key’s team. Create assigns to that team; list and retrieve return only that team’s Knowledge Graphs; body team_ids is not accepted.
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.
Detailed source information organized by reference type, providing comprehensive metadata about the sources used to generate the response.
Show child attributes
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Writer AI Studio","colors":{"primary":"#BFCBFF","light":"#6985FF","dark":"#5551ff"},"logo":{"light":"https://mintcdn.com/writer/YZ72OUP7BQyK8p2G/logo/writer_logo_light.svg?fit=max\u0026auto=format\u0026n=YZ72OUP7BQyK8p2G\u0026q=85\u0026s=c9a784871f9b98724bb1eae947e745ed","dark":"https://mintcdn.com/writer/YZ72OUP7BQyK8p2G/logo/writer_logo_dark.svg?fit=max\u0026auto=format\u0026n=YZ72OUP7BQyK8p2G\u0026q=85\u0026s=9e22a34b91e20df881d68634a0042c1d"},"favicon":"https://mintcdn.com/writer/z-qGRP1BKyHYhEJN/images/icons/favicon.svg?fit=max\u0026auto=format\u0026n=z-qGRP1BKyHYhEJN\u0026q=85\u0026s=33356fdc372b2640b92c5546da07c9e0","api":{"playground":{"display":"interactive"},"examples":{"languages":["curl","python","javascript"]}},"navbar":{"primary":{"type":"button","label":"Sign in","href":"https://app.writer.com/login"}},"footer":{"socials":{"x":"https://x.com/Get_Writer","github":"https://github.com/writer","linkedin":"https://www.linkedin.com/company/getwriter"}},"seo":{"metatags":{"description":"Writer AI Studio developer documentation - Build AI agents with APIs, SDKs, Agent Builder, and no-code tools. Integrate generative AI into your applications.","og:site_name":"Writer AI Studio Documentation","og:type":"website","twitter:card":"summary_large_image","twitter:site":"@Get_Writer"},"indexing":"all"},"integrations":{"gtm":{"tagId":"GTM-NXVXDK"},"segment":{"key":"o2ZzfP0pJxH4cihXBPrF4IlbGqmG34BA"}},"contextual":{"options":["copy","view","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"writer","hasAudioNarration":false,"actualSubdomain":"writer","customDomains":["dev.writer.com"],"gitSource":{"type":"github","owner":"writerinternal","repo":"docs","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae4c1eae34cca49cc969e2b","collectionId":"95a2c848-ef11-45d4-91ec-a4d1045cf7fd","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae4c1eae34cca49cc969e2b"},"feedback":{"thumbs":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae4c1eae34cca49cc969e2b","clientVersion":"0.0.4045","searchFilterCounts":[{"language":"default","tag":"Home","count":98},{"language":"default","tag":"Writer Framework","count":71},{"language":"default","tag":"Component reference","count":45},{"language":"default","tag":"API Reference","count":32},{"language":"default","tag":"Connect to your data","count":31},{"language":"default","tag":"Available prebuilt connectors","count":27},{"language":"default","tag":"Content","count":17},{"language":"default","tag":"Legacy API Reference","count":16},{"language":"default","tag":"Getting started","count":14},{"language":"default","tag":"Input","count":13}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"styles.css","content":"/* devanagari */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLGT9Z11lFc-K.woff2) format('woff2');\n unicode-range: U+0900-097F, U+1CD0-1CF4, U+1CF7-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B0A;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLGT9Z1JlFc-K.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLGT9Z1xlFQ.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n/* devanagari */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLEj6Z11lFc-K.woff2) format('woff2');\n unicode-range: U+0900-097F, U+1CD0-1CF4, U+1CF7-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B0A;\n}\n/* latin-ext */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLEj6Z1JlFc-K.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}\n/* latin */\n@font-face {\n font-family: 'Poppins';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_mintlify/assets/fonts/google/s/poppins/v24/pxiByp8kv8JHgFVrLEj6Z1xlFQ.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}\n:root{--purple-1:#5551FF;--purple-2:#4A46DA;--black:#000;--gray-1:#333}body{font-family:\"Graphik\",sans-serif;font-weight:400}body.bold{font-weight:600}h1,h2,h3{font-family:\"Poppins\",sans-serif}h1{font-weight:600!important}h2,h3{font-weight:500}img[src$=no-code],img[src$=quickstart]{border:1px solid #e4e7ed}img[src$=auth]{min-width:25%;width:35%;margin:auto}img[src$=auth-table]{min-width:25px;width:25px}.imageBorder,img[src$=framework]{border:1px solid #e4e7ed}.flex-none.min-w-full.text-sm.overflow-x-auto{background-color:#171b1a}.no-bullet li{list-style-type:none;font-size:small}.large-icon{width:60px;height:100%}.bg-primary\\/10{background-color:#bfcbff}.text-primary{color:#000}.dark .prompts{color:#828282}.dark .prompts,.papers,.prompts{font-family:'Roboto Mono',monospace}.prompts{color:#000}.papers{font-size:small;padding-left:20px;padding-right:20px;text-align:justify}td,th{padding:10px;text-align:left}.update table td,.update table th{word-break:break-word}.expandedImageContainer{padding:16px;border-radius:16px;background:#e9eef1;overflow:hidden;display:flex;justify-content:center}.expandedImageContainerInner{display:flex;align-items:flex-start;max-width:300px;max-height:210px}.expandedImageContainer img{max-height:210px}.components__table{table-layout:fixed;width:300px}.button-wrapper{margin-top:30px}.button{border:0;cursor:pointer;font-size:14px;font-weight:600;padding:8px 20px;position:relative;outline:0;transition:background-color .1s ease-in}.primary-button{background-color:var(--purple-1);border-radius:40px;color:#fff;display:inline-flex;align-items:center}.secondary-button{background-color:var(--black);border-radius:30px;color:#fff}.button--arrow{padding-right:40px}.componentFields td,.componentFields th{padding:8px;border:1px solid rgb(var(--gray-200))}.componentFields .desc{width:50ch}:is(.dark .componentFields td, .dark .componentFields th, .dark .blueprintFields td, .dark .blueprintFields th){border:1px solid rgb(var(--gray-800))}.blueprintFields td,.blueprintFields th{padding:8px;border:1px solid rgb(var(--gray-200));vertical-align:top}#topbar-cta-button{margin:0}#topbar-cta-button a,li[id=\"https://app.writer.com/login\"] a{display:inline-flex;align-items:center;background-color:var(--purple-1)!important;border-radius:9999px;padding:4px 14px;font-weight:600;font-size:14px;text-decoration:none;transition:background-color .2s ease;line-height:24px}#topbar-cta-button a span,li[id=\"https://app.writer.com/login\"] a div,li[id=\"https://app.writer.com/login\"] a span{color:#fff!important}#topbar-cta-button a:hover,li[id=\"https://app.writer.com/login\"] a:hover{background-color:var(--purple-2)!important}#topbar-cta-button svg{margin-left:4px;height:16px;width:16px}li[id=\"https://app.writer.com/login\"]{margin:0;max-width:100%;box-sizing:border-box}li[id=\"https://app.writer.com/login\"] a{display:inline-flex!important;align-items:center!important;border-radius:9999px!important;padding:4px 8px 4px 14px!important;font-weight:600!important;font-size:14px!important;text-decoration:none!important;transition:background-color .2s ease!important;line-height:24px!important;max-width:100%!important;box-sizing:border-box!important;white-space:nowrap!important;overflow:hidden!important}li[id=\"https://app.writer.com/login\"] svg{margin-left:0!important;height:16px!important;width:16px!important}#topbar-cta-button svg path,li[id=\"https://app.writer.com/login\"] svg path{stroke:#fff!important;stroke-width:1.5!important;stroke-linecap:round!important;fill:none!important}div[id=sidebar-content],div[id=sidebar],ul[class*=\"bg-zinc-950/5\"]{overflow-x:hidden;box-sizing:border-box}ul[class*=\"bg-zinc-950/5\"]{max-width:100%}#content-area.max-w-5xl{max-width:80rem}#content-area.max-w-xl{max-width:60rem!important}img.max-height-800{max-height:800px!important}img.max-width-80{max-width:80%!important}#navbar .nav-tabs{flex:1 1 auto!important;width:100%!important;justify-content:center!important}"}],"page":{"pagePath":"api-reference/kg-api/question","slug":"/api-reference/kg-api/question","pageMetadata":{"openapi":"post /v1/graphs/question","title":"Question","description":"Ask a question to specified Knowledge Graphs.","href":"/api-reference/kg-api/question"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Ask a question to specified Knowledge Graphs.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{Note}=_components;if(!Note)_missingMdxReference(`Note`,true);return _jsxs(Note,{children:[_jsxs(_components.p,{children:[`Knowledge Graphs can be deployed org-wide (accessible to every team in the organization) or `,_jsx(_components.a,{href:`https://support.writer.com/article/242-how-to-create-and-manage-a-knowledge-graph#Managing-a-Knowledge-Graph-R4Mg5`,children:`deployed to specific teams`}),`. Both are accessible via the API and SDK.`]}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`With an org-scoped API key`}),`, control team scope from the request body: pass `,_jsx(_components.code,{children:`team_ids`}),` on `,_jsx(_components.a,{href:`/api-reference/kg-api/create-graph`,children:`create`}),` or `,_jsx(_components.a,{href:`/api-reference/kg-api/update-graph`,children:`update`}),`, or filter `,_jsx(_components.a,{href:`/api-reference/kg-api/list-graphs`,children:`list`}),` with the `,_jsx(_components.code,{children:`team_ids`}),` query parameter. Omit `,_jsx(_components.code,{children:`team_ids`}),` on list to see only org-wide Knowledge Graphs.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`With a team-scoped API key`}),`, every request is automatically restricted to the key’s team. Create assigns to that team; list and retrieve return only that team’s Knowledge Graphs; body `,_jsx(_components.code,{children:`team_ids`}),` is not accepted.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"openapi":"post /v1/graphs/question","title":"Question","description":"Ask a question to specified Knowledge Graphs.","href":"/api-reference/kg-api/question"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"security":["56999df4-7c09-4d4b-9745-161d9f64c2c4"],"summary":"Question","description":"Ask a question to specified Knowledge Graphs.","tags":["KG API"],"operationId":"question","requestBody":"07fff369-67f9-4915-a537-3263cbbcf149","responses":{"200":"9042400e-1b35-4af5-a531-37694054c39f"},"x-codeSamples":[{"lang":"cURL","source":"curl --location --request POST https://api.writer.com/v1/graphs/question \\\n --header \"Authorization: Bearer \u003ctoken>\" \\\n --header \"Content-Type: application/json\" \\\n--data-raw '{\"graph_ids\":[\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\"],\"question\":\"What is the generic name for the drug Bavencio?\"}'"},{"lang":"JavaScript","source":"import Writer from 'writer-sdk';\n\nconst client = new Writer({\n apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const question = await client.graphs.question({\n graph_ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],\n question: 'What is the generic name for the drug Bavencio?'\n});\n\n console.log(question.answer);\n}\n\nmain();"},{"lang":"Python","source":"import os\nfrom writerai import Writer\n\nclient = Writer(\n # This is the default and can be omitted\n api_key=os.environ.get(\"WRITER_API_KEY\"),\n)\nquestion = client.graphs.question(\n graph_ids=[\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\"],\n question=\"What is the generic name for the drug Bavencio?\"\n)\nprint(question.answer)"}],"method":"post","type":"path","servers":["9ea97f90-7a1e-408e-a662-311712dc7764"],"path":"/v1/graphs/question","baseUrlOptions":["https://api.writer.com"],"title":"Question","codeSamples":[{"lang":"cURL","source":"curl --location --request POST https://api.writer.com/v1/graphs/question \\\n --header \"Authorization: Bearer \u003ctoken>\" \\\n --header \"Content-Type: application/json\" \\\n--data-raw '{\"graph_ids\":[\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\"],\"question\":\"What is the generic name for the drug Bavencio?\"}'"},{"lang":"JavaScript","source":"import Writer from 'writer-sdk';\n\nconst client = new Writer({\n apiKey: process.env['WRITER_API_KEY'], // This is the default and can be omitted\n});\n\nasync function main() {\n const question = await client.graphs.question({\n graph_ids: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],\n question: 'What is the generic name for the drug Bavencio?'\n});\n\n console.log(question.answer);\n}\n\nmain();"},{"lang":"Python","source":"import os\nfrom writerai import Writer\n\nclient = Writer(\n # This is the default and can be omitted\n api_key=os.environ.get(\"WRITER_API_KEY\"),\n)\nquestion = client.graphs.question(\n graph_ids=[\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\"],\n question=\"What is the generic name for the drug Bavencio?\"\n)\nprint(question.answer)"}],"requestExampleLanguages":["bash","python","javascript"],"requiredOnlyExamples":false,"requestExampleType":"codeSamples","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"content":{"application/json":{"schema":{"title":"question_request","required":["graph_ids","question"],"type":"object","properties":{"graph_ids":{"type":"array","items":{"type":"string","format":"uuid","uniqueKey":"graph_ids.items.[INDEX]","typeLabel":"string\u003cuuid>"},"minItems":1,"description":"The unique identifiers of the Knowledge Graphs to query.","isRequired":true,"uniqueKey":"graph_ids","typeLabel":"string\u003cuuid>[]"},"question":{"type":"string","description":"The question to answer using the Knowledge Graph.","isRequired":true,"uniqueKey":"question","typeLabel":"string"},"subqueries":{"type":"boolean","description":"Specify whether to include subqueries.","default":false,"uniqueKey":"subqueries","typeLabel":"boolean"},"stream":{"type":"boolean","description":"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.","default":false,"uniqueKey":"stream","typeLabel":"boolean"},"query_config":{"title":"graph_query_config","description":"Configuration options for Knowledge Graph queries, including search parameters and citation settings.","type":"object","properties":{"max_subquestions":{"type":"integer","format":"int32","minimum":1,"maximum":10,"default":6,"description":"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.","uniqueKey":"query_config.max_subquestions","typeLabel":"integer\u003cint32>"},"search_weight":{"type":"integer","format":"int32","minimum":0,"maximum":100,"default":50,"description":"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.","uniqueKey":"query_config.search_weight","typeLabel":"integer\u003cint32>"},"grounding_level":{"type":"number","format":"double","minimum":0,"maximum":1,"default":0,"description":"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.","uniqueKey":"query_config.grounding_level","typeLabel":"number\u003cdouble>"},"max_snippets":{"type":"integer","format":"int32","minimum":1,"maximum":60,"default":30,"description":"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.","uniqueKey":"query_config.max_snippets","typeLabel":"integer\u003cint32>"},"max_tokens":{"type":"integer","format":"int32","minimum":100,"maximum":8000,"default":4000,"description":"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.","uniqueKey":"query_config.max_tokens","typeLabel":"integer\u003cint32>"},"keyword_threshold":{"type":"number","format":"double","minimum":0,"maximum":1,"default":0.7,"description":"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.","uniqueKey":"query_config.keyword_threshold","typeLabel":"number\u003cdouble>"},"semantic_threshold":{"type":"number","format":"double","minimum":0,"maximum":1,"default":0.7,"description":"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.","uniqueKey":"query_config.semantic_threshold","typeLabel":"number\u003cdouble>"},"inline_citations":{"type":"boolean","default":false,"description":"Whether to include inline citations in the response, showing which Knowledge Graph sources were used. Default: false.","uniqueKey":"query_config.inline_citations","typeLabel":"boolean"}},"uniqueKey":"query_config","typeLabel":"graph_query_config · object"}},"uniqueKey":"","typeLabel":"question_request · object"},"examples":{"Example":{"title":"Example","value":{"graph_ids":["3c90c3cc-0d44-4b50-8888-8dd25736052a"],"question":"\u003cstring>","subqueries":false,"stream":false,"query_config":{"max_subquestions":6,"search_weight":50,"grounding_level":0,"max_snippets":30,"max_tokens":4000,"keyword_threshold":0.7,"semantic_threshold":0.7,"inline_citations":false}}}},"exampleType":"generated"}},"required":true,"exampleType":"generated"},"responses":{"9042400e-1b35-4af5-a531-37694054c39f":{"description":"","content":{"application/json":{"schema":{"title":"question_response","required":["question","answer","sources"],"type":"object","properties":{"question":{"type":"string","description":"The question that was asked.","isRequired":true,"uniqueKey":"question","typeLabel":"string"},"answer":{"type":"string","description":"The answer to the question.","isRequired":true,"uniqueKey":"answer","typeLabel":"string"},"sources":{"type":"array","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"sources.items.[INDEX].oneOf.0.file_id","typeLabel":"string"},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"sources.items.[INDEX].oneOf.0.snippet","typeLabel":"string"}},"uniqueKey":"sources.items.[INDEX].oneOf.0","typeLabel":"source · object"},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}},"uniqueKey":"sources.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"sources.items.[INDEX]","typeLabel":"source · object | null"},"isRequired":true,"uniqueKey":"sources","typeLabel":"(source · object | null)[]"},"subqueries":{"type":"array","items":{"oneOf":[{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"object","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question.","isRequired":true,"uniqueKey":"subqueries.items.[INDEX].oneOf.0.query","typeLabel":"string"},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content.","isRequired":true,"uniqueKey":"subqueries.items.[INDEX].oneOf.0.answer","typeLabel":"string"},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0.file_id","typeLabel":"string"},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0.snippet","typeLabel":"string"}},"uniqueKey":"subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0","typeLabel":"source · object"},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}},"uniqueKey":"subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX]","typeLabel":"source · object | null"},"isRequired":true,"uniqueKey":"subqueries.items.[INDEX].oneOf.0.sources","typeLabel":"(source · object | null)[]"}},"uniqueKey":"subqueries.items.[INDEX].oneOf.0","typeLabel":"sub_query · object"},{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"null","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question."},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content."},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}}]}}},"uniqueKey":"subqueries.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"subqueries.items.[INDEX]","typeLabel":"sub_query · object | null"},"uniqueKey":"subqueries","typeLabel":"(sub_query · object | null)[]"},"references":{"title":"references","description":"Detailed source information organized by reference type, providing comprehensive metadata about the sources used to generate the response.","type":"object","properties":{"files":{"type":"array","description":"Array of file-based references from uploaded documents in the Knowledge Graph.","items":{"title":"file","description":"A file-based reference containing text snippets from uploaded documents in the Knowledge Graph.","required":["text","fileId","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"references.files.items.[INDEX].text","typeLabel":"string"},"fileId":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"references.files.items.[INDEX].fileId","typeLabel":"string"},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets.","isRequired":true,"uniqueKey":"references.files.items.[INDEX].score","typeLabel":"number"},"page":{"type":"integer","format":"int32","description":"Page number where this snippet was found in the source document.","uniqueKey":"references.files.items.[INDEX].page","typeLabel":"integer\u003cint32>"},"cite":{"type":"string","description":"Unique citation ID that appears in inline citations within the response text (null if not cited).","uniqueKey":"references.files.items.[INDEX].cite","typeLabel":"string"}},"uniqueKey":"references.files.items.[INDEX]","typeLabel":"file · object"},"minItems":1,"uniqueKey":"references.files","typeLabel":"file · object[]"},"web":{"type":"array","description":"Array of web-based references from online sources accessed during the query.","items":{"title":"web","description":"A web-based reference containing text snippets from online sources accessed during the query.","required":["text","url","title","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the web source that was used to support the response.","isRequired":true,"uniqueKey":"references.web.items.[INDEX].text","typeLabel":"string"},"url":{"type":"string","description":"The URL of the web page where this content was found.","format":"uri","isRequired":true,"uniqueKey":"references.web.items.[INDEX].url","typeLabel":"string\u003curi>"},"title":{"type":"string","description":"The title of the web page where this content was found.","isRequired":true,"uniqueKey":"references.web.items.[INDEX].title","typeLabel":"string"},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets.","isRequired":true,"uniqueKey":"references.web.items.[INDEX].score","typeLabel":"number"}},"uniqueKey":"references.web.items.[INDEX]","typeLabel":"web · object"},"minItems":1,"uniqueKey":"references.web","typeLabel":"web · object[]"}},"uniqueKey":"references","typeLabel":"references · object"}},"uniqueKey":"","typeLabel":"question_response · object"},"example":{"question":"What is the generic name for the drug Bavencio?","answer":"avelumab","sources":[{"file_id":"1234","snippet":"Bavencio is the brand name for avelumab."}]},"examples":{"Example":{"title":"Example","value":{"question":"What is the generic name for the drug Bavencio?","answer":"avelumab","sources":[{"file_id":"1234","snippet":"Bavencio is the brand name for avelumab."}]}}},"exampleType":"examples"},"text/event-stream":{"schema":{"required":["data"],"type":"object","properties":{"data":{"title":"question_response","required":["question","answer","sources"],"type":"object","properties":{"question":{"type":"string","description":"The question that was asked.","isRequired":true,"uniqueKey":"data.question","typeLabel":"string"},"answer":{"type":"string","description":"The answer to the question.","isRequired":true,"uniqueKey":"data.answer","typeLabel":"string"},"sources":{"type":"array","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"data.sources.items.[INDEX].oneOf.0.file_id","typeLabel":"string"},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"data.sources.items.[INDEX].oneOf.0.snippet","typeLabel":"string"}},"uniqueKey":"data.sources.items.[INDEX].oneOf.0","typeLabel":"source · object"},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}},"uniqueKey":"data.sources.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"data.sources.items.[INDEX]","typeLabel":"source · object | null"},"isRequired":true,"uniqueKey":"data.sources","typeLabel":"(source · object | null)[]"},"subqueries":{"type":"array","items":{"oneOf":[{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"object","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question.","isRequired":true,"uniqueKey":"data.subqueries.items.[INDEX].oneOf.0.query","typeLabel":"string"},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content.","isRequired":true,"uniqueKey":"data.subqueries.items.[INDEX].oneOf.0.answer","typeLabel":"string"},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0.file_id","typeLabel":"string"},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0.snippet","typeLabel":"string"}},"uniqueKey":"data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.0","typeLabel":"source · object"},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}},"uniqueKey":"data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"data.subqueries.items.[INDEX].oneOf.0.sources.items.[INDEX]","typeLabel":"source · object | null"},"isRequired":true,"uniqueKey":"data.subqueries.items.[INDEX].oneOf.0.sources","typeLabel":"(source · object | null)[]"}},"uniqueKey":"data.subqueries.items.[INDEX].oneOf.0","typeLabel":"sub_query · object"},{"title":"sub_query","description":"A sub-question generated to break down complex queries into more manageable parts, along with its answer and supporting sources.","required":["query","answer","sources"],"type":"null","properties":{"query":{"type":"string","description":"The subquery that was generated to help answer the main question."},"answer":{"type":"string","description":"The answer to the subquery based on Knowledge Graph content."},"sources":{"type":"array","description":"Array of source snippets that were used to answer this subquery.","items":{"oneOf":[{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"object","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}},{"title":"source","description":"A source snippet containing text and fileId from Knowledge Graph content.","required":["file_id","snippet"],"type":"null","properties":{"file_id":{"type":"string","description":"The unique identifier of the file in your Writer account."},"snippet":{"type":"string","description":"The exact text snippet from the source document that was used to support the response."}}}]}}},"uniqueKey":"data.subqueries.items.[INDEX].oneOf.1","typeLabel":"null"}],"uniqueKey":"data.subqueries.items.[INDEX]","typeLabel":"sub_query · object | null"},"uniqueKey":"data.subqueries","typeLabel":"(sub_query · object | null)[]"},"references":{"title":"references","description":"Detailed source information organized by reference type, providing comprehensive metadata about the sources used to generate the response.","type":"object","properties":{"files":{"type":"array","description":"Array of file-based references from uploaded documents in the Knowledge Graph.","items":{"title":"file","description":"A file-based reference containing text snippets from uploaded documents in the Knowledge Graph.","required":["text","fileId","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the source document that was used to support the response.","isRequired":true,"uniqueKey":"data.references.files.items.[INDEX].text","typeLabel":"string"},"fileId":{"type":"string","description":"The unique identifier of the file in your Writer account.","isRequired":true,"uniqueKey":"data.references.files.items.[INDEX].fileId","typeLabel":"string"},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets.","isRequired":true,"uniqueKey":"data.references.files.items.[INDEX].score","typeLabel":"number"},"page":{"type":"integer","format":"int32","description":"Page number where this snippet was found in the source document.","uniqueKey":"data.references.files.items.[INDEX].page","typeLabel":"integer\u003cint32>"},"cite":{"type":"string","description":"Unique citation ID that appears in inline citations within the response text (null if not cited).","uniqueKey":"data.references.files.items.[INDEX].cite","typeLabel":"string"}},"uniqueKey":"data.references.files.items.[INDEX]","typeLabel":"file · object"},"minItems":1,"uniqueKey":"data.references.files","typeLabel":"file · object[]"},"web":{"type":"array","description":"Array of web-based references from online sources accessed during the query.","items":{"title":"web","description":"A web-based reference containing text snippets from online sources accessed during the query.","required":["text","url","title","score"],"type":"object","properties":{"text":{"type":"string","description":"The exact text snippet from the web source that was used to support the response.","isRequired":true,"uniqueKey":"data.references.web.items.[INDEX].text","typeLabel":"string"},"url":{"type":"string","description":"The URL of the web page where this content was found.","format":"uri","isRequired":true,"uniqueKey":"data.references.web.items.[INDEX].url","typeLabel":"string\u003curi>"},"title":{"type":"string","description":"The title of the web page where this content was found.","isRequired":true,"uniqueKey":"data.references.web.items.[INDEX].title","typeLabel":"string"},"score":{"type":"number","description":"Internal score used during the retrieval process for ranking and selecting relevant snippets.","isRequired":true,"uniqueKey":"data.references.web.items.[INDEX].score","typeLabel":"number"}},"uniqueKey":"data.references.web.items.[INDEX]","typeLabel":"web · object"},"minItems":1,"uniqueKey":"data.references.web","typeLabel":"web · object[]"}},"uniqueKey":"data.references","typeLabel":"references · object"}},"isRequired":true,"uniqueKey":"data","typeLabel":"question_response · object"}},"uniqueKey":"","typeLabel":"object"},"example":{"data":[{"question":"What is the generic name for the drug Bavencio?","answer":"avelumab","sources":[{"file_id":"1234","snippet":"Bavencio is the brand name for avelumab."}]}]},"examples":{"Example":{"title":"Example","value":{"data":[{"question":"What is the generic name for the drug Bavencio?","answer":"avelumab","sources":[{"file_id":"1234","snippet":"Bavencio is the brand name for avelumab."}]}]}}},"exampleType":"examples"}},"exampleType":"examples"}},"security":{"56999df4-7c09-4d4b-9745-161d9f64c2c4":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your [Writer API key](https://dev.writer.com/api-reference/api-keys).","scopes":[],"schemeName":"bearerAuth"}}},"servers":{"9ea97f90-7a1e-408e-a662-311712dc7764":{"url":"https://api.writer.com"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your [Writer API key](https://dev.writer.com/api-reference/api-keys).","scopes":[],"schemeName":"bearerAuth"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your [Writer API key](https://dev.writer.com/api-reference/api-keys).","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"bearerAuth","name":"Authorization"}],"title":"bearerAuth"}]},"originalFileLocation":"api-reference/gateway-api-schema.yaml"},"subdomain":"writer","siteName":"Writer AI Studio","title":"Question - Writer AI Studio","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-26T15:06:18.469Z","originalFileLocation":"api-reference/kg-api/question.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Ask a question to specified Knowledge Graphs.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Writer AI Studio\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Question - Writer AI Studio\">\u003cmeta data-mint-head property=\"og:description\" content=\"Ask a question to specified Knowledge Graphs.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Writer AI Studio Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://dev.writer.com/api-reference/kg-api/question\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://writer.mintlify.app/_mintlify/api/og/v2?division=Knowledge+Graphs+API\u0026amp;title=Question\u0026amp;description=Ask+a+question+to+specified+Knowledge+Graphs.\u0026amp;theme=9c7f3bd87cb846f8ead27220\u0026amp;signature=33f07e69b6b78153fb121899e8cc01e925911bc3834422ff8698893970a0807d\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Question - Writer AI Studio\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Ask a question to specified Knowledge Graphs.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://writer.mintlify.app/_mintlify/api/og/v2?division=Knowledge+Graphs+API\u0026amp;title=Question\u0026amp;description=Ask+a+question+to+specified+Knowledge+Graphs.\u0026amp;theme=9c7f3bd87cb846f8ead27220\u0026amp;signature=33f07e69b6b78153fb121899e8cc01e925911bc3834422ff8698893970a0807d\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/writer/rBMYB50U__7D_mBT/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Writer AI Studio\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#BFCBFF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://dev.writer.com/api-reference/kg-api/question\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/kg-api/question.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://dev.writer.com/#organization\",\"name\":\"Writer AI Studio\",\"url\":\"https://dev.writer.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/writer/YZ72OUP7BQyK8p2G/logo/writer_logo_light.svg?fit=max\u0026auto=format\u0026n=YZ72OUP7BQyK8p2G\u0026q=85\u0026s=c9a784871f9b98724bb1eae947e745ed\"}},{\"@type\":\"WebSite\",\"@id\":\"https://dev.writer.com#website\",\"name\":\"Writer AI Studio\",\"url\":\"https://dev.writer.com\",\"publisher\":{\"@id\":\"https://dev.writer.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://dev.writer.com/api-reference/kg-api/question#webpage\",\"url\":\"https://dev.writer.com/api-reference/kg-api/question\",\"name\":\"Question\",\"description\":\"Ask a question to specified Knowledge Graphs.\",\"dateModified\":\"2026-08-26T15:06:18.469Z\",\"isPartOf\":{\"@id\":\"https://dev.writer.com#website\"},\"breadcrumb\":{\"@id\":\"https://dev.writer.com/api-reference/kg-api/question#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://dev.writer.com/api-reference/kg-api/question#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Knowledge Graphs API\",\"item\":\"https://dev.writer.com/api-reference/kg-api/create-graph\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Question\",\"item\":\"https://dev.writer.com/api-reference/kg-api/question\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://dev.writer.com/api-reference/kg-api/question#apireference\",\"headline\":\"Question\",\"name\":\"Question\",\"description\":\"Ask a question to specified Knowledge Graphs.\",\"url\":\"https://dev.writer.com/api-reference/kg-api/question\",\"mainEntityOfPage\":{\"@id\":\"https://dev.writer.com/api-reference/kg-api/question#webpage\"},\"dateModified\":\"2026-08-26T15:06:18.469Z\",\"publisher\":{\"@id\":\"https://dev.writer.com/#organization\"},\"isPartOf\":{\"@id\":\"https://dev.writer.com#website\"}}]}\u003c/script>","siteName":"Writer AI Studio","nav":{"global":null,"tabs":[{"tab":"Home","icon":"house","pages":[{"title":"Home","href":"/home/introduction"}]},{"tab":"Writer Framework","icon":"shapes","hidden":true,"pages":[{"title":"Writer Framework","href":"/framework/introduction"}]},{"tab":"API Reference","icon":"key","groups":[{"group":"General usage","pages":[{"title":"Manage API keys","sidebarTitle":"API Keys","href":"/api-reference/api-keys"},{"title":"Understand error codes","sidebarTitle":"Error codes","href":"/api-reference/error-codes"},{"title":"Understand rate limits","sidebarTitle":"Rate limits","href":"/api-reference/rate-limits"},{"title":"Paginate API results","sidebarTitle":"Pagination","href":"/api-reference/pagination"},{"title":"Secure your integration","sidebarTitle":"Integration security guide","href":"/api-reference/security"}]},{"group":"Applications API","pages":[{"openapi":"post /v1/applications/{application_id}","title":"Generate from application","href":"/api-reference/application-api/applications"},{"openapi":"get /v1/applications","title":"List applications","href":"/api-reference/application-api/list-applications"},{"openapi":"get /v1/applications/{application_id}","title":"Application details","href":"/api-reference/application-api/application-details"},{"openapi":"post /v1/applications/{application_id}/jobs","title":"Generate from application (async)","href":"/api-reference/application-api/generate-application-job"},{"openapi":"get /v1/applications/{application_id}/jobs","title":"Retrieve all jobs","href":"/api-reference/application-api/application-jobs"},{"openapi":"get /v1/applications/jobs/{job_id}","title":"Retrieve a single job","href":"/api-reference/application-api/get-single-async-job"},{"openapi":"post /v1/applications/jobs/{job_id}/retry","title":"Retry job execution","href":"/api-reference/application-api/post-retry-async-job"},{"openapi":"get /v1/applications/{application_id}/graphs","title":"Retrieve graphs","href":"/api-reference/application-api/get-application-graphs"},{"openapi":"put /v1/applications/{application_id}/graphs","title":"Associate graphs","href":"/api-reference/application-api/put-application-graphs"}]},{"group":"Completions API","pages":[{"openapi":"get /v1/models","title":"List models","href":"/api-reference/completion-api/list-models"},{"openapi":"post /v1/completions","title":"Text generation","href":"/api-reference/completion-api/text-generation"},{"openapi":"post /v1/chat","title":"Chat completion","href":"/api-reference/completion-api/chat-completion"}]},{"group":"Files API","pages":[{"openapi":"post /v1/files","title":"Upload file","href":"/api-reference/file-api/upload-files"},{"openapi":"get /v1/files/{file_id}","title":"Retrieve file","href":"/api-reference/file-api/get-file"},{"openapi":"get /v1/files","title":"List files","href":"/api-reference/file-api/get-all-files"},{"openapi":"get /v1/files/{file_id}/download","title":"Download file","href":"/api-reference/file-api/download-file"},{"openapi":"delete /v1/files/{file_id}","title":"Delete file","href":"/api-reference/file-api/delete-file"},{"openapi":"post /v1/files/retry","title":"Retry failed files","href":"/api-reference/file-api/files-retry"}]},{"group":"Knowledge Graphs API","pages":[{"openapi":"post /v1/graphs","title":"Create graph","href":"/api-reference/kg-api/create-graph"},{"openapi":"get /v1/graphs","title":"List graphs","href":"/api-reference/kg-api/list-graphs"},{"openapi":"get /v1/graphs/{graph_id}","title":"Retrieve graph","href":"/api-reference/kg-api/retrieve-graph"},{"openapi":"put /v1/graphs/{graph_id}","title":"Update graph","href":"/api-reference/kg-api/update-graph"},{"openapi":"delete /v1/graphs/{graph_id}","title":"Delete graph","href":"/api-reference/kg-api/delete-graph"},{"openapi":"post /v1/graphs/{graph_id}/file","title":"Add file to graph","href":"/api-reference/kg-api/add-file-to-graph"},{"openapi":"delete /v1/graphs/{graph_id}/file/{file_id}","title":"Remove file from graph","description":"Remove a file from a Knowledge Graph.","href":"/api-reference/kg-api/remove-file-from-graph"},{"openapi":"post /v1/graphs/question","title":"Question","href":"/api-reference/kg-api/question"}]},{"group":"Tools API","pages":[{"openapi":"post /v1/tools/pdf-parser/{file_id}","title":"Parse PDF","description":"Parse PDF to other formats.","href":"/api-reference/tool-api/pdf-parser"}]}]},{"tab":"Legacy API Reference","hidden":true,"pages":[{"title":"Legacy API Reference","href":"/api-reference-legacy/billing/get-your-organization-subscription-details"}]}]},"basePath":"","title":"Question - Writer AI Studio","buildId":"dpl_36EDyZCDfRuoUD9af5CH4M1bqY2h","deploymentId":"dpl_36EDyZCDfRuoUD9af5CH4M1bqY2h","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-DCDCdBVX.js","utils-ME8dDnLe.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-0e84ACsd.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-wgRBj-ia.js","snippetPresets-C11Sgb-o.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-C0lapOpP.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-ZeRQV8fF.js","shallow-BupWh095.js","getApiPlaygroundDisplay-BnYQO2Ss.js","CodeSnippet-RKKOc8c_.js","CodeSnippets-Drf_m8wS.js","Page-Bevw23-4.js","getPastedJson-u6QiPzNZ.js","icon-Bb-CBSxO.js","MethodPill-F7l5AI7V.js","DuplicateIcon-IiAXkdSg.js","createIcon-FliI8EBc.js","DynamicMarkdown-B62XqCSI.js","SectionHeading-Dj31pT03.js","axios-vUo_bRtp.js","Markdown-BOgQCTwD.js","clsx-BIWXJmsZ.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-DKZWslLH.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-UDqbR6xh.js"]}