Execute a SQL query on the organization’s data warehouse and return presigned URLs to download results.
This endpoint executes SQL queries on the organization’s data warehouse (AWS Athena or GCP BigQuery)
and returns presigned URLs for downloading the results directly from cloud storage (S3 or GCS).
Important: Customer data never transits through Nekt servers. Results are stored in the
organization’s cloud storage and accessed via time-limited presigned URLs (1 hour expiration).
Requirements:
Organization must have completed cloud setup (cloud_setup_completed = True)
Cloud Provider Support:
AWS: Executes queries on Athena
GCP: Executes queries on BigQuery
Output Formats:
csv: CSV format (default) - supports simple data types only
parquet: Parquet format - supports all data types including complex types (arrays, structs, etc.)
Limitations:
BigQuery CSV export does not support complex data types (ARRAY, STRUCT, JSON). Use Parquet mode instead.
Athena UNLOAD for Parquet may not support certain timestamp types. Cast problematic columns in the SQL query.
Security: Your data never transits through Nekt servers. Results are stored in your organization’s cloud storage and accessed via time-limited presigned URLs (1 hour expiration).
Authorizations
x-api-key
string
header
required
API Key authentication. Format: 'x-api-key: api_key'
A SQL statement to run against your lakehouse, and how to return the results.
sql
string
required
SQL query string to execute using standard SQL syntax (AWS Athena or GCP BigQuery depending on your organization's cloud provider)
mode
enum<string>
default:csv
Output format for query results. Options: 'csv' (default, universal compatibility) or 'parquet' (better compression and performance, recommended for large datasets)
csv - csv
parquet - parquet
Available options:
csv,
parquet
mode_options
object
Additional options for the output format. Available options depend on your organization's cloud provider and selected mode:
AWS Organizations:
CSV mode: No options supported (AWS Athena limitation)
Example: {'compression': 'SNAPPY'} or {'delimiter': ';', 'header': true, 'compression': 'GZIP'}
Show child attributes
Response
200 - application/json
The outcome of a SQL execution: its state, where to download results, and what it scanned.
state
enum<string>
required
Query execution state
SUCCEEDED - SUCCEEDED
FAILED - FAILED
CANCELLED - CANCELLED
RUNNING - RUNNING
Available options:
SUCCEEDED,
FAILED,
CANCELLED,
RUNNING
presigned_urls
string<uri>[]
List of presigned URLs to download result files (1 hour expiration)
data_scanned_in_bytes
integer
Amount of data scanned by the query (if succeeded)
execution_time_in_millis
integer
Query execution time in milliseconds (if succeeded)
state_change_reason
string
Error message (if failed)
result_reused
boolean
Whether Athena served a stored result of an identical earlier query instead of running it again. Present only when the workspace's query cache applied to this query (AWS, API/MCP tokens, CSV).
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Nekt","colors":{"primary":"#097860","light":"#FAF9F7","dark":"#222427"},"logo":{"light":"https://mintcdn.com/nekt/fAFtC-RZLnUKCv7c/assets/logo/light.svg?fit=max\u0026auto=format\u0026n=fAFtC-RZLnUKCv7c\u0026q=85\u0026s=cba8701f886607d770a7510c525d81b7","dark":"https://mintcdn.com/nekt/fAFtC-RZLnUKCv7c/assets/logo/dark.svg?fit=max\u0026auto=format\u0026n=fAFtC-RZLnUKCv7c\u0026q=85\u0026s=49a92921377751229bc12ae4b61b1c6a"},"favicon":"https://mintcdn.com/nekt/DJnjRR_rS7CNJfYV/favicon.png?fit=max\u0026auto=format\u0026n=DJnjRR_rS7CNJfYV\u0026q=85\u0026s=4df461957abd65599739f5ec1c8c84cf","api":{"openapi":{"source":"https://api.nekt.ai/api/schema/"},"mdx":{"auth":{"method":"key","name":"x-api-key"},"server":"https://api.nekt.ai/"}},"background":{"color":{"light":"#FAF9F7","dark":"#222427"}},"navbar":{"primary":{"type":"button","label":"Platform","href":"https://app.nekt.ai"}},"footer":{"socials":{"website":"https://nekt.com","linkedin":"https://www.linkedin.com/company/nektai","youtube":"https://www.youtube.com/@nektdata","github":"https://github.com/nektcom"}},"integrations":{"ga4":{"measurementId":"G-8YEZ2TKV3C"}},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"nekt","hasAudioNarration":false,"actualSubdomain":"nekt","customDomains":["docs.nekt.com"],"gitSource":{"type":"github","owner":"nektcom","repo":"nekt-docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af8f149d68a94726961cf9e","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"Documentation","count":559},{"language":"default","tag":"Connectors","count":493},{"language":"default","tag":"Context","count":451},{"language":"default","tag":"Sources","count":441},{"language":"default","tag":"Platform API","count":141},{"language":"default","tag":"Activate","count":78},{"language":"default","tag":"Destinations","count":61},{"language":"default","tag":"Permissions","count":34},{"language":"default","tag":"Catalog","count":24},{"language":"default","tag":"Semantic Layer","count":18}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"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":"workos-onboarding","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":"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":"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":"editor-metadata","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},{"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":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#content-area a{text-underline-offset:2px;transition:opacity 0.15s ease}#content-area a:hover{opacity:0.7}#content-area a.card{text-decoration:none}a[href*=\"utm_campaign=poweredBy\"]{display:none}"}],"page":{"pagePath":"data-api/sql-query","slug":"/data-api/sql-query","pageMetadata":{"title":"SQL Query","openapi":"POST /api/v1/sql-query/","description":"Execute a SQL query on the organization's data warehouse and return presigned URLs to download results.\n\nThis endpoint executes SQL queries on the organization's data warehouse (AWS Athena or GCP BigQuery)\nand returns presigned URLs for downloading the results directly from cloud storage (S3 or GCS).\n\n**Important**: Customer data never transits through Nekt servers. Results are stored in the\norganization's cloud storage and accessed via time-limited presigned URLs (1 hour expiration).\n\n**Requirements**:\n- Organization must have completed cloud setup (`cloud_setup_completed = True`)\n\n**Cloud Provider Support**:\n- AWS: Executes queries on Athena\n- GCP: Executes queries on BigQuery\n\n**Output Formats**:\n- `csv`: CSV format (default) - supports simple data types only\n- `parquet`: Parquet format - supports all data types including complex types (arrays, structs, etc.)\n\n**Limitations**:\n- BigQuery CSV export does not support complex data types (ARRAY, STRUCT, JSON). Use Parquet mode instead.\n- Athena UNLOAD for Parquet may not support certain timestamp types. Cast problematic columns in the SQL query.\n\n**Example Request**:\n```json\n{\n \"sql\": \"SELECT * FROM my_table LIMIT 100\",\n \"mode\": \"parquet\",\n \"mode_options\": {\"compression\": \"SNAPPY\"}\n}\n```\n\n**Example Response**:\n```json\n{\n \"state\": \"SUCCEEDED\",\n \"presigned_urls\": [\n \"https://storage.googleapis.com/bucket/query-20251119-154427-123456-000000000000.parquet?...\"\n ],\n \"data_scanned_in_bytes\": 11250,\n \"execution_time_in_millis\": 408\n}\n```","href":"/data-api/sql-query"},"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 li: \"li\",\n p: \"p\",\n pre: \"pre\",\n span: \"span\",\n strong: \"strong\",\n ul: \"ul\",\n ..._provideComponents(),\n ...props.components\n }, {CodeBlock} = _components;\n if (!CodeBlock) _missingMdxReference(\"CodeBlock\", true);\n return _jsxs(_Fragment, {\n children: [_jsx(_components.p, {\n children: \"Execute a SQL query on the organization’s data warehouse and return presigned URLs to download results.\"\n }), \"\\n\", _jsx(_components.p, {\n children: \"This endpoint executes SQL queries on the organization’s data warehouse (AWS Athena or GCP BigQuery)\\nand returns presigned URLs for downloading the results directly from cloud storage (S3 or GCS).\"\n }), \"\\n\", _jsxs(_components.p, {\n children: [_jsx(_components.strong, {\n children: \"Important\"\n }), \": Customer data never transits through Nekt servers. Results are stored in the\\norganization’s cloud storage and accessed via time-limited presigned URLs (1 hour expiration).\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [_jsx(_components.strong, {\n children: \"Requirements\"\n }), \":\"]\n }), \"\\n\", _jsxs(_components.ul, {\n children: [\"\\n\", _jsxs(_components.li, {\n children: [\"Organization must have completed cloud setup (\", _jsx(_components.code, {\n children: \"cloud_setup_completed = True\"\n }), \")\"]\n }), \"\\n\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [_jsx(_components.strong, {\n children: \"Cloud Provider Support\"\n }), \":\"]\n }), \"\\n\", _jsxs(_components.ul, {\n children: [\"\\n\", _jsx(_components.li, {\n children: \"AWS: Executes queries on Athena\"\n }), \"\\n\", _jsx(_components.li, {\n children: \"GCP: Executes queries on BigQuery\"\n }), \"\\n\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [_jsx(_components.strong, {\n children: \"Output Formats\"\n }), \":\"]\n }), \"\\n\", _jsxs(_components.ul, {\n children: [\"\\n\", _jsxs(_components.li, {\n children: [_jsx(_components.code, {\n children: \"csv\"\n }), \": CSV format (default) - supports simple data types only\"]\n }), \"\\n\", _jsxs(_components.li, {\n children: [_jsx(_components.code, {\n children: \"parquet\"\n }), \": Parquet format - supports all data types including complex types (arrays, structs, etc.)\"]\n }), \"\\n\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [_jsx(_components.strong, {\n children: \"Limitations\"\n }), \":\"]\n }), \"\\n\", _jsxs(_components.ul, {\n children: [\"\\n\", _jsx(_components.li, {\n children: \"BigQuery CSV export does not support complex data types (ARRAY, STRUCT, JSON). Use Parquet mode instead.\"\n }), \"\\n\", _jsx(_components.li, {\n children: \"Athena UNLOAD for Parquet may not support certain timestamp types. Cast problematic columns in the SQL query.\"\n }), \"\\n\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [_jsx(_components.strong, {\n children: \"Example Request\"\n }), \":\"]\n }), \"\\n\", _jsx(CodeBlock, {\n numberOfLines: \"5\",\n language: \"json\",\n children: _jsx(_components.pre, {\n className: \"shiki shiki-themes github-light-default dark-plus\",\n style: {\n backgroundColor: \"#ffffff\",\n \"--shiki-dark-bg\": \"#0B0C0E\",\n color: \"#1f2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n language: \"json\",\n children: _jsxs(_components.code, {\n language: \"json\",\n numberOfLines: \"5\",\n children: [_jsx(_components.span, {\n className: \"line\",\n children: _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \"{\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"line\",\n children: [_jsx(_components.span, {\n style: {\n color: \"#116329\",\n \"--shiki-dark\": \"#9CDCFE\"\n },\n children: \" \\\"sql\\\"\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \": \"\n }), _jsx(_components.span, {\n style: {\n color: \"#0A3069\",\n \"--shiki-dark\": \"#CE9178\"\n },\n children: \"\\\"SELECT * FROM my_table LIMIT 100\\\"\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"line\",\n children: [_jsx(_components.span, {\n style: {\n color: \"#116329\",\n \"--shiki-dark\": \"#9CDCFE\"\n },\n children: \" \\\"mode\\\"\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \": \"\n }), _jsx(_components.span, {\n style: {\n color: \"#0A3069\",\n \"--shiki-dark\": \"#CE9178\"\n },\n children: \"\\\"parquet\\\"\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"line\",\n children: [_jsx(_components.span, {\n style: {\n color: \"#116329\",\n \"--shiki-dark\": \"#9CDCFE\"\n },\n children: \" \\\"mode_options\\\"\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \": {\"\n }), _jsx(_components.span, {\n style: {\n color: \"#116329\",\n \"--shiki-dark\": \"#9CDCFE\"\n },\n children: \"\\\"compression\\\"\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \": \"\n }), _jsx(_components.span, {\n style: {\n color: \"#0A3069\",\n \"--shiki-dark\": \"#CE9178\"\n },\n children: \"\\\"SNAPPY\\\"\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \"}\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"line\",\n children: _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \"}\"\n })\n }), \"\\n\"]\n })\n })\n }), \"\\n\", _jsxs(_components.p, {\n children: [_jsx(_components.strong, {\n children: \"Example Response\"\n }), \":\"]\n }), \"\\n\", _jsx(CodeBlock, {\n numberOfLines: \"8\",\n language: \"json\",\n children: _jsx(_components.pre, {\n className: \"shiki shiki-themes github-light-default dark-plus\",\n style: {\n backgroundColor: \"#ffffff\",\n \"--shiki-dark-bg\": \"#0B0C0E\",\n color: \"#1f2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n language: \"json\",\n children: _jsxs(_components.code, {\n language: \"json\",\n numberOfLines: \"8\",\n children: [_jsx(_components.span, {\n className: \"line\",\n children: _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \"{\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"line\",\n children: [_jsx(_components.span, {\n style: {\n color: \"#116329\",\n \"--shiki-dark\": \"#9CDCFE\"\n },\n children: \" \\\"state\\\"\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \": \"\n }), _jsx(_components.span, {\n style: {\n color: \"#0A3069\",\n \"--shiki-dark\": \"#CE9178\"\n },\n children: \"\\\"SUCCEEDED\\\"\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"line\",\n children: [_jsx(_components.span, {\n style: {\n color: \"#116329\",\n \"--shiki-dark\": \"#9CDCFE\"\n },\n children: \" \\\"presigned_urls\\\"\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \": [\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"line\",\n children: _jsx(_components.span, {\n style: {\n color: \"#0A3069\",\n \"--shiki-dark\": \"#CE9178\"\n },\n children: \" \\\"https://storage.googleapis.com/bucket/query-20251119-154427-123456-000000000000.parquet?...\\\"\"\n })\n }), \"\\n\", _jsx(_components.span, {\n className: \"line\",\n children: _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \" ],\"\n })\n }), \"\\n\", _jsxs(_components.span, {\n className: \"line\",\n children: [_jsx(_components.span, {\n style: {\n color: \"#116329\",\n \"--shiki-dark\": \"#9CDCFE\"\n },\n children: \" \\\"data_scanned_in_bytes\\\"\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \": \"\n }), _jsx(_components.span, {\n style: {\n color: \"#0550AE\",\n \"--shiki-dark\": \"#B5CEA8\"\n },\n children: \"11250\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \",\"\n })]\n }), \"\\n\", _jsxs(_components.span, {\n className: \"line\",\n children: [_jsx(_components.span, {\n style: {\n color: \"#116329\",\n \"--shiki-dark\": \"#9CDCFE\"\n },\n children: \" \\\"execution_time_in_millis\\\"\"\n }), _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \": \"\n }), _jsx(_components.span, {\n style: {\n color: \"#0550AE\",\n \"--shiki-dark\": \"#B5CEA8\"\n },\n children: \"408\"\n })]\n }), \"\\n\", _jsx(_components.span, {\n className: \"line\",\n children: _jsx(_components.span, {\n style: {\n color: \"#1F2328\",\n \"--shiki-dark\": \"#D4D4D4\"\n },\n children: \"}\"\n })\n }), \"\\n\"]\n })\n })\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};\nfunction _missingMdxReference(id, component) {\n throw new Error(\"Expected \" + (component ? \"component\" : \"object\") + \" `\" + id + \"` to be defined: you likely forgot to import, pass, or provide it.\");\n}\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={p:`p`,strong:`strong`,..._provideComponents(),...props.components},{Info}=_components;if(!Info)_missingMdxReference(`Info`,true);return _jsx(Info,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Security`}),`: Your data never transits through Nekt servers. Results are stored in your organization’s cloud storage and accessed via time-limited presigned URLs (1 hour expiration).`]})})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"SQL Query","openapi":"POST /api/v1/sql-query/","description":"Execute a SQL query on the organization's data warehouse and return presigned URLs to download results.\n\nThis endpoint executes SQL queries on the organization's data warehouse (AWS Athena or GCP BigQuery)\nand returns presigned URLs for downloading the results directly from cloud storage (S3 or GCS).\n\n**Important**: Customer data never transits through Nekt servers. Results are stored in the\norganization's cloud storage and accessed via time-limited presigned URLs (1 hour expiration).\n\n**Requirements**:\n- Organization must have completed cloud setup (`cloud_setup_completed = True`)\n\n**Cloud Provider Support**:\n- AWS: Executes queries on Athena\n- GCP: Executes queries on BigQuery\n\n**Output Formats**:\n- `csv`: CSV format (default) - supports simple data types only\n- `parquet`: Parquet format - supports all data types including complex types (arrays, structs, etc.)\n\n**Limitations**:\n- BigQuery CSV export does not support complex data types (ARRAY, STRUCT, JSON). Use Parquet mode instead.\n- Athena UNLOAD for Parquet may not support certain timestamp types. Cast problematic columns in the SQL query.\n\n**Example Request**:\n```json\n{\n \"sql\": \"SELECT * FROM my_table LIMIT 100\",\n \"mode\": \"parquet\",\n \"mode_options\": {\"compression\": \"SNAPPY\"}\n}\n```\n\n**Example Response**:\n```json\n{\n \"state\": \"SUCCEEDED\",\n \"presigned_urls\": [\n \"https://storage.googleapis.com/bucket/query-20251119-154427-123456-000000000000.parquet?...\"\n ],\n \"data_scanned_in_bytes\": 11250,\n \"execution_time_in_millis\": 408\n}\n```","href":"/data-api/sql-query"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"operationId":"v1_sql_query_create","description":"Execute a SQL query on the organization's data warehouse and return presigned URLs to download results.\n\nThis endpoint executes SQL queries on the organization's data warehouse (AWS Athena or GCP BigQuery)\nand returns presigned URLs for downloading the results directly from cloud storage (S3 or GCS).\n\n**Important**: Customer data never transits through Nekt servers. Results are stored in the\norganization's cloud storage and accessed via time-limited presigned URLs (1 hour expiration).\n\n**Requirements**:\n- Organization must have completed cloud setup (`cloud_setup_completed = True`)\n\n**Cloud Provider Support**:\n- AWS: Executes queries on Athena\n- GCP: Executes queries on BigQuery\n\n**Output Formats**:\n- `csv`: CSV format (default) - supports simple data types only\n- `parquet`: Parquet format - supports all data types including complex types (arrays, structs, etc.)\n\n**Limitations**:\n- BigQuery CSV export does not support complex data types (ARRAY, STRUCT, JSON). Use Parquet mode instead.\n- Athena UNLOAD for Parquet may not support certain timestamp types. Cast problematic columns in the SQL query.\n\n**Example Request**:\n```json\n{\n \"sql\": \"SELECT * FROM my_table LIMIT 100\",\n \"mode\": \"parquet\",\n \"mode_options\": {\"compression\": \"SNAPPY\"}\n}\n```\n\n**Example Response**:\n```json\n{\n \"state\": \"SUCCEEDED\",\n \"presigned_urls\": [\n \"https://storage.googleapis.com/bucket/query-20251119-154427-123456-000000000000.parquet?...\"\n ],\n \"data_scanned_in_bytes\": 11250,\n \"execution_time_in_millis\": 408\n}\n```","tags":["Explorer"],"requestBody":"e49f41fb-a032-4743-bee5-312d089a155d","security":["8512fdde-4759-4dcb-903b-a97a81408231"],"responses":{"200":"d1a0e3b5-2621-48fb-9b7e-0c7e8cebbb6a"},"method":"post","type":"path","servers":["8abe2527-822d-4e7e-80a5-24c35640d81f"],"path":"/api/v1/sql-query/","baseUrlOptions":["https://api.nekt.ai"],"title":"","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"content":{"application/json":{"schema":{"type":"object","description":"A SQL statement to run against your lakehouse, and how to return the results.","properties":{"sql":{"type":"string","description":"SQL query string to execute using standard SQL syntax (AWS Athena or GCP BigQuery depending on your organization's cloud provider)","isRequired":true,"uniqueKey":"sql","typeLabel":"string"},"mode":{"type":"string","description":"Output format for query results. Options: 'csv' (default, universal compatibility) or 'parquet' (better compression and performance, recommended for large datasets)\n\n* `csv` - csv\n* `parquet` - parquet","default":"csv","enum":["csv","parquet"],"uniqueKey":"mode","typeLabel":"enum\u003cstring>"},"mode_options":{"type":"object","additionalProperties":{"oneOf":[{}],"uniqueKey":"mode_options.additionalProperties","typeLabel":"any"},"description":"Additional options for the output format. Available options depend on your organization's cloud provider and selected mode:\n\n**AWS Organizations:**\n- CSV mode: No options supported (AWS Athena limitation)\n- Parquet mode: 'compression' - Compression algorithm (default: 'SNAPPY', options: 'SNAPPY', 'GZIP', 'NONE')\n\n**GCP Organizations:**\n- CSV mode: 'delimiter' (default: ','), 'header' (default: true), 'compression' (optional: 'GZIP')\n- Parquet mode: 'compression' - Compression algorithm (default: 'SNAPPY', options: 'SNAPPY', 'GZIP', 'NONE')\n\nExample: {'compression': 'SNAPPY'} or {'delimiter': ';', 'header': true, 'compression': 'GZIP'}","uniqueKey":"mode_options","typeLabel":"object"}},"required":["sql"],"uniqueKey":"","typeLabel":"object"},"examples":{"BasicCSVQuery":{"title":"BasicCSVQuery","summary":"Basic CSV Query","description":"Simple query returning results in CSV format (default)","value":{"sql":"SELECT * FROM \"nekt_raw\".\"customers\" LIMIT 100"}},"ParquetQueryWithCompression":{"title":"ParquetQueryWithCompression","summary":"Parquet Query with Compression","description":"Query with Parquet format and SNAPPY compression","value":{"sql":"SELECT id, name, created_at FROM \"nekt_raw\".\"orders\" WHERE status = 'completed'","mode":"parquet","mode_options":{"compression":"SNAPPY"}}},"AWSTimestampHandling":{"title":"AWSTimestampHandling","summary":"AWS Timestamp Handling","description":"Query with explicit timestamp casting for AWS Athena compatibility","value":{"sql":"SELECT id, name, CAST(created_at AS TIMESTAMP) AS created_at, CAST(updated_at AS TIMESTAMP) AS updated_at FROM \"nekt_raw\".\"products\"","mode":"parquet"}},"GCPCSVWithCustomOptions":{"title":"GCPCSVWithCustomOptions","summary":"GCP CSV with Custom Options","description":"CSV query with custom delimiter and compression for GCP BigQuery","value":{"sql":"SELECT * FROM \"nekt_raw\".\"transactions\" WHERE date >= '2025-01-01'","mode":"csv","mode_options":{"delimiter":";","header":true,"compression":"GZIP"}}}},"exampleType":"examples"},"application/x-www-form-urlencoded":{"schema":{"type":"object","description":"A SQL statement to run against your lakehouse, and how to return the results.","properties":{"sql":{"type":"string","description":"SQL query string to execute using standard SQL syntax (AWS Athena or GCP BigQuery depending on your organization's cloud provider)","isRequired":true,"uniqueKey":"sql","typeLabel":"string"},"mode":{"type":"string","description":"Output format for query results. Options: 'csv' (default, universal compatibility) or 'parquet' (better compression and performance, recommended for large datasets)\n\n* `csv` - csv\n* `parquet` - parquet","default":"csv","enum":["csv","parquet"],"uniqueKey":"mode","typeLabel":"enum\u003cstring>"},"mode_options":{"type":"object","additionalProperties":{"oneOf":[{}],"uniqueKey":"mode_options.additionalProperties","typeLabel":"any"},"description":"Additional options for the output format. Available options depend on your organization's cloud provider and selected mode:\n\n**AWS Organizations:**\n- CSV mode: No options supported (AWS Athena limitation)\n- Parquet mode: 'compression' - Compression algorithm (default: 'SNAPPY', options: 'SNAPPY', 'GZIP', 'NONE')\n\n**GCP Organizations:**\n- CSV mode: 'delimiter' (default: ','), 'header' (default: true), 'compression' (optional: 'GZIP')\n- Parquet mode: 'compression' - Compression algorithm (default: 'SNAPPY', options: 'SNAPPY', 'GZIP', 'NONE')\n\nExample: {'compression': 'SNAPPY'} or {'delimiter': ';', 'header': true, 'compression': 'GZIP'}","uniqueKey":"mode_options","typeLabel":"object"}},"required":["sql"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"sql":"\u003cstring>","mode":"csv","mode_options":{}}}},"exampleType":"generated"},"multipart/form-data":{"schema":{"type":"object","description":"A SQL statement to run against your lakehouse, and how to return the results.","properties":{"sql":{"type":"string","description":"SQL query string to execute using standard SQL syntax (AWS Athena or GCP BigQuery depending on your organization's cloud provider)","isRequired":true,"uniqueKey":"sql","typeLabel":"string"},"mode":{"type":"string","description":"Output format for query results. Options: 'csv' (default, universal compatibility) or 'parquet' (better compression and performance, recommended for large datasets)\n\n* `csv` - csv\n* `parquet` - parquet","default":"csv","enum":["csv","parquet"],"uniqueKey":"mode","typeLabel":"enum\u003cstring>"},"mode_options":{"type":"object","additionalProperties":{"oneOf":[{}],"uniqueKey":"mode_options.additionalProperties","typeLabel":"any"},"description":"Additional options for the output format. Available options depend on your organization's cloud provider and selected mode:\n\n**AWS Organizations:**\n- CSV mode: No options supported (AWS Athena limitation)\n- Parquet mode: 'compression' - Compression algorithm (default: 'SNAPPY', options: 'SNAPPY', 'GZIP', 'NONE')\n\n**GCP Organizations:**\n- CSV mode: 'delimiter' (default: ','), 'header' (default: true), 'compression' (optional: 'GZIP')\n- Parquet mode: 'compression' - Compression algorithm (default: 'SNAPPY', options: 'SNAPPY', 'GZIP', 'NONE')\n\nExample: {'compression': 'SNAPPY'} or {'delimiter': ';', 'header': true, 'compression': 'GZIP'}","uniqueKey":"mode_options","typeLabel":"object"}},"required":["sql"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"sql":"\u003cstring>","mode":"csv","mode_options":{}}}},"exampleType":"generated"}},"required":true,"exampleType":"examples"},"responses":{"d1a0e3b5-2621-48fb-9b7e-0c7e8cebbb6a":{"content":{"application/json":{"schema":{"type":"object","description":"The outcome of a SQL execution: its state, where to download results, and what it scanned.","properties":{"state":{"type":"string","description":"Query execution state\n\n* `SUCCEEDED` - SUCCEEDED\n* `FAILED` - FAILED\n* `CANCELLED` - CANCELLED\n* `RUNNING` - RUNNING","enum":["SUCCEEDED","FAILED","CANCELLED","RUNNING"],"isRequired":true,"uniqueKey":"state","typeLabel":"enum\u003cstring>"},"presigned_urls":{"type":"array","items":{"type":"string","format":"uri","uniqueKey":"presigned_urls.items.[INDEX]","typeLabel":"string\u003curi>"},"description":"List of presigned URLs to download result files (1 hour expiration)","uniqueKey":"presigned_urls","typeLabel":"string\u003curi>[]"},"data_scanned_in_bytes":{"type":"integer","description":"Amount of data scanned by the query (if succeeded)","uniqueKey":"data_scanned_in_bytes","typeLabel":"integer"},"execution_time_in_millis":{"type":"integer","description":"Query execution time in milliseconds (if succeeded)","uniqueKey":"execution_time_in_millis","typeLabel":"integer"},"state_change_reason":{"type":"string","description":"Error message (if failed)","uniqueKey":"state_change_reason","typeLabel":"string"},"result_reused":{"type":"boolean","description":"Whether Athena served a stored result of an identical earlier query instead of running it again. Present only when the workspace's query cache applied to this query (AWS, API/MCP tokens, CSV).","uniqueKey":"result_reused","typeLabel":"boolean"}},"required":["state"],"uniqueKey":"","typeLabel":"object"},"examples":{"SuccessfulResponse":{"title":"SuccessfulResponse","summary":"Successful Response","description":"Successful query execution with presigned download URLs","value":{"state":"SUCCEEDED","presigned_urls":["https://storage.googleapis.com/bucket/query-20251119-154427-123456-000000000000.parquet?X-Goog-Algorithm=GOOG4-RSA-SHA256\u0026X-Goog-Credential=..."],"data_scanned_in_bytes":11250,"execution_time_in_millis":408}},"FailedQueryResponse":{"title":"FailedQueryResponse","summary":"Failed Query Response","description":"Query execution failed due to SQL syntax error","value":{"state":"FAILED","state_change_reason":"Syntax error: Expected end of input but got identifier 'FORM' at line 1, column 15"}}},"exampleType":"examples"}},"description":"","exampleType":"examples"}},"security":{"8512fdde-4759-4dcb-903b-a97a81408231":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"API Key authentication. Format: 'x-api-key: api_key'","scopes":[],"schemeName":"ApiKeyAuth"}}},"servers":{"8abe2527-822d-4e7e-80a5-24c35640d81f":{"url":"https://api.nekt.ai"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"apiKey","in":"header","name":"x-api-key","description":"API Key authentication. Format: 'x-api-key: api_key'","scopes":[],"schemeName":"ApiKeyAuth"},"schema":{"title":"x-api-key","type":"string","description":"API Key authentication. Format: 'x-api-key: api_key'","isRequired":true,"typeLabel":"string","deprecated":false},"schemeName":"ApiKeyAuth","name":"x-api-key"}],"title":"ApiKeyAuth"}]},"originalFileLocation":"https://api.nekt.ai/api/schema/"},"subdomain":"nekt","siteName":"Nekt","title":"SQL Query - Nekt","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-03-09T18:02:46.211Z","originalFileLocation":"data-api/sql-query.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=\"Execute a SQL query on the organization\u0026#x27;s data warehouse and return presigned URLs to download results. This endpoint executes SQL queries on the organization\u0026#x27;s data warehouse (AWS Athena or GCP BigQuery) and returns presigned URLs for downloading the results directly from cloud storage (S3 or GCS). Important: Customer data never transits through Nekt servers. Results are stored in the organization\u0026#x27;s cloud storage and accessed via time-limited presigned URLs (1 hour expiration). Requirements: - Organization must have completed cloud setup (cloud_setup_completed = True) Cloud Provider Support: - AWS: Executes queries on Athena - GCP: Executes queries on BigQuery Output Formats: - csv: CSV format (default) - supports simple data types only - parquet: Parquet format - supports all data types including complex types (arrays, structs, etc.) Limitations: - BigQuery CSV export does not support complex data types (ARRAY, STRUCT, JSON). Use Parquet mode instead. - Athena UNLOAD for Parquet may not support certain timestamp types. Cast problematic columns in the SQL query. Example Request: json { \u0026quot;sql\u0026quot;: \u0026quot;SELECT * FROM my_table LIMIT 100\u0026quot;, \u0026quot;mode\u0026quot;: \u0026quot;parquet\u0026quot;, \u0026quot;mode_options\u0026quot;: {\u0026quot;compression\u0026quot;: \u0026quot;SNAPPY\u0026quot;} } Example Response: json { \u0026quot;state\u0026quot;: \u0026quot;SUCCEEDED\u0026quot;, \u0026quot;presigned_urls\u0026quot;: [ \u0026quot;https://storage.googleapis.com/bucket/query-20251119-154427-123456-000000000000.parquet?...\u0026quot; ], \u0026quot;data_scanned_in_bytes\u0026quot;: 11250, \u0026quot;execution_time_in_millis\u0026quot;: 408 }\">\u003cmeta data-mint-head name=\"application-name\" content=\"Nekt\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/nekt/vtuzSdYqWUIGYPQe/_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/nekt/vtuzSdYqWUIGYPQe/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/nekt/vtuzSdYqWUIGYPQe/_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/nekt/vtuzSdYqWUIGYPQe/_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/nekt/vtuzSdYqWUIGYPQe/_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/nekt/vtuzSdYqWUIGYPQe/_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/nekt/vtuzSdYqWUIGYPQe/_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/nekt/vtuzSdYqWUIGYPQe/_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/nekt/vtuzSdYqWUIGYPQe/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"SQL Query - Nekt\">\u003cmeta data-mint-head property=\"og:description\" content=\"Execute a SQL query on the organization\u0026#x27;s data warehouse and return presigned URLs to download results. This endpoint executes SQL queries on the organization\u0026#x27;s data warehouse (AWS Athena or GCP BigQuery) and returns presigned URLs for downloading the results directly from cloud storage (S3 or GCS). Important: Customer data never transits through Nekt servers. Results are stored in the organization\u0026#x27;s cloud storage and accessed via time-limited presigned URLs (1 hour expiration). Requirements: - Organization must have completed cloud setup (cloud_setup_completed = True) Cloud Provider Support: - AWS: Executes queries on Athena - GCP: Executes queries on BigQuery Output Formats: - csv: CSV format (default) - supports simple data types only - parquet: Parquet format - supports all data types including complex types (arrays, structs, etc.) Limitations: - BigQuery CSV export does not support complex data types (ARRAY, STRUCT, JSON). Use Parquet mode instead. - Athena UNLOAD for Parquet may not support certain timestamp types. Cast problematic columns in the SQL query. Example Request: json { \u0026quot;sql\u0026quot;: \u0026quot;SELECT * FROM my_table LIMIT 100\u0026quot;, \u0026quot;mode\u0026quot;: \u0026quot;parquet\u0026quot;, \u0026quot;mode_options\u0026quot;: {\u0026quot;compression\u0026quot;: \u0026quot;SNAPPY\u0026quot;} } Example Response: json { \u0026quot;state\u0026quot;: \u0026quot;SUCCEEDED\u0026quot;, \u0026quot;presigned_urls\u0026quot;: [ \u0026quot;https://storage.googleapis.com/bucket/query-20251119-154427-123456-000000000000.parquet?...\u0026quot; ], \u0026quot;data_scanned_in_bytes\u0026quot;: 11250, \u0026quot;execution_time_in_millis\u0026quot;: 408 }\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Nekt\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.nekt.com/data-api/sql-query\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://nekt.mintlify.site/_mintlify/api/og/v2?division=Endpoints\u0026amp;title=SQL+Query\u0026amp;description=Execute+a+SQL+query+on+the+organization%27s+data+warehouse+and+return+presigned+URLs+to+download+results.%0A%0AThis+endpoint+executes+SQL+queries+on+the+organization%27\u0026amp;theme=ab0eecb27443f99b68604474\u0026amp;signature=91a19e5169fe5261f05d5e26b2e79941db14aa82c83479cdb2d239a032abec1f\">\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=\"SQL Query - Nekt\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Execute a SQL query on the organization\u0026#x27;s data warehouse and return presigned URLs to download results. This endpoint executes SQL queries on the organization\u0026#x27;s data warehouse (AWS Athena or GCP BigQuery) and returns presigned URLs for downloading the results directly from cloud storage (S3 or GCS). Important: Customer data never transits through Nekt servers. Results are stored in the organization\u0026#x27;s cloud storage and accessed via time-limited presigned URLs (1 hour expiration). Requirements: - Organization must have completed cloud setup (cloud_setup_completed = True) Cloud Provider Support: - AWS: Executes queries on Athena - GCP: Executes queries on BigQuery Output Formats: - csv: CSV format (default) - supports simple data types only - parquet: Parquet format - supports all data types including complex types (arrays, structs, etc.) Limitations: - BigQuery CSV export does not support complex data types (ARRAY, STRUCT, JSON). Use Parquet mode instead. - Athena UNLOAD for Parquet may not support certain timestamp types. Cast problematic columns in the SQL query. Example Request: json { \u0026quot;sql\u0026quot;: \u0026quot;SELECT * FROM my_table LIMIT 100\u0026quot;, \u0026quot;mode\u0026quot;: \u0026quot;parquet\u0026quot;, \u0026quot;mode_options\u0026quot;: {\u0026quot;compression\u0026quot;: \u0026quot;SNAPPY\u0026quot;} } Example Response: json { \u0026quot;state\u0026quot;: \u0026quot;SUCCEEDED\u0026quot;, \u0026quot;presigned_urls\u0026quot;: [ \u0026quot;https://storage.googleapis.com/bucket/query-20251119-154427-123456-000000000000.parquet?...\u0026quot; ], \u0026quot;data_scanned_in_bytes\u0026quot;: 11250, \u0026quot;execution_time_in_millis\u0026quot;: 408 }\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://nekt.mintlify.site/_mintlify/api/og/v2?division=Endpoints\u0026amp;title=SQL+Query\u0026amp;description=Execute+a+SQL+query+on+the+organization%27s+data+warehouse+and+return+presigned+URLs+to+download+results.%0A%0AThis+endpoint+executes+SQL+queries+on+the+organization%27\u0026amp;theme=ab0eecb27443f99b68604474\u0026amp;signature=91a19e5169fe5261f05d5e26b2e79941db14aa82c83479cdb2d239a032abec1f\">\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/nekt/vtuzSdYqWUIGYPQe/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Nekt\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#097860\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.nekt.com/data-api/sql-query\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/data-api/sql-query.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.nekt.com/#organization\",\"name\":\"Nekt\",\"url\":\"https://docs.nekt.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/nekt/fAFtC-RZLnUKCv7c/assets/logo/light.svg?fit=max\u0026auto=format\u0026n=fAFtC-RZLnUKCv7c\u0026q=85\u0026s=cba8701f886607d770a7510c525d81b7\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.nekt.com#website\",\"name\":\"Nekt\",\"url\":\"https://docs.nekt.com\",\"publisher\":{\"@id\":\"https://docs.nekt.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.nekt.com/data-api/sql-query#webpage\",\"url\":\"https://docs.nekt.com/data-api/sql-query\",\"name\":\"SQL Query\",\"description\":\"Execute a SQL query on the organization's data warehouse and return presigned URLs to download results. This endpoint executes SQL queries on the organization's data warehouse (AWS Athena or GCP BigQuery) and returns presigned URLs for downloading the results directly from cloud storage (S3 or GCS). Important: Customer data never transits through Nekt servers. Results are stored in the organization's cloud storage and accessed via time-limited presigned URLs (1 hour expiration). Requirements: - Organization must have completed cloud setup (cloud_setup_completed = True) Cloud Provider Support: - AWS: Executes queries on Athena - GCP: Executes queries on BigQuery Output Formats: - csv: CSV format (default) - supports simple data types only - parquet: Parquet format - supports all data types including complex types (arrays, structs, etc.) Limitations: - BigQuery CSV export does not support complex data types (ARRAY, STRUCT, JSON). Use Parquet mode instead. - Athena UNLOAD for Parquet may not support certain timestamp types. Cast problematic columns in the SQL query. Example Request: json { \\\"sql\\\": \\\"SELECT * FROM my_table LIMIT 100\\\", \\\"mode\\\": \\\"parquet\\\", \\\"mode_options\\\": {\\\"compression\\\": \\\"SNAPPY\\\"} } Example Response: json { \\\"state\\\": \\\"SUCCEEDED\\\", \\\"presigned_urls\\\": [ \\\"https://storage.googleapis.com/bucket/query-20251119-154427-123456-000000000000.parquet?...\\\" ], \\\"data_scanned_in_bytes\\\": 11250, \\\"execution_time_in_millis\\\": 408 }\",\"dateModified\":\"2026-03-09T18:02:46.211Z\",\"isPartOf\":{\"@id\":\"https://docs.nekt.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.nekt.com/data-api/sql-query#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.nekt.com/data-api/sql-query#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Nekt\",\"item\":\"https://docs.nekt.com\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Query\",\"item\":\"https://docs.nekt.com/data-api/sql-query\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.nekt.com/data-api/sql-query#apireference\",\"headline\":\"SQL Query\",\"name\":\"SQL Query\",\"description\":\"Execute a SQL query on the organization's data warehouse and return presigned URLs to download results. This endpoint executes SQL queries on the organization's data warehouse (AWS Athena or GCP BigQuery) and returns presigned URLs for downloading the results directly from cloud storage (S3 or GCS). Important: Customer data never transits through Nekt servers. Results are stored in the organization's cloud storage and accessed via time-limited presigned URLs (1 hour expiration). Requirements: - Organization must have completed cloud setup (cloud_setup_completed = True) Cloud Provider Support: - AWS: Executes queries on Athena - GCP: Executes queries on BigQuery Output Formats: - csv: CSV format (default) - supports simple data types only - parquet: Parquet format - supports all data types including complex types (arrays, structs, etc.) Limitations: - BigQuery CSV export does not support complex data types (ARRAY, STRUCT, JSON). Use Parquet mode instead. - Athena UNLOAD for Parquet may not support certain timestamp types. Cast problematic columns in the SQL query. Example Request: json { \\\"sql\\\": \\\"SELECT * FROM my_table LIMIT 100\\\", \\\"mode\\\": \\\"parquet\\\", \\\"mode_options\\\": {\\\"compression\\\": \\\"SNAPPY\\\"} } Example Response: json { \\\"state\\\": \\\"SUCCEEDED\\\", \\\"presigned_urls\\\": [ \\\"https://storage.googleapis.com/bucket/query-20251119-154427-123456-000000000000.parquet?...\\\" ], \\\"data_scanned_in_bytes\\\": 11250, \\\"execution_time_in_millis\\\": 408 }\",\"url\":\"https://docs.nekt.com/data-api/sql-query\",\"mainEntityOfPage\":{\"@id\":\"https://docs.nekt.com/data-api/sql-query#webpage\"},\"dateModified\":\"2026-03-09T18:02:46.211Z\",\"publisher\":{\"@id\":\"https://docs.nekt.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.nekt.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Nekt\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Nekt\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/data-api/sql-query.md","siteName":"Nekt","nav":{"global":null,"anchors":[{"anchor":"Documentation","icon":"book-open","pages":[{"title":"Documentation","href":"/what-is-nekt"}]},{"anchor":"Platform API","icon":"square-terminal","pages":[{"title":"Platform API","href":"/platform-api/introduction"}]},{"anchor":"Data API","icon":"square-terminal","groups":[{"group":"Data API","pages":[{"title":"Introduction","sidebarTitle":"Introduction","href":"/data-api/introduction"},{"title":"Known Limitations","sidebarTitle":"Known Limitations","description":"Understand the limitations and workarounds for different cloud providers and output formats.","href":"/data-api/known-limitations"}]},{"group":"Endpoints","pages":[{"title":"SQL Query","openapi":"POST /api/v1/sql-query/","href":"/data-api/sql-query"}]}]},{"anchor":"Build with AI","icon":"robot","pages":[{"title":"Build with AI","href":"/build-with-ai"}]}]},"basePath":"","title":"SQL Query - Nekt","buildId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","deploymentId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-DdEMm2kG.js","utils-BMo572L7.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-C-4m9KAx.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-DPLK2Oq9.js","snippetPresets-BKjfJMC9.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-DTsgtCEj.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-C8vmhyQM.js","shallow-r9w8LQGS.js","getApiPlaygroundDisplay-DjPI64HQ.js","CodeSnippet-C8Bvhl16.js","CodeSnippets-BtWUwcMy.js","Page-BIYvYBgk.js","getPastedJson-Dcm_3Pgl.js","icon-BXwrTpjc.js","MethodPill-CcjfVmmy.js","DuplicateIcon-BuKIbXAQ.js","createIcon-DaL9yXsO.js","DynamicMarkdown-Co5nikxh.js","SectionHeading-P4UNTsMZ.js","axios-vUo_bRtp.js","Markdown-CEfymfIH.js","clsx-Dq9TQuNi.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-D2J8knkn.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-BgZ2ThuU.js"]}