Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
agent_id
string<uuid>
required
Agent ID of the agent to query
Query Parameters
retrievals_only
boolean
default:false
Set to true to fetch retrieval content and metadata, and then skip generation of the response.
include_retrieval_content_text
boolean
default:false
Set to true to include the text of the retrieved contents in the response. If false, only metadata about the retrieved contents will be included, not content text. This parameter is ignored if retrievals_only is true, in which case content_text will always be returned. Content text and other metadata can also be fetched separately using the /agents/{agent_id}/query/{message_id}/retrieval/info endpoint.
Body
application/json
Request body for a POST /agents/{agent_id}/query request
messages
MessageAndRole · object[]
required
Messages sent so far in the conversation, ending in the latest user message. Add multiple objects to provide conversation history. Last message in the list must be a user-sent message (i.e. role equals "user").
Show child attributes
stream
boolean
default:false
Set to true to receive a streamed response
conversation_id
string<uuid>
An optional alternative to providing message history in the messages field. If provided, all messages in the messages list prior to the latest user-sent query will be ignored.
llm_model_id
string
Model ID of the specific fine-tuned or aligned LLM model to use. Defaults to base model if not specified.
structured_output
Structured Output · object
Custom output structure format.
Show child attributes
documents_filters
BaseMetadataFilter · object
Defines a custom metadata filter. The expected input is a dict which can have different operators, fields and values. For example:
Use lowercase for value when not using equals operator. For document_id and date_created the query is built using direct query without nesting.
BaseMetadataFilter
CompositeMetadataFilter
Show child attributes
Example:
{ "operator": "AND" }
override_configuration
Override Configuration · object
This will modify select configuration parameters for the agent during the response generation.
Show child attributes
Response
Successful Response
Response body for POST /query
conversation_id
string<uuid>
required
A unique identifier for the conversation. Can be passed to future /query calls to continue a conversation with the same message history.
retrieval_contents
RetrievalContentV0_1 · object[]
required
Relevant content retrieved to answer the query
Show child attributes
message_id
string<uuid>
A unique identifier for this specific message
message
Message · object
Response to the query request
Show child attributes
attributions
AttributionV0_1 · object[]
Attributions for the response
Show child attributes
groundedness_scores
GroundednessScore · object[]
Groundedness scores for the response
Show child attributes
Was this page helpful?
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Contextual AI Documentation","colors":{"primary":"#2e70ff","light":"#2e70ff","dark":"#2e70ff"},"logo":{"light":"https://mintcdn.com/contextualai/hbpTLlKqktq8fCLj/logo/light.svg?fit=max\u0026auto=format\u0026n=hbpTLlKqktq8fCLj\u0026q=85\u0026s=049c4ad3c96c7cc618c2d6b183e5a683","dark":"https://mintcdn.com/contextualai/hbpTLlKqktq8fCLj/logo/dark.svg?fit=max\u0026auto=format\u0026n=hbpTLlKqktq8fCLj\u0026q=85\u0026s=84c3b689b03ff7f98d343d078a9c3383","href":"https://contextual.ai"},"favicon":"https://mintcdn.com/contextualai/JZazZVco2S8P3AG4/favicon.svg?fit=max\u0026auto=format\u0026n=JZazZVco2S8P3AG4\u0026q=85\u0026s=0fe0b7d5cdbba2f5ffbe775459bc3911","appearance":{"default":"light","strict":true},"navbar":{"primary":{"type":"button","label":"Login","href":"https://app.contextual.ai"}},"footer":{"socials":{"x":"https://x.com/contextualai","github":"https://github.com/ContextualAI","linkedin":"https://www.linkedin.com/company/contextualai"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"contextualai","hasAudioNarration":false,"actualSubdomain":"contextualai","customDomains":["docs.contextual.ai"],"gitSource":{"type":"github","owner":"contextualai","repo":"mintlify","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ae925ddec046ea6c84b1a57:success","clientVersion":"0.0.4344","searchFilterCounts":[{"language":"default","tag":"API","count":66},{"language":"default","tag":"Guides","count":43},{"language":"default","tag":"Reference","count":42},{"language":"default","tag":"Agent Configs","count":26},{"language":"default","tag":"Agent Composer","count":21},{"language":"default","tag":"/extract","count":15},{"language":"default","tag":"For Developers","count":13},{"language":"default","tag":"Examples","count":13},{"language":"default","tag":"/agents","count":11},{"language":"default","tag":"Data Sources","count":10}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","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":"rbac-expansion","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":"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":"site-roles","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":"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":"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":"turbopuffer-dual-write","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":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"scripts/assistant.css","content":"[data-search-button],button[aria-label*=\"Search\"],button[aria-label*=\"search\"],.search-button,#search-button,[class*=\"SearchButton\"],[class*=\"searchButton\"]{display:none!important}.contextual-ai-keyword-search-results{position:absolute;background:white;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 10px 40px rgba(0, 0, 0, 0.15);z-index:1001;max-height:calc(100vh - 10rem);overflow-y:auto;display:none;animation:keywordSearchFadeIn 0.2s ease-out}@keyframes keywordSearchFadeIn{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.contextual-ai-keyword-search-results.visible{display:block}.contextual-ai-keyword-search-results::-webkit-scrollbar{width:6px}.contextual-ai-keyword-search-results::-webkit-scrollbar-track{background:transparent}.contextual-ai-keyword-search-results::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:3px}.contextual-ai-keyword-results-container{padding:6px}.contextual-ai-keyword-header{padding:12px 16px 8px 16px;border-bottom:1px solid #f3f4f6}.contextual-ai-keyword-count{font-size:11px;color:#9ca3af;font-weight:500;text-transform:uppercase;letter-spacing:0.5px}.contextual-ai-keyword-result-item{cursor:pointer;position:relative;border-radius:12px;display:flex;gap:12px;padding:10px 10px;align-items:center;transition:all 0.15s ease;text-decoration:none;color:inherit;margin-bottom:2px}.contextual-ai-keyword-result-item:last-child{margin-bottom:8px}.contextual-ai-keyword-result-item:hover{background:#f9fafb}.contextual-ai-keyword-result-icon{flex-shrink:0;width:16px;height:16px;color:#6b7280}.contextual-ai-keyword-result-icon.api-icon{color:#2e70ff}.contextual-ai-keyword-result-content{display:flex;flex-direction:column;flex:1;min-width:0;gap:4px}.contextual-ai-keyword-breadcrumbs{display:flex;gap:4px;align-items:center;min-width:0;flex:1}.contextual-ai-keyword-breadcrumb-item{font-size:12px;color:#9ca3af;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-shrink:1;min-width:0}.contextual-ai-keyword-breadcrumb-item:first-child{flex-shrink:0}.contextual-ai-keyword-breadcrumb-separator{flex-shrink:0;width:12px;height:12px;color:#9ca3af}.contextual-ai-keyword-title-row{display:flex;gap:8px;align-items:center}.contextual-ai-keyword-method-pill{font-weight:bold;font-size:11px;font-family:'Monaco', 'Menlo', 'Ubuntu Mono', monospace;border-radius:4px;padding:2px 6px;flex-shrink:0}.contextual-ai-keyword-method-pill.get{background:rgba(34, 197, 94, 0.2);color:#15803d}.contextual-ai-keyword-method-pill.post{background:rgba(59, 130, 246, 0.2);color:#1e40af}.contextual-ai-keyword-method-pill.put{background:rgba(251, 146, 60, 0.2);color:#c2410c}.contextual-ai-keyword-method-pill.delete{background:rgba(239, 68, 68, 0.2);color:#b91c1c}.contextual-ai-keyword-title{font-size:14px;line-height:18px;color:#1f2937;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.contextual-ai-keyword-description{font-size:12px;color:#6b7280;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.contextual-ai-keyword-result-item mark{background:transparent}.contextual-ai-keyword-result-item mark b{font-weight:500;color:#2e70ff}.contextual-ai-keyword-result-chevron{flex-shrink:0;width:20px;height:20px;color:transparent;transition:color 0.15s ease}.contextual-ai-keyword-result-item:hover .contextual-ai-keyword-result-chevron{color:#9ca3af}.contextual-ai-keyword-empty{padding:32px 16px;text-align:center;color:#9ca3af;font-size:14px}.contextual-ai-floating-bar .contextual-ai-keyword-search-results{top:calc(100% + 8px);left:0;right:0;min-width:500px}.contextual-ai-keyword-search-results.contextual-ai-keyword-inline{position:relative;width:100%;max-width:100%;box-sizing:border-box;background:white;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 4px 20px rgba(0, 0, 0, 0.08);max-height:380px;overflow-y:auto;overflow-x:hidden;margin-top:12px;display:block;animation:keywordSearchFadeIn 0.2s ease-out}@media (max-width: 840px){.contextual-ai-floating-bar .contextual-ai-keyword-search-results{min-width:100%}.contextual-ai-floating-bar{display:none!important}}.contextual-ai-mobile-icon{display:none;position:fixed;top:16px;right:52px;z-index:1000;background:transparent;padding:6px;cursor:pointer;color:#374151;align-items:center;justify-content:center}@media (max-width: 840px){.contextual-ai-mobile-icon{display:flex}}.contextual-ai-floating-bar{position:fixed;top:4px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:10px;background:white;border:1px solid #e5e7eb;border-radius:20px;padding:4px 16px;box-shadow:0 4px 12px rgba(0, 0, 0, 0.1);z-index:1000;max-width:480px;width:calc(100% - 48px);backdrop-filter:blur(10px);opacity:0;animation:floatingBarFadeIn 0.3s ease-out forwards;animation-delay:0.1s}@keyframes floatingBarFadeIn{from{opacity:0}to{opacity:1}}.contextual-ai-floating-bar input{flex:1;border:none;outline:none;font-size:14px;background:transparent;color:#1f2937;font-family:inherit}.contextual-ai-floating-bar input::placeholder{color:#9ca3af}.contextual-ai-floating-bar:focus-within{border-color:#9ca3af;box-shadow:0 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(156, 163, 175, 0.15)}.contextual-ai-floating-trigger{background:#2e70ff;color:white;border:none;padding:8px 16px;border-radius:16px;cursor:pointer;font-size:13px;font-weight:500;transition:all 0.2s ease;white-space:nowrap;font-family:inherit;transform:scale(0.90);transform-origin:right center}.contextual-ai-floating-trigger:hover{background:#1e5fef}#body-content.assistant-open{display:flex!important;flex-direction:row;max-width:none;padding-right:0!important}#body-content.assistant-open>div.w-full,#body-content.assistant-open>div[class*=\"w-full\"]{flex:1 1 0%;min-width:0;width:auto}#body-content.assistant-open>#content-area{flex:1 1 0%;min-width:0;width:auto}#body-content.assistant-open #table-of-contents-layout{display:none!important}.contextual-ai-panel{width:0;min-width:0;max-width:800px;height:calc(100vh - 96px);background:white;box-shadow:-2px 0 12px rgba(0, 0, 0, 0.1);z-index:50;display:flex;flex-direction:column;flex-shrink:0;overflow:hidden;transition:width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);border-left:1px solid #e5e7eb;position:sticky;top:96px}.contextual-ai-panel.open{width:380px}@media (max-width: 768px){.contextual-ai-panel{position:fixed;top:0;right:0;width:0;height:100vh;height:100dvh;z-index:2000}.contextual-ai-panel.open{width:100%;min-width:100%}}.contextual-ai-panel-resize-handle{position:absolute;left:0;top:0;bottom:0;width:6px;cursor:ew-resize;background:transparent;z-index:5;transition:background 0.2s ease}.contextual-ai-panel-resize-handle:hover,.contextual-ai-panel-resize-handle.resizing{background:rgba(46, 112, 255, 0.3)}@media (max-width: 768px){.contextual-ai-panel-resize-handle{display:none}}.contextual-ai-panel-header{padding:16px 20px;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;align-items:center;background:white;flex-shrink:0}.contextual-ai-panel-title{display:flex;flex-direction:column;align-items:flex-start;gap:2px;font-size:18px;font-weight:600;color:#1f2937}.contextual-ai-panel-subtitle{margin:0;font-size:12px;font-weight:400;color:#6b7280}.contextual-ai-header-actions{display:flex;align-items:center;gap:4px}.contextual-ai-header-btn{background:transparent;border:none;cursor:pointer;padding:8px;border-radius:6px;color:#6b7280;transition:all 0.2s ease;display:flex;align-items:center;justify-content:center}.contextual-ai-header-btn:hover{background:#f3f4f6;color:#374151}.contextual-ai-header-btn[data-tooltip]{position:relative}.contextual-ai-header-btn[data-tooltip]::after{content:attr(data-tooltip);position:absolute;top:calc(100% + 8px);left:50%;transform:translateX(-50%);background:#f3f4f6;color:#1f2937;font-size:11px;padding:3px 7px;border-radius:4px;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity 0.4s ease;will-change:opacity;z-index:9999}.contextual-ai-header-btn[data-tooltip]:hover::after{opacity:1}.contextual-ai-header-btn:active{transform:scale(0.95)}.contextual-ai-input-container{display:flex;align-items:flex-end;gap:12px;padding:16px 20px;background:white;border-top:1px solid #e5e7eb;flex-shrink:0}.contextual-ai-input-container textarea{flex:1;min-height:44px;max-height:120px;padding:12px 16px;border:1px solid #e5e7eb;border-radius:12px;font-size:14px;line-height:1.5;font-family:inherit;resize:none;outline:none;background:#f9fafb;color:#1f2937;transition:border-color 0.2s ease, box-shadow 0.2s ease}.contextual-ai-input-container textarea::placeholder{color:#9ca3af}.contextual-ai-input-container textarea:focus{border-color:#9ca3af;background:white;box-shadow:0 0 0 3px rgba(156, 163, 175, 0.15)}.contextual-ai-send{display:flex;align-items:center;justify-content:center;width:44px;height:44px;background:#1f2937;color:white;border:none;border-radius:12px;cursor:pointer;transition:all 0.2s ease;flex-shrink:0}.contextual-ai-send:hover{background:#374151;transform:scale(1.02)}.contextual-ai-send:active{transform:scale(0.98)}.contextual-ai-send:disabled{background:#d1d5db;cursor:not-allowed}.contextual-ai-send svg{width:18px;height:18px}.contextual-ai-messages{flex:1;overflow-y:auto;padding:20px;display:flex;flex-direction:column;gap:16px;background:#f9fafb}.contextual-ai-messages::-webkit-scrollbar{width:6px}.contextual-ai-messages::-webkit-scrollbar-track{background:transparent}.contextual-ai-messages::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:3px}.contextual-ai-messages::-webkit-scrollbar-thumb:hover{background:#9ca3af}.contextual-ai-welcome{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:40px 20px;color:#6b7280}.contextual-ai-welcome h3{margin:0 0 8px 0;font-size:18px;font-weight:600;color:#1f2937}.contextual-ai-welcome p{margin:0;font-size:14px;color:#6b7280}.contextual-ai-message{display:flex;flex-direction:column;animation:messageSlideIn 0.3s ease-out}@keyframes messageSlideIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.contextual-ai-message-user{align-items:flex-end}.contextual-ai-message-assistant{align-items:flex-start}.contextual-ai-message-content{max-width:100%;padding:12px 16px;border-radius:12px;font-size:14px;line-height:1.5;word-wrap:break-word}.contextual-ai-message-user .contextual-ai-message-content{background:#f3f4f6;color:#1f2937;border:1px solid #e5e7eb;border-bottom-right-radius:4px}.contextual-ai-message-assistant .contextual-ai-message-content{background:white;color:#1f2937;border:1px solid #e5e7eb;border-bottom-left-radius:4px}.contextual-ai-message-content code{background:#f3f4f6;padding:2px 6px;border-radius:3px;font-family:'Monaco', 'Menlo', 'Ubuntu Mono', monospace;font-size:0.9em;color:#1f2937;border:1px solid #e5e7eb}.contextual-ai-message-user .contextual-ai-message-content code{background:rgba(0, 0, 0, 0.06);color:#1f2937}.contextual-ai-message-content pre{background:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;padding:16px;overflow-x:auto;margin:12px 0;font-family:'Monaco', 'Menlo', 'Ubuntu Mono', monospace;font-size:13px;line-height:1.6;position:relative}.contextual-ai-message-content pre code{background:transparent;padding:0;border-radius:0;border:none;display:block;color:#1f2937}.contextual-ai-code-copy-btn{position:absolute;top:8px;right:8px;background:white;border:1px solid #d1d5db;border-radius:4px;padding:4px 8px;font-size:11px;color:#6b7280;cursor:pointer;transition:all 0.2s ease;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif}.contextual-ai-code-copy-btn:hover{background:#f3f4f6;color:#374151;border-color:#9ca3af}.contextual-ai-code-copy-btn.copied{color:#059669;border-color:#059669}.contextual-ai-table-wrapper{width:100%;overflow-x:auto;margin:12px 0;-webkit-overflow-scrolling:touch}.contextual-ai-table{width:max-content;min-width:100%;border-collapse:collapse;font-size:14px;border:1px solid #e5e7eb;border-radius:6px;overflow:hidden}.contextual-ai-table thead{background:#f9fafb}.contextual-ai-table th{padding:10px 12px;font-weight:600;text-align:left;border-bottom:2px solid #e5e7eb;color:#374151}.contextual-ai-table td{padding:10px 12px;border-bottom:1px solid #e5e7eb;color:#1f2937}.contextual-ai-table tbody tr:last-child td{border-bottom:none}.contextual-ai-table tbody tr:hover{background:#f9fafb}.contextual-ai-loading{display:flex;gap:4px;align-items:center}.contextual-ai-loading span{width:8px;height:8px;border-radius:50%;background:#9ca3af;animation:loadingDot 1.4s infinite ease-in-out}.contextual-ai-loading span:nth-child(1){animation-delay:-0.32s}.contextual-ai-loading span:nth-child(2){animation-delay:-0.16s}@keyframes loadingDot{0%,80%,100%{transform:scale(0.8);opacity:0.5}40%{transform:scale(1);opacity:1}}.contextual-ai-sources{margin-top:12px;margin-bottom:8px}.contextual-ai-sources-toggle{display:flex;align-items:center;gap:6px;background:none;border:none;padding:0;font-size:11px;color:#9ca3af;cursor:pointer;transition:color 0.2s ease;font-family:inherit}.contextual-ai-sources-toggle:hover{color:#6b7280}.contextual-ai-sources-chevron{transition:transform 0.2s ease}.contextual-ai-sources.expanded .contextual-ai-sources-chevron{transform:rotate(180deg)}.contextual-ai-sources-content{display:none;flex-wrap:wrap;gap:6px;margin-top:8px;padding-left:18px}.contextual-ai-sources.expanded .contextual-ai-sources-content{display:flex}.contextual-ai-source-item{background:transparent;border:none;padding:0;font-size:12px;color:#9ca3af;cursor:pointer;transition:color 0.2s ease;font-family:inherit;text-align:left;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.contextual-ai-source-item:hover{color:#2e70ff;text-decoration:underline}.contextual-ai-loading-container{display:flex;flex-direction:row;align-items:center;gap:8px}.contextual-ai-loading-phrase{font-size:12px;color:#6b7280;font-style:italic}.contextual-ai-modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0, 0, 0, 0.7);display:flex;align-items:center;justify-content:center;z-index:10000;animation:fadeIn 0.2s ease}@keyframes fadeIn{from{opacity:0}to{opacity:1}}.contextual-ai-modal{background:white;border-radius:12px;width:90%;max-width:600px;max-height:80vh;display:flex;flex-direction:column;box-shadow:0 20px 60px rgba(0, 0, 0, 0.3);animation:slideUp 0.3s ease}@keyframes slideUp{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.contextual-ai-modal-header{display:flex;align-items:center;justify-content:space-between;padding:24px 24px 0 24px;border-bottom:none}.contextual-ai-modal-header h3{margin:0;font-size:18px;font-weight:600;color:#1f2937;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;margin-right:12px}.contextual-ai-modal-close{background:transparent;border:none;cursor:pointer;padding:4px;border-radius:4px;color:#6b7280;transition:all 0.2s ease;display:flex;align-items:center;justify-content:center;flex-shrink:0}.contextual-ai-modal-close:hover{background:#f3f4f6;color:#374151}.contextual-ai-modal-content{padding:0 24px 24px 24px;overflow-y:auto;flex:1;max-height:60vh}.contextual-ai-modal-loading{text-align:center;color:#6b7280;padding:20px 0}.contextual-ai-preview-header{margin-bottom:16px;padding-bottom:12px;border-bottom:1px solid #e5e7eb}.contextual-ai-preview-header p{margin:4px 0;font-size:14px;color:#374151}.contextual-ai-preview-text{font-size:14px;line-height:1.6;color:#1f2937;background:#f9fafb;padding:16px;border-radius:8px;border:1px solid #e5e7eb;max-height:400px;overflow-y:auto}.contextual-ai-preview-image{background:white;padding:12px;border-radius:8px;border:1px solid #e5e7eb;text-align:center;overflow:auto;max-width:100%;transition:all 0.2s ease}.contextual-ai-preview-image img{max-width:100%;height:auto;border-radius:4px;box-shadow:0 2px 8px rgba(0, 0, 0, 0.1);transition:max-width 0.3s ease-in-out}.contextual-ai-preview-image.zoomed img{max-width:250%}.contextual-ai-modal-note{margin-top:16px;padding:12px;background:#f3f4f6;border-radius:6px;font-size:13px;color:#6b7280}.contextual-ai-citation{color:#2e70ff;cursor:pointer;transition:color 0.2s ease;font-size:0.9em;vertical-align:super;text-decoration:none}.contextual-ai-citation:hover{color:#1e5fef;text-decoration:underline}.contextual-ai-url-link{color:#2e70ff;text-decoration:none;transition:color 0.2s ease;word-break:break-all}.contextual-ai-url-link:hover{color:#1e5fef;text-decoration:underline}.contextual-ai-message-error{background:#fee2e2;border-color:#fca5a5;color:#991b1b}.contextual-ai-workflow-section{margin-top:8px;margin-bottom:8px}.contextual-ai-workflow-stage{display:flex;align-items:center;gap:8px;font-size:12px;color:#1e5fef;margin-bottom:8px}.contextual-ai-workflow-toggle{display:inline-flex;align-items:center;gap:8px;background:none;border:none;padding:0;font-size:12px;color:#6b7280;cursor:pointer;transition:color 0.2s ease;font-family:inherit}.contextual-ai-workflow-toggle:hover{color:#111827}.contextual-ai-workflow-status-icon{width:12px;height:12px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0}.contextual-ai-workflow-status-icon.running{background:#1e5fef}.contextual-ai-workflow-status-icon.completed{background:#10b981}.contextual-ai-workflow-status-icon svg{width:8px;height:8px;color:white}.contextual-ai-workflow-toggle .spinner{width:8px;height:8px;border:1.5px solid rgba(255, 255, 255, 0.3);border-top-color:white;border-radius:50%;animation:contextual-ai-spin 0.8s linear infinite}.contextual-ai-workflow-summary{margin-left:20px;margin-top:4px;font-size:10px;color:#9ca3af}.contextual-ai-workflow-details{margin-top:8px;display:none;flex-direction:column;gap:4px}.contextual-ai-workflow-details.expanded{display:flex}.contextual-ai-activity-item{display:flex;flex-direction:column;border-left:2px solid #e5e7eb;margin-left:5px;padding-left:12px;padding-bottom:8px}.contextual-ai-activity-header{display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer}.contextual-ai-activity-icon{color:#9ca3af;display:flex;align-items:center}.contextual-ai-activity-name{flex:1;color:#4b5563}.contextual-ai-activity-item.running .contextual-ai-activity-name{color:#111827;font-weight:500}.contextual-ai-activity-spinner{width:10px;height:10px;border:1.5px solid #e5e7eb;border-top-color:#1e5fef;border-radius:50%;animation:contextual-ai-spin 0.8s linear infinite}.contextual-ai-activity-chevron{width:10px;height:10px;color:#9ca3af;transition:transform 0.2s ease}.contextual-ai-activity-item.expanded .contextual-ai-activity-chevron{transform:rotate(90deg)}.contextual-ai-activity-content{display:none;margin-top:4px;padding:8px;background:#f9fafb;border-radius:4px;font-family:'Monaco', 'Menlo', 'Ubuntu Mono', monospace;font-size:11px;color:#4b5563;white-space:pre-wrap;max-height:150px;overflow-y:auto;overflow-x:hidden;word-break:break-word;border:1px solid #e5e7eb;box-sizing:border-box}.contextual-ai-activity-item.expanded .contextual-ai-activity-content{display:block}@keyframes contextual-ai-spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}"}]}
{"page":{"pagePath":"api-reference/agents-query/query-1","slug":"/api-reference/agents-query/query-1","pageMetadata":{"title":"Query","description":"Start a conversation with an `Agent` and receive its generated response, along with relevant retrieved data and attributions.","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents/{agent_id}/query","href":"/api-reference/agents-query/query-1","autogeneratedByOpenApi":true},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n code: \"code\",\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_components.p, {\n children: [\"Start a conversation with an \", _jsx(_components.code, {\n children: \"Agent\"\n }), \" and receive its generated response, along with relevant retrieved data and attributions.\"]\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{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Query","description":"Start a conversation with an `Agent` and receive its generated response, along with relevant retrieved data and attributions.","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents/{agent_id}/query","href":"/api-reference/agents-query/query-1","autogeneratedByOpenApi":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":["/_mintlify/custom/contextualai/1642d053fb0d02f4/scripts/openapi.js","/_mintlify/custom/contextualai/b4353988837b3a75/scripts/assistant.js"],"openApiReferenceData":{"operation":{"tags":["/agents/{id}/query"],"summary":"Query","description":"Start a conversation with an `Agent` and receive its generated response, along with relevant retrieved data and attributions.","operationId":"Query_agents__agent_id__query_post","parameters":["0ad512e9-04d4-483b-ab4b-a61822e0beb2","cb06104d-d38c-4d47-ba8c-721f5d1bfe74","213740c5-d52b-4b11-bdb2-31b0cd99cf94"],"requestBody":"0e3962d4-b5ae-4bea-982c-d4b3eae624fb","responses":{"200":"aea37535-bc27-4d7f-8201-0b4ea4563aae","422":"7aa73b65-47a9-4542-b8bf-9694959c0133"},"method":"post","type":"path","servers":["4f784b82-11e4-4de4-bd1c-959f6a96fca9"],"security":["00949c99-df54-43a8-8f74-943f448c3f3e"],"path":"/agents/{agent_id}/query","baseUrlOptions":["https://api.contextual.ai/v1"],"title":"Query","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{"0ad512e9-04d4-483b-ab4b-a61822e0beb2":{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Agent ID of the agent to query","title":"Agent Id","isRequired":true,"uniqueKey":"","typeLabel":"string\u003cuuid>"},"description":"Agent ID of the agent to query"},"cb06104d-d38c-4d47-ba8c-721f5d1bfe74":{"name":"retrievals_only","in":"query","required":false,"schema":{"type":"boolean","description":"Set to `true` to fetch retrieval content and metadata, and then skip generation of the response.","default":false,"title":"Retrievals Only","isRequired":false,"uniqueKey":"","typeLabel":"boolean"},"description":"Set to `true` to fetch retrieval content and metadata, and then skip generation of the response."},"213740c5-d52b-4b11-bdb2-31b0cd99cf94":{"name":"include_retrieval_content_text","in":"query","required":false,"schema":{"type":"boolean","description":"Set to `true` to include the text of the retrieved contents in the response. If `false`, only metadata about the retrieved contents will be included, not content text. This parameter is ignored if `retrievals_only` is `true`, in which case `content_text` will always be returned. Content text and other metadata can also be fetched separately using the `/agents/{agent_id}/query/{message_id}/retrieval/info` endpoint.","default":false,"title":"Include Retrieval Content Text","isRequired":false,"uniqueKey":"","typeLabel":"boolean"},"description":"Set to `true` to include the text of the retrieved contents in the response. If `false`, only metadata about the retrieved contents will be included, not content text. This parameter is ignored if `retrievals_only` is `true`, in which case `content_text` will always be returned. Content text and other metadata can also be fetched separately using the `/agents/{agent_id}/query/{message_id}/retrieval/info` endpoint."}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"messages":{"items":{"properties":{"content":{"type":"string","title":"Content","description":"Content of the message","isRequired":true,"uniqueKey":"messages.items.[INDEX].content","typeLabel":"string"},"role":{"type":"string","enum":["user","system","assistant","knowledge"],"title":"SenderType","description":"Role of the sender","isRequired":true,"uniqueKey":"messages.items.[INDEX].role","typeLabel":"enum\u003cstring>"},"custom_tags":{"items":{"type":"string","uniqueKey":"messages.items.[INDEX].custom_tags.items.[INDEX]","typeLabel":"string"},"type":"array","title":"Custom Tags","description":"Custom tags for the message","uniqueKey":"messages.items.[INDEX].custom_tags","typeLabel":"string[]"}},"type":"object","required":["content","role"],"title":"MessageAndRole","description":"Message object for a message sent or received in a conversation","uniqueKey":"messages.items.[INDEX]","typeLabel":"MessageAndRole · object"},"type":"array","title":"Messages","description":"Messages sent so far in the conversation, ending in the latest user message. Add multiple objects to provide conversation history. Last message in the list must be a `user`-sent message (i.e. `role` equals `\"user\"`).","isRequired":true,"uniqueKey":"messages","typeLabel":"MessageAndRole · object[]"},"stream":{"type":"boolean","title":"Stream","description":"Set to `true` to receive a streamed response","default":false,"uniqueKey":"stream","typeLabel":"boolean"},"conversation_id":{"type":"string","format":"uuid","title":"Conversation Id","description":"An optional alternative to providing message history in the `messages` field. If provided, all messages in the `messages` list prior to the latest user-sent query will be ignored.","uniqueKey":"conversation_id","typeLabel":"string\u003cuuid>"},"llm_model_id":{"type":"string","title":"Llm Model Id","description":"Model ID of the specific fine-tuned or aligned LLM model to use. Defaults to base model if not specified.","uniqueKey":"llm_model_id","typeLabel":"string"},"structured_output":{"properties":{"json_schema":{"additionalProperties":true,"type":"object","title":"Json Schema","description":"The output json structure.","isRequired":true,"uniqueKey":"structured_output.json_schema","typeLabel":"Json Schema · object"},"type":{"type":"string","enum":["JSON"],"title":"StructuredOutputType","description":"Type of the structured output. The default is JSON","default":"JSON","uniqueKey":"structured_output.type","typeLabel":"enum\u003cstring>"}},"additionalProperties":false,"type":"object","required":["json_schema"],"title":"Structured Output","description":"Custom output structure format.","uniqueKey":"structured_output","typeLabel":"Structured Output · object"},"documents_filters":{"oneOf":[{"type":"object","title":"BaseMetadataFilter","description":"Defines a custom metadata filter. The expected input is a dict which can have different operators, fields and values. For example:\n\n {\"field\": \"title\", \"operator\": \"startswith\", \"value\": \"hr-\"}\n\nUse **lowercase** for `value` when not using `equals` operator. For document_id and date_created the query is built using direct query without nesting.","required":["field","operator"],"example":{"operator":"AND"},"properties":{"field":{"type":"string","title":"Field","description":"Field name to search for in the metadata","isRequired":true,"uniqueKey":"documents_filters.oneOf.0.field","typeLabel":"string"},"operator":{"type":"string","enum":["equals","containsany","exists","startswith","gt","gte","lt","lte","notequals","between","wildcard"],"title":"FilterMetadataOperator","description":"Operator to be used for the filter.","isRequired":true,"uniqueKey":"documents_filters.oneOf.0.operator","typeLabel":"enum\u003cstring>"},"value":{"oneOf":[{"type":"string","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"documents_filters.oneOf.0.value.oneOf.0","typeLabel":"string"},{"type":"integer","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"documents_filters.oneOf.0.value.oneOf.1","typeLabel":"integer"},{"type":"number","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"documents_filters.oneOf.0.value.oneOf.2","typeLabel":"number"},{"type":"boolean","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"documents_filters.oneOf.0.value.oneOf.3","typeLabel":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string","uniqueKey":"documents_filters.oneOf.0.value.oneOf.4.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"integer","uniqueKey":"documents_filters.oneOf.0.value.oneOf.4.items.[INDEX].oneOf.1","typeLabel":"integer"},{"type":"number","uniqueKey":"documents_filters.oneOf.0.value.oneOf.4.items.[INDEX].oneOf.2","typeLabel":"number"},{"type":"boolean","uniqueKey":"documents_filters.oneOf.0.value.oneOf.4.items.[INDEX].oneOf.3","typeLabel":"boolean"}],"uniqueKey":"documents_filters.oneOf.0.value.oneOf.4.items.[INDEX]","typeLabel":"string | integer | number | boolean"},"title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"documents_filters.oneOf.0.value.oneOf.4","typeLabel":"(string | integer | number | boolean)[]"},{"type":"null","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"documents_filters.oneOf.0.value.oneOf.5","typeLabel":"null"}],"uniqueKey":"documents_filters.oneOf.0.value","typeLabel":"string | integer | number | boolean | (string | integer | number | boolean)[] | null"}},"uniqueKey":"documents_filters.oneOf.0","typeLabel":"BaseMetadataFilter · object"},{"type":"object","title":"CompositeMetadataFilter","description":"\"Defines a custom metadata filter as a Composite MetadataFilter. Which can be be a list of filters or nested filters.","required":["filters"],"example":{"filters":[{"field":"field1","operator":"equals","value":"value1"}],"operator":"AND"},"properties":{"filters":{"items":{"oneOf":[{"type":"object","title":"BaseMetadataFilter","description":"Defines a custom metadata filter. The expected input is a dict which can have different operators, fields and values. For example:\n\n {\"field\": \"title\", \"operator\": \"startswith\", \"value\": \"hr-\"}\n\nUse **lowercase** for `value` when not using `equals` operator. For document_id and date_created the query is built using direct query without nesting.","required":["field","operator"],"properties":{"field":{"type":"string","title":"Field","description":"Field name to search for in the metadata","isRequired":true,"uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.field","typeLabel":"string"},"operator":{"type":"string","enum":["equals","containsany","exists","startswith","gt","gte","lt","lte","notequals","between","wildcard"],"title":"FilterMetadataOperator","description":"Operator to be used for the filter.","isRequired":true,"uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.operator","typeLabel":"enum\u003cstring>"},"value":{"oneOf":[{"type":"string","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.0","typeLabel":"string"},{"type":"integer","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.1","typeLabel":"integer"},{"type":"number","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.2","typeLabel":"number"},{"type":"boolean","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.3","typeLabel":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string","uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"integer","uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX].oneOf.1","typeLabel":"integer"},{"type":"number","uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX].oneOf.2","typeLabel":"number"},{"type":"boolean","uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX].oneOf.3","typeLabel":"boolean"}],"uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX]","typeLabel":"string | integer | number | boolean"},"title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.4","typeLabel":"(string | integer | number | boolean)[]"},{"type":"null","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.5","typeLabel":"null"}],"uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value","typeLabel":"string | integer | number | boolean | (string | integer | number | boolean)[] | null"}},"uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX].oneOf.0","typeLabel":"BaseMetadataFilter · object"},{}],"uniqueKey":"documents_filters.oneOf.1.filters.items.[INDEX]","typeLabel":"BaseMetadataFilter · object"},"type":"array","title":"Filters","description":"Filters added to the query for filtering docs ","isRequired":true,"uniqueKey":"documents_filters.oneOf.1.filters","typeLabel":"BaseMetadataFilter · object[]"},"operator":{"oneOf":[{"type":"string","title":"CompositeOperator","description":"Composite operator to be used to combine filters","enum":["AND","OR","AND_NOT"],"uniqueKey":"documents_filters.oneOf.1.operator.oneOf.0","typeLabel":"enum\u003cstring>"},{"type":"null","description":"Composite operator to be used to combine filters","uniqueKey":"documents_filters.oneOf.1.operator.oneOf.1","typeLabel":"null"}],"uniqueKey":"documents_filters.oneOf.1.operator","typeLabel":"enum\u003cstring> | null"}},"uniqueKey":"documents_filters.oneOf.1","typeLabel":"CompositeMetadataFilter · object"}],"uniqueKey":"documents_filters","typeLabel":"BaseMetadataFilter · object | CompositeMetadataFilter · object"},"override_configuration":{"properties":{"system_prompt":{"type":"string","title":"System Prompt","description":"Override the system prompt for the agent during evaluation.","uniqueKey":"override_configuration.system_prompt","typeLabel":"string"},"filter_prompt":{"type":"string","title":"Filter Prompt","description":"Override the filter prompt for the agent during evaluation.","uniqueKey":"override_configuration.filter_prompt","typeLabel":"string"},"model":{"type":"string","title":"Model","description":"Override the model for the agent during evaluation.","uniqueKey":"override_configuration.model","typeLabel":"string"},"max_new_tokens":{"type":"integer","title":"Max New Tokens","description":"Override the max new tokens for the agent during evaluation.","uniqueKey":"override_configuration.max_new_tokens","typeLabel":"integer"},"top_p":{"type":"number","title":"Top P","description":"Override the top_p for the query. This will override the top_p for the agent during evaluation.","uniqueKey":"override_configuration.top_p","typeLabel":"number"},"temperature":{"type":"number","title":"Temperature","description":"Override the temperature for the query. This will override the temperature for the agent during evaluation.","uniqueKey":"override_configuration.temperature","typeLabel":"number"},"top_k_retrieved_chunks":{"type":"integer","title":"Top K Retrieved Chunks","description":"Override the top_k for the query. This will override the top_k for the agent during evaluation.","uniqueKey":"override_configuration.top_k_retrieved_chunks","typeLabel":"integer"},"top_k_reranked_chunks":{"type":"integer","title":"Top K Reranked Chunks","description":"Override the rerank_top_k for the query. This will override the rerank_top_k for the agent during evaluation.","uniqueKey":"override_configuration.top_k_reranked_chunks","typeLabel":"integer"},"enable_filter":{"type":"boolean","title":"Enable Filter","description":"Override the filter_retrievals for the query. This will override the filter_retrievals for the agent during evaluation.","uniqueKey":"override_configuration.enable_filter","typeLabel":"boolean"},"filter_model":{"type":"string","title":"Filter Model","description":"Override the filter_model for the query. This will override the filter_model for the agent during evaluation.","uniqueKey":"override_configuration.filter_model","typeLabel":"string"},"enable_rerank":{"type":"boolean","title":"Enable Rerank","description":"Override the rerank_retrievals for the agent during evaluation.","uniqueKey":"override_configuration.enable_rerank","typeLabel":"boolean"},"reranker":{"type":"string","title":"Reranker","description":"Override the reranker for the agent during evaluation.","uniqueKey":"override_configuration.reranker","typeLabel":"string"},"lexical_alpha":{"type":"number","title":"Lexical Alpha","description":"Override the lexical_alpha for the agent during evaluation.","uniqueKey":"override_configuration.lexical_alpha","typeLabel":"number"},"semantic_alpha":{"type":"number","title":"Semantic Alpha","description":"Override the semantic_alpha for the agent during evaluation.","uniqueKey":"override_configuration.semantic_alpha","typeLabel":"number"},"rerank_instructions":{"type":"string","title":"Rerank Instructions","description":"Override the rerank_instructions for the agent during evaluation.","uniqueKey":"override_configuration.rerank_instructions","typeLabel":"string"},"reranker_score_filter_threshold":{"type":"number","title":"Reranker Score Filter Threshold","description":"Override the reranker_score_filter_threshold for the agent during evaluation.","uniqueKey":"override_configuration.reranker_score_filter_threshold","typeLabel":"number"},"use_optimized_context":{"type":"boolean","title":"Use Optimized Context","description":"Override whether to use optimized context for this request. When true, optimized context will be used if available. When false, optimized context is disabled. When null/omitted, uses the agent's configured setting.","uniqueKey":"override_configuration.use_optimized_context","typeLabel":"boolean"}},"additionalProperties":false,"type":"object","title":"Override Configuration","description":"This will modify select configuration parameters for the agent during the response generation.","uniqueKey":"override_configuration","typeLabel":"Override Configuration · object"}},"additionalProperties":false,"type":"object","required":["messages"],"title":"QueryRequestV1","description":"Request body for a POST `/agents/{agent_id}/query` request","uniqueKey":"","typeLabel":"QueryRequestV1 · object"},"examples":{"Example":{"title":"Example","value":{"messages":[{"content":"\u003cstring>","custom_tags":["\u003cstring>"]}],"stream":false,"conversation_id":"3c90c3cc-0d44-4b50-8888-8dd25736052a","llm_model_id":"\u003cstring>","documents_filters":{"operator":"AND"},"override_configuration":{"system_prompt":"\u003cstring>","filter_prompt":"\u003cstring>","model":"\u003cstring>","max_new_tokens":123,"top_p":123,"temperature":123,"top_k_retrieved_chunks":123,"top_k_reranked_chunks":123,"enable_filter":true,"filter_model":"\u003cstring>","enable_rerank":true,"reranker":"\u003cstring>","lexical_alpha":123,"semantic_alpha":123,"rerank_instructions":"\u003cstring>","reranker_score_filter_threshold":123,"use_optimized_context":true}}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"aea37535-bc27-4d7f-8201-0b4ea4563aae":{"description":"Successful Response","content":{"application/json":{"schema":{"properties":{"conversation_id":{"type":"string","format":"uuid","title":"Conversation Id","description":"A unique identifier for the conversation. Can be passed to future `/query` calls to continue a conversation with the same message history.","isRequired":true,"uniqueKey":"conversation_id","typeLabel":"string\u003cuuid>"},"retrieval_contents":{"items":{"properties":{"type":{"type":"string","title":"Source","description":"Source type of the content. Will be `file` for any docs ingested through ingestion API.","isRequired":true,"uniqueKey":"retrieval_contents.items.[INDEX].type","typeLabel":"string"},"format":{"type":"string","enum":["pdf","html","htm","mhtml","doc","docx","ppt","pptx"],"title":"Format","description":"Format of the content, such as `pdf` or `html`","isRequired":true,"uniqueKey":"retrieval_contents.items.[INDEX].format","typeLabel":"enum\u003cstring>"},"content_id":{"type":"string","title":"Content Id","description":"Unique identifier of the retrieved content","isRequired":true,"uniqueKey":"retrieval_contents.items.[INDEX].content_id","typeLabel":"string"},"doc_id":{"type":"string","title":"Doc Id","description":"Unique identifier of the document","isRequired":true,"uniqueKey":"retrieval_contents.items.[INDEX].doc_id","typeLabel":"string"},"doc_name":{"type":"string","title":"Doc Name","description":"Name of the document","isRequired":true,"uniqueKey":"retrieval_contents.items.[INDEX].doc_name","typeLabel":"string"},"custom_metadata":{"additionalProperties":{"oneOf":[{"type":"boolean","uniqueKey":"retrieval_contents.items.[INDEX].custom_metadata.additionalProperties.oneOf.0","typeLabel":"boolean"},{"type":"number","uniqueKey":"retrieval_contents.items.[INDEX].custom_metadata.additionalProperties.oneOf.1","typeLabel":"number"},{"type":"integer","uniqueKey":"retrieval_contents.items.[INDEX].custom_metadata.additionalProperties.oneOf.2","typeLabel":"integer"},{"type":"string","uniqueKey":"retrieval_contents.items.[INDEX].custom_metadata.additionalProperties.oneOf.3","typeLabel":"string"},{"type":"array","items":{"type":"number","uniqueKey":"retrieval_contents.items.[INDEX].custom_metadata.additionalProperties.oneOf.4.items.[INDEX]","typeLabel":"number"},"uniqueKey":"retrieval_contents.items.[INDEX].custom_metadata.additionalProperties.oneOf.4","typeLabel":"number[]"}],"uniqueKey":"retrieval_contents.items.[INDEX].custom_metadata.additionalProperties","typeLabel":"boolean | number | integer | string | number[]"},"type":"object","title":"Custom Metadata","description":"Custom metadata for the document, provided by the user at ingestion time.Must be a JSON-serializable dictionary with string keys and simple primitive values (str, int, float, bool). The total size must not exceed 2 KB.The strings with date format must stay in date format or be avodied if not in date format.The 'custom_metadata.url' field is automatically included in returned attributions during query time, if provided.The default maximum metadata fields that can be used is 15, contact support if more is needed.","uniqueKey":"retrieval_contents.items.[INDEX].custom_metadata","typeLabel":"Custom Metadata · object"},"custom_metadata_config":{"additionalProperties":{"properties":{"in_chunks":{"type":"boolean","title":"In Chunks","description":"Whether to add in chunks. Defaults to True. The maximum amount of characters per metadata field that can be added to the prompt or rerank is 400. The maximum amount of metadata fields that can be added for prompt or retrieval is 10. Contact support@contextual.ai to request quota increases.","default":true,"uniqueKey":"retrieval_contents.items.[INDEX].custom_metadata_config.additionalProperties.in_chunks","typeLabel":"boolean"},"returned_in_response":{"type":"boolean","title":"Returned In Response","description":"Whether to add in response. Defaults to False","default":false,"uniqueKey":"retrieval_contents.items.[INDEX].custom_metadata_config.additionalProperties.returned_in_response","typeLabel":"boolean"},"filterable":{"type":"boolean","title":"Filterable","description":"Whether to use in filtering. Defaults to True","default":true,"uniqueKey":"retrieval_contents.items.[INDEX].custom_metadata_config.additionalProperties.filterable","typeLabel":"boolean"}},"type":"object","title":"MetadataFieldConfig","uniqueKey":"retrieval_contents.items.[INDEX].custom_metadata_config.additionalProperties","typeLabel":"MetadataFieldConfig · object"},"type":"object","title":"Custom Metadata Config","description":"A dictionary mapping metadata field names to the configuration to use for each field. If a metadata field is not present in the dictionary, the default configuration will be used. If the dictionary is not provided, metadata will be added in context for rerank and generation but will not be returned back to the user in retrievals in query API. Limits:\n- Maximum characters per metadata field (for prompt or rerank): **400**\n- Maximum number of metadata fields (for prompt or retrieval): **10** Contact support@contextual.ai to request quota increases.","uniqueKey":"retrieval_contents.items.[INDEX].custom_metadata_config","typeLabel":"Custom Metadata Config · object"},"number":{"type":"integer","title":"Number","description":"Index of the retrieved item in the retrieval_contents list (starting from 1)","default":1,"uniqueKey":"retrieval_contents.items.[INDEX].number","typeLabel":"integer"},"datastore_id":{"type":"string","title":"Datastore Id","description":"Unique identifier of the datastore","uniqueKey":"retrieval_contents.items.[INDEX].datastore_id","typeLabel":"string"},"page":{"type":"integer","title":"Page","description":"Page number of the content in the document","uniqueKey":"retrieval_contents.items.[INDEX].page","typeLabel":"integer"},"content_text":{"type":"string","title":"Content Text","description":"Text of the retrieved content. Included in response to a query if `include_retrieval_content_text` is True","uniqueKey":"retrieval_contents.items.[INDEX].content_text","typeLabel":"string"},"url":{"type":"string","title":"Url","description":"URL of the source content, if applicable","uniqueKey":"retrieval_contents.items.[INDEX].url","typeLabel":"string"},"ctxl_metadata":{"properties":{"document_title":{"type":"string","title":"Document Title","description":"Title of the document.","uniqueKey":"retrieval_contents.items.[INDEX].ctxl_metadata.document_title","typeLabel":"string"},"section_title":{"type":"string","title":"Section Title","description":"Title of the section.","uniqueKey":"retrieval_contents.items.[INDEX].ctxl_metadata.section_title","typeLabel":"string"},"is_figure":{"type":"boolean","title":"Is Figure","description":"Whether this chunk represents a figure.","uniqueKey":"retrieval_contents.items.[INDEX].ctxl_metadata.is_figure","typeLabel":"boolean"},"file_name":{"type":"string","title":"File Name","description":"Name of the source file.","uniqueKey":"retrieval_contents.items.[INDEX].ctxl_metadata.file_name","typeLabel":"string"},"chunk_size":{"type":"integer","title":"Chunk Size","description":"Size of the chunk in tokens or characters.","uniqueKey":"retrieval_contents.items.[INDEX].ctxl_metadata.chunk_size","typeLabel":"integer"},"file_format":{"type":"string","title":"File Format","description":"Format of the file (e.g., PDF, DOCX).","uniqueKey":"retrieval_contents.items.[INDEX].ctxl_metadata.file_format","typeLabel":"string"},"page":{"type":"integer","title":"Page","description":"Page number in the source document.","uniqueKey":"retrieval_contents.items.[INDEX].ctxl_metadata.page","typeLabel":"integer"},"chunk_id":{"type":"string","title":"Chunk Id","description":"Unique identifier for the chunk.","uniqueKey":"retrieval_contents.items.[INDEX].ctxl_metadata.chunk_id","typeLabel":"string"},"date_created":{"type":"string","title":"Date Created","description":"Date when the document or chunk was created.","uniqueKey":"retrieval_contents.items.[INDEX].ctxl_metadata.date_created","typeLabel":"string"},"section_id":{"type":"string","title":"Section Id","description":"The HTML id of the nearest element of the chunk","uniqueKey":"retrieval_contents.items.[INDEX].ctxl_metadata.section_id","typeLabel":"string"}},"additionalProperties":true,"type":"object","title":"Ctxl Metadata","description":"Default metadata from the retrieval","uniqueKey":"retrieval_contents.items.[INDEX].ctxl_metadata","typeLabel":"Ctxl Metadata · object"},"score":{"type":"number","title":"Score","description":"Score of the retrieval, if applicable","uniqueKey":"retrieval_contents.items.[INDEX].score","typeLabel":"number"}},"type":"object","required":["type","format","content_id","doc_id","doc_name"],"title":"RetrievalContentV0_1","description":"Retrieval content object typing for v0.1 API.","uniqueKey":"retrieval_contents.items.[INDEX]","typeLabel":"RetrievalContentV0_1 · object"},"type":"array","title":"Retrieval Contents","description":"Relevant content retrieved to answer the query","isRequired":true,"uniqueKey":"retrieval_contents","typeLabel":"RetrievalContentV0_1 · object[]"},"message_id":{"type":"string","format":"uuid","title":"Message Id","description":"A unique identifier for this specific message","uniqueKey":"message_id","typeLabel":"string\u003cuuid>"},"message":{"properties":{"content":{"type":"string","title":"Content","description":"Content of the message","isRequired":true,"uniqueKey":"message.content","typeLabel":"string"},"role":{"type":"string","enum":["user","system","assistant","knowledge"],"title":"SenderType","description":"Role of the sender","isRequired":true,"uniqueKey":"message.role","typeLabel":"enum\u003cstring>"},"custom_tags":{"items":{"type":"string","uniqueKey":"message.custom_tags.items.[INDEX]","typeLabel":"string"},"type":"array","title":"Custom Tags","description":"Custom tags for the message","uniqueKey":"message.custom_tags","typeLabel":"string[]"}},"type":"object","required":["content","role"],"title":"Message","description":"Response to the query request","uniqueKey":"message","typeLabel":"Message · object"},"attributions":{"items":{"properties":{"start_idx":{"type":"integer","title":"Start Idx","description":"Start index of the attributed text in the generated message","isRequired":true,"uniqueKey":"attributions.items.[INDEX].start_idx","typeLabel":"integer"},"end_idx":{"type":"integer","title":"End Idx","description":"End index of the attributed text in the generated message","isRequired":true,"uniqueKey":"attributions.items.[INDEX].end_idx","typeLabel":"integer"},"content_ids":{"items":{"type":"string","uniqueKey":"attributions.items.[INDEX].content_ids.items.[INDEX]","typeLabel":"string"},"type":"array","title":"Content Ids","description":"Content IDs of the sources for the attributed text","isRequired":true,"uniqueKey":"attributions.items.[INDEX].content_ids","typeLabel":"string[]"}},"type":"object","required":["start_idx","end_idx","content_ids"],"title":"AttributionV0_1","description":"Attribution for some claim made in a generated message`.","uniqueKey":"attributions.items.[INDEX]","typeLabel":"AttributionV0_1 · object"},"type":"array","title":"Attributions","description":"Attributions for the response","uniqueKey":"attributions","typeLabel":"AttributionV0_1 · object[]"},"groundedness_scores":{"items":{"properties":{"start_idx":{"type":"integer","title":"Start Index","description":"Start index of the span in the generated message","isRequired":true,"uniqueKey":"groundedness_scores.items.[INDEX].start_idx","typeLabel":"integer"},"end_idx":{"type":"integer","title":"End Index","description":"End index of the span in the generated message","isRequired":true,"uniqueKey":"groundedness_scores.items.[INDEX].end_idx","typeLabel":"integer"},"score":{"type":"integer","title":"Score","description":"Groundedness score for the span","isRequired":true,"uniqueKey":"groundedness_scores.items.[INDEX].score","typeLabel":"integer"}},"type":"object","required":["start_idx","end_idx","score"],"title":"GroundednessScore","description":"Groundedness scores in a generated message`.","uniqueKey":"groundedness_scores.items.[INDEX]","typeLabel":"GroundednessScore · object"},"type":"array","title":"Groundedness Scores","description":"Groundedness scores for the response","uniqueKey":"groundedness_scores","typeLabel":"GroundednessScore · object[]"}},"type":"object","required":["conversation_id","retrieval_contents"],"title":"QueryResponse","description":"Response body for POST /query","uniqueKey":"","typeLabel":"QueryResponse · object"},"examples":{"Example":{"title":"Example","value":{"conversation_id":"3c90c3cc-0d44-4b50-8888-8dd25736052a","retrieval_contents":[{"type":"\u003cstring>","format":"pdf","content_id":"\u003cstring>","doc_id":"\u003cstring>","doc_name":"\u003cstring>","custom_metadata":{},"custom_metadata_config":{},"number":1,"datastore_id":"\u003cstring>","page":123,"content_text":"\u003cstring>","url":"\u003cstring>","ctxl_metadata":{"document_title":"\u003cstring>","section_title":"\u003cstring>","is_figure":true,"file_name":"\u003cstring>","chunk_size":123,"file_format":"\u003cstring>","page":123,"chunk_id":"\u003cstring>","date_created":"\u003cstring>","section_id":"\u003cstring>"},"score":123}],"message_id":"3c90c3cc-0d44-4b50-8888-8dd25736052a","message":{"content":"\u003cstring>","role":"user","custom_tags":["\u003cstring>"]},"attributions":[{"start_idx":123,"end_idx":123,"content_ids":["\u003cstring>"]}],"groundedness_scores":[{"start_idx":123,"end_idx":123,"score":123}]}}},"exampleType":"generated"}},"exampleType":"generated"},"7aa73b65-47a9-4542-b8bf-9694959c0133":{"description":"Validation Error","content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"loc":{"items":{"oneOf":[{"type":"string","uniqueKey":"detail.items.[INDEX].loc.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"integer","uniqueKey":"detail.items.[INDEX].loc.items.[INDEX].oneOf.1","typeLabel":"integer"}],"uniqueKey":"detail.items.[INDEX].loc.items.[INDEX]","typeLabel":"string | integer"},"type":"array","title":"Location","isRequired":true,"uniqueKey":"detail.items.[INDEX].loc","typeLabel":"(string | integer)[]"},"msg":{"type":"string","title":"Message","isRequired":true,"uniqueKey":"detail.items.[INDEX].msg","typeLabel":"string"},"type":{"type":"string","title":"Error Type","isRequired":true,"uniqueKey":"detail.items.[INDEX].type","typeLabel":"string"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError","uniqueKey":"detail.items.[INDEX]","typeLabel":"ValidationError · object"},"type":"array","title":"Detail","uniqueKey":"detail","typeLabel":"ValidationError · object[]"}},"type":"object","title":"HTTPValidationError","uniqueKey":"","typeLabel":"HTTPValidationError · object"},"examples":{"Example":{"title":"Example","value":{"detail":[{"loc":["\u003cstring>"],"msg":"\u003cstring>","type":"\u003cstring>"}]}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"00949c99-df54-43a8-8f74-943f448c3f3e":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","scopes":[]}}},"servers":{"4f784b82-11e4-4de4-bd1c-959f6a96fca9":{"url":"https://api.contextual.ai/v1"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","bearerFormat":"API Key","scopes":[]},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your auth token.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"BearerAuth","name":"Authorization"}],"title":"BearerAuth"}]},"originalFileLocation":"api-reference/openapi.json"},"subdomain":"contextualai","siteName":"Contextual AI Documentation","title":"Query - Contextual AI Documentation","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-02-24T23:11:51.361Z","originalFileLocation":"api-reference/agents-query/query-1.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=\"light\";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=\"light\"}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=\"Start a conversation with an Agent and receive its generated response, along with relevant retrieved data and attributions.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Contextual AI Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/contextualai/JqDcfIh6YPJ9nwCM/_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/contextualai/JqDcfIh6YPJ9nwCM/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/contextualai/JqDcfIh6YPJ9nwCM/_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/contextualai/JqDcfIh6YPJ9nwCM/_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/contextualai/JqDcfIh6YPJ9nwCM/_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/contextualai/JqDcfIh6YPJ9nwCM/_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/contextualai/JqDcfIh6YPJ9nwCM/_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/contextualai/JqDcfIh6YPJ9nwCM/_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/contextualai/JqDcfIh6YPJ9nwCM/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Query - Contextual AI Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Start a conversation with an Agent and receive its generated response, along with relevant retrieved data and attributions.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Contextual AI Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.contextual.ai/api-reference/agents-query/query-1\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://contextualai.mintlify.site/_mintlify/api/og/v2?division=%2Fagents%2F%7Bid%7D%2Fquery\u0026amp;title=Query\u0026amp;description=Start+a+conversation+with+an+%60Agent%60+and+receive+its+generated+response%2C+along+with+relevant+retrieved+data+and+attributions.\u0026amp;theme=676818c361169a4000c34ca9\u0026amp;signature=d7ec289d7e7948954d3b8ae70c3bf68ab5a8c2bdd8d691b137b6c3f56e1f21d0\">\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=\"Query - Contextual AI Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Start a conversation with an Agent and receive its generated response, along with relevant retrieved data and attributions.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://contextualai.mintlify.site/_mintlify/api/og/v2?division=%2Fagents%2F%7Bid%7D%2Fquery\u0026amp;title=Query\u0026amp;description=Start+a+conversation+with+an+%60Agent%60+and+receive+its+generated+response%2C+along+with+relevant+retrieved+data+and+attributions.\u0026amp;theme=676818c361169a4000c34ca9\u0026amp;signature=d7ec289d7e7948954d3b8ae70c3bf68ab5a8c2bdd8d691b137b6c3f56e1f21d0\">\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/contextualai/JqDcfIh6YPJ9nwCM/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Contextual AI Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#2e70ff\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.contextual.ai/api-reference/agents-query/query-1\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/agents-query/query-1.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.contextual.ai/#organization\",\"name\":\"Contextual AI Documentation\",\"url\":\"https://docs.contextual.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/contextualai/hbpTLlKqktq8fCLj/logo/light.svg?fit=max\u0026auto=format\u0026n=hbpTLlKqktq8fCLj\u0026q=85\u0026s=049c4ad3c96c7cc618c2d6b183e5a683\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.contextual.ai#website\",\"name\":\"Contextual AI Documentation\",\"url\":\"https://docs.contextual.ai\",\"publisher\":{\"@id\":\"https://docs.contextual.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.contextual.ai/api-reference/agents-query/query-1#webpage\",\"url\":\"https://docs.contextual.ai/api-reference/agents-query/query-1\",\"name\":\"Query\",\"description\":\"Start a conversation with an Agent and receive its generated response, along with relevant retrieved data and attributions.\",\"dateModified\":\"2026-02-24T23:11:51.361Z\",\"isPartOf\":{\"@id\":\"https://docs.contextual.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.contextual.ai/api-reference/agents-query/query-1#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.contextual.ai/api-reference/agents-query/query-1#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"/agents/{id}/query\",\"item\":\"https://docs.contextual.ai/api-reference/agents-query/query\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Query\",\"item\":\"https://docs.contextual.ai/api-reference/agents-query/query-1\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.contextual.ai/api-reference/agents-query/query-1#apireference\",\"headline\":\"Query\",\"name\":\"Query\",\"description\":\"Start a conversation with an Agent and receive its generated response, along with relevant retrieved data and attributions.\",\"url\":\"https://docs.contextual.ai/api-reference/agents-query/query-1\",\"mainEntityOfPage\":{\"@id\":\"https://docs.contextual.ai/api-reference/agents-query/query-1#webpage\"},\"dateModified\":\"2026-02-24T23:11:51.361Z\",\"publisher\":{\"@id\":\"https://docs.contextual.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.contextual.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Contextual AI Documentation\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Contextual AI Documentation\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/agents-query/query-1.md","siteName":"Contextual AI Documentation","nav":{"global":null,"tabs":[{"tab":"Home","icon":"home","pages":[{"title":"Home","href":""}]},{"tab":"Guides","icon":"compass","pages":[{"title":"Guides","href":"/quickstarts/getting-started"}]},{"tab":"Reference","icon":"books","pages":[{"title":"Reference","href":"/reference/glossary"}]},{"tab":"Examples","icon":"sign-posts-wrench","pages":[{"title":"Examples","href":"/examples/overview-demos"}]},{"tab":"Integrations","icon":"handshake-angle","pages":[{"title":"Integrations","href":"/integration/overview"}]},{"tab":"Releases","icon":"code-merge","pages":[{"title":"Releases","href":"/release-notes/2026"}]},{"tab":"API","icon":"gear-complex-code","groups":[{"group":"/datastores","pages":[{"title":"List Datastores","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores","href":"/api-reference/datastores/list-datastores"},{"title":"Create Datastore","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /datastores","href":"/api-reference/datastores/create-datastore"},{"title":"Reset Datastore","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /datastores/{datastore_id}/reset","href":"/api-reference/datastores/reset-datastore"},{"title":"Edit Datastore Configuration","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /datastores/{datastore_id}","href":"/api-reference/datastores/edit-datastore-configuration"},{"title":"Delete Datastore","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /datastores/{datastore_id}","href":"/api-reference/datastores/delete-datastore"},{"title":"Get Datastore Metadata","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores/{datastore_id}/metadata","href":"/api-reference/datastores/get-datastore-metadata"}]},{"group":"/datastores/{id}/documents","pages":[{"title":"List Documents","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores/{datastore_id}/documents","href":"/api-reference/datastores-documents/list-documents"},{"title":"Ingest Document","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /datastores/{datastore_id}/documents","href":"/api-reference/datastores-documents/ingest-document"},{"title":"Get Document Metadata","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores/{datastore_id}/documents/{document_id}/metadata","href":"/api-reference/datastores-documents/get-document-metadata"},{"title":"Update Document Metadata","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /datastores/{datastore_id}/documents/{document_id}/metadata","href":"/api-reference/datastores-documents/update-document-metadata"},{"title":"Delete Document","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /datastores/{datastore_id}/documents/{document_id}","href":"/api-reference/datastores-documents/delete-document"},{"title":"Get Parse Results","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores/{datastore_id}/documents/{document_id}/parse","href":"/api-reference/datastores-documents/get-parse-results"},{"title":"Edit Chunk Content","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /datastores/{datastore_id}/chunks/{content_id}/content","href":"/api-reference/datastores-documents/edit-chunk-content"}]},{"group":"/agents","pages":[{"title":"List Agents","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents","href":"/api-reference/agents/list-agents"},{"title":"Create Agent","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents","href":"/api-reference/agents/create-agent"},{"title":"Edit Agent","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /agents/{agent_id}","href":"/api-reference/agents/edit-agent"},{"title":"Delete Agent","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /agents/{agent_id}","href":"/api-reference/agents/delete-agent"},{"title":"Get Agent Metadata","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents/{agent_id}/metadata","href":"/api-reference/agents/get-agent-metadata"},{"title":"Reset Agent","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /agents/{agent_id}/reset","href":"/api-reference/agents/reset-agent"},{"title":"Save Template","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents/{agent_id}/template","href":"/api-reference/agents/save-template"},{"title":"List Templates","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents/templates","href":"/api-reference/agents/list-templates"},{"title":"List Agent Composer Templates","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents/templates/acl","href":"/api-reference/agents/list-agent-composer-templates"},{"title":"Get Template Configuration","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents/templates/{template}","href":"/api-reference/agents/get-template-configuration"},{"title":"Copy Agent","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents/{agent_id}/copy","href":"/api-reference/agents/copy-agent"}]},{"group":"/contents","pages":[{"title":"Get Document Contents","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores/{datastore_id}/contents","href":"/api-reference/contents/get-document-contents"},{"title":"Get Content Metadata","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores/{datastore_id}/contents/{content_id}/metadata","href":"/api-reference/contents/get-content-metadata"}]},{"group":"/agents/{id}/query","pages":[{"title":"Query","description":"Start a conversation with an `Agent` and receive its generated response, along with relevant retrieved data and attributions.","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents/{agent_id}/query/acl","href":"/api-reference/agents-query/query"},{"title":"Query","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents/{agent_id}/query","href":"/api-reference/agents-query/query-1"},{"title":"Get Retrieval Info","description":"Return metadata of the contents used to generate the response for a given message.","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents/{agent_id}/query/{message_id}/retrieval/info","href":"/api-reference/agents-query/get-retrieval-info"},{"title":"Provide Feedback","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents/{agent_id}/feedback","href":"/api-reference/agents-query/provide-feedback"},{"title":"Get Metrics","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents/{agent_id}/metrics","href":"/api-reference/agents-query/get-metrics"}]},{"group":"/lmunit","pages":[{"title":"LMUnit","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /lmunit","href":"/api-reference/lmunit/lmunit"}]},{"group":"/users","pages":[{"title":"Get Users","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /users","href":"/api-reference/users/get-users"},{"title":"Update User","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /users","href":"/api-reference/users/update-user"},{"title":"Invite Users","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /users","href":"/api-reference/users/invite-users"},{"title":"Remove User","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /users","href":"/api-reference/users/remove-user"}]},{"group":"/generate","pages":[{"title":"Generate","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /generate","href":"/api-reference/generate/generate"}]},{"group":"/rerank","pages":[{"title":"Rerank","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /rerank","href":"/api-reference/rerank/rerank"}]},{"group":"/parse","pages":[{"title":"Parse File","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /parse","href":"/api-reference/parse/parse-file"},{"title":"Parse Status","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /parse/jobs/{job_id}/status","href":"/api-reference/parse/parse-status"},{"title":"Parse Result","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /parse/jobs/{job_id}/results","href":"/api-reference/parse/parse-result"},{"title":"Parse List Jobs","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /parse/jobs","href":"/api-reference/parse/parse-list-jobs"}]},{"group":"/extract","pages":[{"title":"List Schemas","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/schemas","href":"/api-reference/extract/list-schemas"},{"title":"Create Schema","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /extract/schemas","href":"/api-reference/extract/create-schema"},{"title":"Get Schema","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/schemas/{schema_id}","href":"/api-reference/extract/get-schema"},{"title":"Update Schema","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /extract/schemas/{schema_id}","href":"/api-reference/extract/update-schema"},{"title":"Delete Schema","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /extract/schemas/{schema_id}","href":"/api-reference/extract/delete-schema"},{"title":"List Documents","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/documents","href":"/api-reference/extract/list-documents"},{"title":"Upload Document","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /extract/documents/upload","href":"/api-reference/extract/upload-document"},{"title":"Get Document","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/documents/{document_id}","href":"/api-reference/extract/get-document"},{"title":"Delete Document","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /extract/documents/{document_id}","href":"/api-reference/extract/delete-document"},{"title":"List Jobs","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/jobs","href":"/api-reference/extract/list-jobs"},{"title":"Start Extraction Job","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /extract/jobs","href":"/api-reference/extract/start-extraction-job"},{"title":"Resume Streaming Extraction","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/jobs/{job_id}/stream","href":"/api-reference/extract/resume-streaming-extraction"},{"title":"Get Job Status","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/jobs/{job_id}","href":"/api-reference/extract/get-job-status"},{"title":"Get Job Results","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/jobs/{job_id}/results","href":"/api-reference/extract/get-job-results"},{"title":"Update Job Results","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /extract/jobs/{job_id}/results","href":"/api-reference/extract/update-job-results"}]},{"group":"/workspaces","pages":[{"title":"Get Consent","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /workspaces/consent","href":"/api-reference/workspaces/get-consent"},{"title":"Update Consent","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /workspaces/consent","href":"/api-reference/workspaces/update-consent"}]},{"group":"/billing","pages":[{"title":"Get Balance","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/balance","href":"/api-reference/billing/get-balance"},{"title":"Get Top Up History Endpoint","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/balance/top-ups","href":"/api-reference/billing/get-top-up-history-endpoint"},{"title":"Get Monthly Usage Endpoint","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/usages/monthly","href":"/api-reference/billing/get-monthly-usage-endpoint"},{"title":"Get Agent Composer Step Usage","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/usages/acl","href":"/api-reference/billing/get-agent-composer-step-usage"},{"title":"Get Earliest Usage Date Endpoint","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/usages/earliest_date","href":"/api-reference/billing/get-earliest-usage-date-endpoint"},{"title":"Get Billing Mode History","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/billing_mode/history","href":"/api-reference/billing/get-billing-mode-history"},{"title":"Get Billing Metadata","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/metadata","href":"/api-reference/billing/get-billing-metadata"}]}]}]},"basePath":"","title":"Query - Contextual AI Documentation","deploymentId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","buildId":"dpl_EwfxjeKENdVkfzdag8rM6mKzcTUJ","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-B8kPdtB2.js","snippetPresets-C-p1aFQ1.js","utils-B9NnUZSZ.js","style-to-object-BY3JEAdk.js","utils-DFxl7cW2.js","v4-DIgz8zy6.js","addTypeLabelsToSchema-bSr9h7OB.js","conditional-requirements-CFM0id0Q.js","cloneDeep-Bw4Gcy_r.js","_Uint8Array-C68x8Gny.js","isObject-FP1Yky1u.js","ApiExamples-BXsp8PHs.js","usePlaygroundInputsStore-BlAOLmIF.js","shallow-C2F02mqa.js","isEqual-C8iG4q2G.js","CodeSnippets-45lHR04X.js","CodeSnippet-6Cemznl-.js","use-playground-group-access-Cyy8SXp5.js","Page-CeZ_ZB5X.js","api-description-markdown-DiOdv5rp.js","DynamicMarkdown-B_9ywLDq.js","SectionHeading-Cc2r-uqU.js","MethodPill-Df3Tcu4c.js","getPastedJson-B3vrV0wE.js","Check2Icon-YQhSFafd.js","axios-CsQoIw0U.js","Markdown-0RkHcMOI.js","AssistantPageLink-DeJZCj9t.js","dist-DVqS175j.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js"]}