The unified query endpoint. oleander parses the SQL, estimates how much data the referenced tables hold, and picks the engine (DuckDB, Polars, Bloom, or Spark) and machine size to match. Leave engine on auto unless you need a specific one.
Interactive reads return rows on the call. A query with a destination, a statement that names its own target, or a read too large for an interactive engine is submitted asynchronously and returns state: "SUBMITTED" with a run_id to poll.
This endpoint supersedes /api/v1/warehouse/query, which pins DuckDB and is sized by the org default rather than by the query.
POST
/
api
/
v1
/
query
Query (routed)
curl --request POST \ --url https://oleander.dev/api/v1/query \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data @- <<EOF{ "query": "SELECT species, count(*) AS n FROM oleander.default.flowers GROUP BY 1", "script": "result = events.group_by('day').len()", "tables": [], "engine": "auto", "destination": "default.daily_counts", "write_mode": "overwrite", "explain": false, "openlineage_job_namespace": "nightly", "openlineage_job_name": "flowers_extract"}EOF
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"oleander","colors":{"primary":"#ec4899","light":"#f472b6","dark":"#db2777"},"logo":{"light":"https://mintcdn.com/oleander/N5KOCj-KV-raHP2J/logo/light.svg?fit=max\u0026auto=format\u0026n=N5KOCj-KV-raHP2J\u0026q=85\u0026s=310e150e92ecf20e459e0231d14e554b","dark":"https://mintcdn.com/oleander/N5KOCj-KV-raHP2J/logo/dark.svg?fit=max\u0026auto=format\u0026n=N5KOCj-KV-raHP2J\u0026q=85\u0026s=a92922eda9e5b45cf4ec06ae1af0cd61"},"favicon":"https://mintcdn.com/oleander/N5KOCj-KV-raHP2J/favicon.svg?fit=max\u0026auto=format\u0026n=N5KOCj-KV-raHP2J\u0026q=85\u0026s=20b6f00aa8532b600cb78044894e7dda","background":{"color":{"dark":"#020817"}},"navbar":{"links":[{"href":"mailto:willy@oleander.dev","label":"Support"}],"primary":{"type":"button","label":"oleander.dev","href":"https://oleander.dev/account"}},"footer":{"socials":{"x":"https://x.com/OleanderHQ","github":"https://github.com/OleanderHQ","linkedin":"https://www.linkedin.com/company/oleander-dev"}},"seo":{"metatags":{"title":"oleander","description":"oleander is a multi-engine data warehouse built on Apache Iceberg, with serverless compute and intelligent routing in one platform.","og:site_name":"oleander","og:description":"oleander is a multi-engine data warehouse built on Apache Iceberg, with serverless compute and intelligent routing in one platform.","twitter:image":"https://oleander.dev/opengraph-image","og:image":"https://oleander.dev/opengraph-image"},"indexing":"navigable"},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Slack","icon":"slack","href":"https://join.slack.com/t/oleander-hq/shared_invite/zt-2wzl5ncjb-c~ZubVAHVzBP7OZM~Hwuyw"},{"anchor":"Blog","icon":"newspaper","href":"https://oleander.dev/blog"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"oleander","hasAudioNarration":false,"actualSubdomain":"oleander","customDomains":["docs.oleander.dev"],"gitSource":{"type":"github","owner":"oleanderhq","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae4c9787f8a500a1fd86db2","collectionId":"ee7c55a2-1105-4a04-a8e4-bda971e3f2bc","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae4c9787f8a500a1fd86db2"},"feedback":{"thumbs":true,"edits":true,"issues":true},"entitlements":{},"buildId":"6ae4c9787f8a500a1fd86db2","clientVersion":"0.0.4045","searchFilterCounts":[{"language":"default","tag":"Documentation","count":55},{"language":"default","tag":"Platform","count":19},{"language":"default","tag":"SDKs","count":14},{"language":"default","tag":"API Reference","count":7},{"language":"default","tag":"Python","count":7},{"language":"default","tag":"TypeScript","count":7},{"language":"default","tag":"CLI","count":6},{"language":"default","tag":"IAM","count":6},{"language":"default","tag":"Integrations","count":6},{"language":"default","tag":"Coding with agents","count":6}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"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":[],"page":{"pagePath":"api-reference/query-routed","slug":"/api-reference/query-routed","pageMetadata":{"title":"Query (routed)","description":"The unified query endpoint. oleander parses the SQL, estimates how much data the referenced tables hold, and picks the engine (DuckDB, Polars, Bloom, or Spark) and machine size to match. Leave `engine` on `auto` unless you need a specific one.\n\nInteractive reads return rows on the call. A query with a `destination`, a statement that names its own target, or a read too large for an interactive engine is submitted asynchronously and returns `state: \"SUBMITTED\"` with a `run_id` to poll.\n\nThis endpoint supersedes `/api/v1/warehouse/query`, which pins DuckDB and is sized by the org default rather than by the query.","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v1/query","href":"/api-reference/query-routed","autogeneratedByOpenApi":true},"description":{"compiledSource":"\"use strict\";\nconst {Fragment: _Fragment, 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(_Fragment, {\n children: [_jsxs(_components.p, {\n children: [\"The unified query endpoint. oleander parses the SQL, estimates how much data the referenced tables hold, and picks the engine (DuckDB, Polars, Bloom, or Spark) and machine size to match. Leave \", _jsx(_components.code, {\n children: \"engine\"\n }), \" on \", _jsx(_components.code, {\n children: \"auto\"\n }), \" unless you need a specific one.\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"Interactive reads return rows on the call. A query with a \", _jsx(_components.code, {\n children: \"destination\"\n }), \", a statement that names its own target, or a read too large for an interactive engine is submitted asynchronously and returns \", _jsx(_components.code, {\n children: \"state: \\\"SUBMITTED\\\"\"\n }), \" with a \", _jsx(_components.code, {\n children: \"run_id\"\n }), \" to poll.\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"This endpoint supersedes \", _jsx(_components.code, {\n children: \"/api/v1/warehouse/query\"\n }), \", which pins DuckDB and is sized by the org default rather than by the query.\"]\n })]\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 (routed)","description":"The unified query endpoint. oleander parses the SQL, estimates how much data the referenced tables hold, and picks the engine (DuckDB, Polars, Bloom, or Spark) and machine size to match. Leave `engine` on `auto` unless you need a specific one.\n\nInteractive reads return rows on the call. A query with a `destination`, a statement that names its own target, or a read too large for an interactive engine is submitted asynchronously and returns `state: \"SUBMITTED\"` with a `run_id` to poll.\n\nThis endpoint supersedes `/api/v1/warehouse/query`, which pins DuckDB and is sized by the org default rather than by the query.","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v1/query","href":"/api-reference/query-routed","autogeneratedByOpenApi":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"summary":"Query (routed)","description":"The unified query endpoint. oleander parses the SQL, estimates how much data the referenced tables hold, and picks the engine (DuckDB, Polars, Bloom, or Spark) and machine size to match. Leave `engine` on `auto` unless you need a specific one.\n\nInteractive reads return rows on the call. A query with a `destination`, a statement that names its own target, or a read too large for an interactive engine is submitted asynchronously and returns `state: \"SUBMITTED\"` with a `run_id` to poll.\n\nThis endpoint supersedes `/api/v1/warehouse/query`, which pins DuckDB and is sized by the org default rather than by the query.","operationId":"query","requestBody":"f998023b-643d-4580-b31a-91022895f7d1","responses":{"200":"e60a659b-2839-4229-8af5-71fb42b8eda8","400":"accaf5de-abe0-4853-ab96-b31c2af4d7be","401":"d4aa32b3-e9e8-4f09-95dc-4406e7460261","402":"12e7c5ea-bfa7-47aa-b5c5-922ea33368b4","403":"2220f61d-efba-42e3-b14d-198f810dd484","500":"fbbc507b-a08f-428c-b6a6-20cfbb2ad40a"},"method":"post","type":"path","servers":["8becb045-3227-4ba9-9ec1-32dfe7ca827e"],"security":["c8fc6d18-b632-4d85-ad93-12bf2e10261b"],"path":"/api/v1/query","baseUrlOptions":["https://oleander.dev"],"title":"Query (routed)","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Provide either `query` or `script`, never both.","properties":{"query":{"type":"string","description":"The SQL to run.","example":"SELECT species, count(*) AS n FROM oleander.default.flowers GROUP BY 1","uniqueKey":"query","typeLabel":"string"},"script":{"type":"string","description":"A Polars DataFrame script that assigns `result`. Mutually exclusive with `query`; forces the Polars engine.","example":"result = events.group_by('day').len()","uniqueKey":"script","typeLabel":"string"},"tables":{"type":"array","description":"Tables a script reads, as \"alias=namespace.table\" or {alias, table}. Script mode only.","items":{"oneOf":[{"type":"string","uniqueKey":"tables.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"object","required":["alias","table"],"properties":{"alias":{"type":"string","isRequired":true,"uniqueKey":"tables.items.[INDEX].oneOf.1.alias","typeLabel":"string"},"table":{"type":"string","isRequired":true,"uniqueKey":"tables.items.[INDEX].oneOf.1.table","typeLabel":"string"}},"uniqueKey":"tables.items.[INDEX].oneOf.1","typeLabel":"object"}],"uniqueKey":"tables.items.[INDEX]","typeLabel":"string | object"},"default":[],"uniqueKey":"tables","typeLabel":"(string | object)[]"},"engine":{"type":"string","enum":["auto","duckdb","polars","bloom","spark"],"default":"auto","description":"Ask for a specific engine. An impossible combination returns an engine capability error rather than rerouting.","uniqueKey":"engine","typeLabel":"enum\u003cstring>"},"destination":{"type":"string","description":"Table to write the result to, as a dotted identifier such as namespace.table. Presence of a destination makes this a write.","example":"default.daily_counts","uniqueKey":"destination","typeLabel":"string"},"write_mode":{"type":"string","enum":["overwrite","append"],"default":"overwrite","description":"Applies to a `destination` write. A statement that names its own target carries its own semantics.","uniqueKey":"write_mode","typeLabel":"enum\u003cstring>"},"explain":{"type":"boolean","default":false,"description":"Return the routing decision without executing anything or spending compute.","uniqueKey":"explain","typeLabel":"boolean"},"openlineage_job_namespace":{"type":"string","description":"OpenLineage job namespace for the run when it runs on Bloom. Defaults to `oleander.lake`.","example":"nightly","uniqueKey":"openlineage_job_namespace","typeLabel":"string"},"openlineage_job_name":{"type":"string","description":"OpenLineage job name for the run when it runs on Bloom.","example":"flowers_extract","uniqueKey":"openlineage_job_name","typeLabel":"string"},"openlineage_parent_run":{"type":"object","description":"Parent run to file the Bloom run under, such as an orchestrator's run. All three fields are required.","required":["job_namespace","job_name","run_id"],"properties":{"job_namespace":{"type":"string","example":"scheduler","isRequired":true,"uniqueKey":"openlineage_parent_run.job_namespace","typeLabel":"string"},"job_name":{"type":"string","example":"flower-pipeline","isRequired":true,"uniqueKey":"openlineage_parent_run.job_name","typeLabel":"string"},"run_id":{"type":"string","format":"uuid","example":"11111111-1111-4111-8111-111111111111","isRequired":true,"uniqueKey":"openlineage_parent_run.run_id","typeLabel":"string\u003cuuid>"}},"uniqueKey":"openlineage_parent_run","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"query":"SELECT species, count(*) AS n FROM oleander.default.flowers GROUP BY 1","script":"result = events.group_by('day').len()","tables":[],"engine":"auto","destination":"default.daily_counts","write_mode":"overwrite","explain":false,"openlineage_job_namespace":"nightly","openlineage_job_name":"flowers_extract"}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"e60a659b-2839-4229-8af5-71fb42b8eda8":{"description":"Query executed, submitted, or explained.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true,"uniqueKey":"success","typeLabel":"boolean"},"explain":{"type":"boolean","description":"Present and true when `explain` was requested. No compute was spent and no other result fields are returned.","uniqueKey":"explain","typeLabel":"boolean"},"engine_decision":{"type":"object","description":"How the query router chose the engine and machine for this run.","properties":{"engine":{"type":"string","enum":["duckdb","polars","bloom","spark"],"example":"bloom","uniqueKey":"engine_decision.engine","typeLabel":"enum\u003cstring>"},"execution_mode":{"type":"string","enum":["interactive","async"],"example":"interactive","uniqueKey":"engine_decision.execution_mode","typeLabel":"enum\u003cstring>"},"reasons":{"type":"array","items":{"type":"string","uniqueKey":"engine_decision.reasons.items.[INDEX]","typeLabel":"string"},"description":"Ordered trail of the rules that produced this decision.","example":["not a script","no external connection tables","not DDL","no destination table","estimated input 1.2 GiB","sandbox 2 vCPU / 4 GB"],"uniqueKey":"engine_decision.reasons","typeLabel":"string[]"},"size_band":{"oneOf":[{"type":"string","example":"small","uniqueKey":"engine_decision.size_band.oneOf.0","typeLabel":"string"},{"type":"null","example":"small","uniqueKey":"engine_decision.size_band.oneOf.1","typeLabel":"null"}],"uniqueKey":"engine_decision.size_band","typeLabel":"string | null"},"estimated_input_bytes":{"oneOf":[{"type":"string","description":"Estimated input size from Iceberg snapshot metadata, as a string to preserve precision.","example":"1288490188","uniqueKey":"engine_decision.estimated_input_bytes.oneOf.0","typeLabel":"string"},{"type":"null","description":"Estimated input size from Iceberg snapshot metadata, as a string to preserve precision.","example":"1288490188","uniqueKey":"engine_decision.estimated_input_bytes.oneOf.1","typeLabel":"null"}],"uniqueKey":"engine_decision.estimated_input_bytes","typeLabel":"string | null"},"vcpus":{"oneOf":[{"type":"integer","example":2,"uniqueKey":"engine_decision.vcpus.oneOf.0","typeLabel":"integer"},{"type":"null","example":2,"uniqueKey":"engine_decision.vcpus.oneOf.1","typeLabel":"null"}],"uniqueKey":"engine_decision.vcpus","typeLabel":"integer | null"},"sandbox":{"oneOf":[{"type":"object","properties":{"vcpus":{"type":"integer","example":2,"uniqueKey":"engine_decision.sandbox.oneOf.0.vcpus","typeLabel":"integer"},"memory_gb":{"oneOf":[{"type":"integer","example":4,"uniqueKey":"engine_decision.sandbox.oneOf.0.memory_gb.oneOf.0","typeLabel":"integer"},{"type":"null","example":4,"uniqueKey":"engine_decision.sandbox.oneOf.0.memory_gb.oneOf.1","typeLabel":"null"}],"uniqueKey":"engine_decision.sandbox.oneOf.0.memory_gb","typeLabel":"integer | null"}},"uniqueKey":"engine_decision.sandbox.oneOf.0","typeLabel":"object"},{"type":"null","properties":{"vcpus":{"type":"integer","example":2},"memory_gb":{"oneOf":[{"type":"integer","example":4},{"type":"null","example":4}]}},"uniqueKey":"engine_decision.sandbox.oneOf.1","typeLabel":"null"}],"uniqueKey":"engine_decision.sandbox","typeLabel":"object | null"},"input_tables":{"type":"array","items":{"type":"string","uniqueKey":"engine_decision.input_tables.items.[INDEX]","typeLabel":"string"},"example":["oleander.default.events"],"uniqueKey":"engine_decision.input_tables","typeLabel":"string[]"}},"uniqueKey":"engine_decision","typeLabel":"object"},"results":{"oneOf":[{"type":"object","description":"Rows, for interactive reads only. Absent on submitted runs.","properties":{"columns":{"type":"array","items":{"type":"string","uniqueKey":"results.oneOf.0.columns.items.[INDEX]","typeLabel":"string"},"uniqueKey":"results.oneOf.0.columns","typeLabel":"string[]"},"column_types":{"type":"array","items":{"type":"string","uniqueKey":"results.oneOf.0.column_types.items.[INDEX]","typeLabel":"string"},"uniqueKey":"results.oneOf.0.column_types","typeLabel":"string[]"},"rows":{"type":"array","items":{"type":"array","items":{"oneOf":[{}],"uniqueKey":"results.oneOf.0.rows.items.[INDEX].items.[INDEX]","typeLabel":"any"},"uniqueKey":"results.oneOf.0.rows.items.[INDEX]","typeLabel":"any[]"},"uniqueKey":"results.oneOf.0.rows","typeLabel":"any[][]"}},"uniqueKey":"results.oneOf.0","typeLabel":"object"},{"type":"null","description":"Rows, for interactive reads only. Absent on submitted runs.","properties":{"columns":{"type":"array","items":{"type":"string"}},"column_types":{"type":"array","items":{"type":"string"}},"rows":{"type":"array","items":{"type":"array","items":{"oneOf":[{}]}}}},"uniqueKey":"results.oneOf.1","typeLabel":"null"}],"uniqueKey":"results","typeLabel":"object | null"},"row_count":{"oneOf":[{"type":"integer","uniqueKey":"row_count.oneOf.0","typeLabel":"integer"},{"type":"null","uniqueKey":"row_count.oneOf.1","typeLabel":"null"}],"uniqueKey":"row_count","typeLabel":"integer | null"},"execution_time":{"oneOf":[{"type":"string","example":"42ms","uniqueKey":"execution_time.oneOf.0","typeLabel":"string"},{"type":"null","example":"42ms","uniqueKey":"execution_time.oneOf.1","typeLabel":"null"}],"uniqueKey":"execution_time","typeLabel":"string | null"},"state":{"type":"string","enum":["COMPLETE","SUBMITTED"],"description":"COMPLETE means the write already landed. SUBMITTED means a job is running and `run_id` must be polled.","uniqueKey":"state","typeLabel":"enum\u003cstring>"},"run_id":{"oneOf":[{"type":"string","description":"Run to poll when `state` is SUBMITTED.","uniqueKey":"run_id.oneOf.0","typeLabel":"string"},{"type":"null","description":"Run to poll when `state` is SUBMITTED.","uniqueKey":"run_id.oneOf.1","typeLabel":"null"}],"uniqueKey":"run_id","typeLabel":"string | null"},"output_table":{"oneOf":[{"type":"string","description":"Fully qualified destination table for a write.","uniqueKey":"output_table.oneOf.0","typeLabel":"string"},{"type":"null","description":"Fully qualified destination table for a write.","uniqueKey":"output_table.oneOf.1","typeLabel":"null"}],"uniqueKey":"output_table","typeLabel":"string | null"},"compute":{"oneOf":[{"type":"object","description":"The sandbox or cluster that actually served the run. A warm larger sandbox can serve a smaller request, and that is the machine the org is billed for.","uniqueKey":"compute.oneOf.0","typeLabel":"object"},{"type":"null","description":"The sandbox or cluster that actually served the run. A warm larger sandbox can serve a smaller request, and that is the machine the org is billed for.","uniqueKey":"compute.oneOf.1","typeLabel":"null"}],"uniqueKey":"compute","typeLabel":"object | null"},"job":{"type":"object","description":"Lineage job identity for this query.","properties":{"namespace":{"type":"string","example":"oleander.lake","uniqueKey":"job.namespace","typeLabel":"string"},"name":{"type":"string","example":"query_9f2c1ab4","uniqueKey":"job.name","typeLabel":"string"}},"uniqueKey":"job","typeLabel":"object"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"success":true,"explain":true,"engine_decision":{"engine":"bloom","execution_mode":"interactive","reasons":["not a script","no external connection tables","not DDL","no destination table","estimated input 1.2 GiB","sandbox 2 vCPU / 4 GB"],"size_band":"small","estimated_input_bytes":"1288490188","vcpus":2,"sandbox":{"vcpus":2,"memory_gb":4},"input_tables":["oleander.default.events"]},"results":{"columns":["\u003cstring>"],"column_types":["\u003cstring>"],"rows":[["\u003cunknown>"]]},"row_count":123,"execution_time":"42ms","state":"COMPLETE","run_id":"\u003cstring>","output_table":"\u003cstring>","compute":{},"job":{"namespace":"oleander.lake","name":"query_9f2c1ab4"}}}},"exampleType":"generated"}},"exampleType":"generated"},"accaf5de-abe0-4853-ab96-b31c2af4d7be":{"description":"Invalid request, or an engine capability error when `engine` was pinned to something that cannot run the query.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false,"uniqueKey":"success","typeLabel":"boolean"},"error":{"type":"string","example":"query and script are mutually exclusive.","uniqueKey":"error","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"success":false,"error":"query and script are mutually exclusive."}}},"exampleType":"generated"}},"exampleType":"generated"},"d4aa32b3-e9e8-4f09-95dc-4406e7460261":{"description":"Unauthorized – request lacks a valid Bearer token or session credentials.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false,"uniqueKey":"success","typeLabel":"boolean"},"error":{"type":"string","example":"Unauthorized","uniqueKey":"error","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"success":false,"error":"Unauthorized"}}},"exampleType":"generated"}},"exampleType":"generated"},"12e7c5ea-bfa7-47aa-b5c5-922ea33368b4":{"description":"Payment required – metered compute needs a payment method on file. A billing decision, not a transient failure: do not retry the same query.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false,"uniqueKey":"success","typeLabel":"boolean"},"error":{"type":"string","example":"A payment method is required to run this query","uniqueKey":"error","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"success":false,"error":"A payment method is required to run this query"}}},"exampleType":"generated"}},"exampleType":"generated"},"2220f61d-efba-42e3-b14d-198f810dd484":{"description":"Forbidden – the plan does not allow this query. A billing decision, not a transient failure.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false,"uniqueKey":"success","typeLabel":"boolean"},"error":{"type":"string","example":"This query requires a plan upgrade","uniqueKey":"error","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"success":false,"error":"This query requires a plan upgrade"}}},"exampleType":"generated"}},"exampleType":"generated"},"fbbc507b-a08f-428c-b6a6-20cfbb2ad40a":{"description":"Query execution failed.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false,"uniqueKey":"success","typeLabel":"boolean"},"error":{"type":"string","example":"Query execution failed","uniqueKey":"error","typeLabel":"string"}},"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"success":false,"error":"Query execution failed"}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"c8fc6d18-b632-4d85-ad93-12bf2e10261b":{"bearerAuth":{"type":"http","scheme":"bearer","scopes":[],"schemeName":"bearerAuth"}}},"servers":{"8becb045-3227-4ba9-9ec1-32dfe7ca827e":{"url":"https://oleander.dev"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","scopes":[],"schemeName":"bearerAuth"},"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":"oleander","siteName":"oleander","title":"Query (routed) - oleander","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-16T16:39:52.183Z","originalFileLocation":"api-reference/query-routed.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=\"The unified query endpoint. oleander parses the SQL, estimates how much data the referenced tables hold, and picks the engine (DuckDB, Polars, Bloom, or Spark) and machine size to match. Leave engine on auto unless you need a specific one. Interactive reads return rows on the call. A query with a destination, a statement that names its own target, or a read too large for an interactive engine is submitted asynchronously and returns state: \u0026quot;SUBMITTED\u0026quot; with a run_id to poll. This endpoint supersedes /api/v1/warehouse/query, which pins DuckDB and is sized by the org default rather than by the query.\">\u003cmeta data-mint-head name=\"application-name\" content=\"oleander\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/oleander/_OXtZHAwyn78Hoiy/_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/oleander/_OXtZHAwyn78Hoiy/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/oleander/_OXtZHAwyn78Hoiy/_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/oleander/_OXtZHAwyn78Hoiy/_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/oleander/_OXtZHAwyn78Hoiy/_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/oleander/_OXtZHAwyn78Hoiy/_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/oleander/_OXtZHAwyn78Hoiy/_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/oleander/_OXtZHAwyn78Hoiy/_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/oleander/_OXtZHAwyn78Hoiy/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Query (routed) - oleander\">\u003cmeta data-mint-head property=\"og:description\" content=\"oleander is a multi-engine data warehouse built on Apache Iceberg, with serverless compute and intelligent routing in one platform.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"oleander\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.oleander.dev/api-reference/query-routed\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://oleander.dev/opengraph-image\">\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 (routed) - oleander\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"oleander is a multi-engine data warehouse built on Apache Iceberg, with serverless compute and intelligent routing in one platform.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://oleander.dev/opengraph-image\">\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/oleander/_OXtZHAwyn78Hoiy/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"oleander\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#ec4899\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.oleander.dev/api-reference/query-routed\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/query-routed.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.oleander.dev/#organization\",\"name\":\"oleander\",\"url\":\"https://docs.oleander.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/oleander/N5KOCj-KV-raHP2J/logo/light.svg?fit=max\u0026auto=format\u0026n=N5KOCj-KV-raHP2J\u0026q=85\u0026s=310e150e92ecf20e459e0231d14e554b\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.oleander.dev#website\",\"name\":\"oleander\",\"url\":\"https://docs.oleander.dev\",\"publisher\":{\"@id\":\"https://docs.oleander.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.oleander.dev/api-reference/query-routed#webpage\",\"url\":\"https://docs.oleander.dev/api-reference/query-routed\",\"name\":\"Query (routed)\",\"description\":\"The unified query endpoint. oleander parses the SQL, estimates how much data the referenced tables hold, and picks the engine (DuckDB, Polars, Bloom, or Spark) and machine size to match. Leave engine on auto unless you need a specific one. Interactive reads return rows on the call. A query with a destination, a statement that names its own target, or a read too large for an interactive engine is submitted asynchronously and returns state: \\\"SUBMITTED\\\" with a run_id to poll. This endpoint supersedes /api/v1/warehouse/query, which pins DuckDB and is sized by the org default rather than by the query.\",\"dateModified\":\"2026-10-16T16:39:52.183Z\",\"isPartOf\":{\"@id\":\"https://docs.oleander.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.oleander.dev/api-reference/query-routed#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.oleander.dev/api-reference/query-routed#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"oleander\",\"item\":\"https://docs.oleander.dev\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Query (routed)\",\"item\":\"https://docs.oleander.dev/api-reference/query-routed\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.oleander.dev/api-reference/query-routed#apireference\",\"headline\":\"Query (routed)\",\"name\":\"Query (routed)\",\"description\":\"The unified query endpoint. oleander parses the SQL, estimates how much data the referenced tables hold, and picks the engine (DuckDB, Polars, Bloom, or Spark) and machine size to match. Leave engine on auto unless you need a specific one. Interactive reads return rows on the call. A query with a destination, a statement that names its own target, or a read too large for an interactive engine is submitted asynchronously and returns state: \\\"SUBMITTED\\\" with a run_id to poll. This endpoint supersedes /api/v1/warehouse/query, which pins DuckDB and is sized by the org default rather than by the query.\",\"url\":\"https://docs.oleander.dev/api-reference/query-routed\",\"mainEntityOfPage\":{\"@id\":\"https://docs.oleander.dev/api-reference/query-routed#webpage\"},\"image\":\"https://oleander.dev/opengraph-image\",\"dateModified\":\"2026-10-16T16:39:52.183Z\",\"publisher\":{\"@id\":\"https://docs.oleander.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.oleander.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"oleander\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"oleander","nav":{"global":{"anchors":[{"anchor":"Slack","icon":"slack","href":"https://join.slack.com/t/oleander-hq/shared_invite/zt-2wzl5ncjb-c~ZubVAHVzBP7OZM~Hwuyw"},{"anchor":"Blog","icon":"newspaper","href":"https://oleander.dev/blog"}]},"tabs":[{"tab":"Documentation","icon":"book-open","pages":[{"title":"Documentation","href":"/quickstart"}]},{"tab":"API Reference","icon":"terminal","groups":[{"group":"Overview","pages":[{"title":"API Reference","href":"/api-reference/introduction"}]},{"group":"Lineage","pages":[{"title":"Record event","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v1/lineage","href":"/api-reference/record-event"},{"title":"Retrieve events","description":"List lineage events. Supports filtering by time range, run, state, namespace, job, and integrations. Results can be paginated and sorted.","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /api/v1/events","href":"/api-reference/retrieve-events"}]},{"group":"Queries","pages":[{"title":"Query (routed)","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v1/query","href":"/api-reference/query-routed"},{"title":"DuckDB (legacy)","description":"Legacy endpoint. Executes SQL against the oleander lake, always on DuckDB, sized by the organization's default sandbox setting rather than by the query. Prefer POST /api/v1/query, which routes to the right engine and machine; use this only for autoSaveByHash. All queries capture lineage metadata automatically. This endpoint is only available on the Pro plan.","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v1/warehouse/query","href":"/api-reference/duckdb-legacy"},{"title":"Spark","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v2/spark/query","href":"/api-reference/spark"},{"title":"Polars","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /api/v1/warehouse/polars","href":"/api-reference/polars"}]}]},{"tab":"SDKs","icon":"code","pages":[{"title":"SDKs","href":"/sdk/typescript/introduction"}]}]},"basePath":"","title":"Query (routed) - oleander","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"]}