Snowflake Cortex Analyst API

The cortex-analyst API from Snowflake — 4 operation(s) for cortex-analyst.

Operations 9

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

POST /api/v2/cortex/analyst/feedback Rate a Cortex Analyst response · Send feedback #
Ask an LLM
“How do I tell Cortex Analyst an answer was wrong?”
“Can I attach a written comment when giving thumbs up or down on an Analyst reply?”
Tell an agent
Mark Cortex Analyst request {request_id} as helpful: {positive}.
Send feedback {positive} on request {request_id} with the note {feedback_message}.
POST /api/v2/cortex/analyst/message Ask Cortex Analyst a data question · Send a data question to the Cortex Analyst #
Ask an LLM
“Can I ask a plain-English question about my data and get SQL back?”
“How does Cortex Analyst turn a business question into an answer over a semantic model?”
Tell an agent
Ask Cortex Analyst what our revenue was last quarter.
Send this data question to Cortex Analyst using our semantic model.
POST /api/v2/cortex/analyst/verified-query-suggestions Suggest verified queries for a semantic model · Generate VQ suggestions for a semantic model #
Ask an LLM
“Can Cortex Analyst propose verified queries to add to my semantic model?”
“How many verified query suggestions can I page through at a time?”
Tell an agent
Generate verified query suggestions for {semantic_model} using warehouse {warehouse}.
Suggest up to {limit} verified queries for the model, running on warehouse {warehouse}.
POST /api/v2/cortex/analyst/fast-generation Generate or improve a semantic model quickly · Rapidly generate a semantic model given source material #
Ask an LLM
“Can I get real-time suggestions to improve a semantic model?”
“Is there a fast way to draft a semantic model from source material?”
Tell an agent
Rapidly generate a semantic model from {json_proto}.
Run fast generation to stream real-time improvement suggestions for my semantic model.
POST /api/v2/cortex/analyst/pre-selection Pick relevant tables for semantic model generation · Retrieve relevant table information from input data for semantic model… #
Ask an LLM
“Which tables should go into a new semantic model given my source data?”
“Can Cortex Analyst pre-select tables from a Tableau data source?”
Tell an agent
Pre-select relevant tables from {tds_source} using warehouse {warehouse}.
Find the tables worth modelling from {tds_source} and SQL {sql_source} on warehouse {warehouse}.
POST /api/v2/cortex/analyst/filters-and-metrics-suggestions Suggest filters, facts and metrics for a model · Generate filters, facts, and metrics suggestions for a semantic model #
Ask an LLM
“What metrics and filters could I add to my semantic view?”
“Can I page separately through suggested facts, filters and metrics?”
Tell an agent
Suggest filters, facts and metrics for semantic model {semantic_model}.
Give me up to {metrics_limit} metric suggestions for tables {tables}.
POST /api/v2/cortex/analyst/agentic-optimizations List agentic optimization runs for a model · List all agentic optimization runs for a given base model #
Ask an LLM
“Which agentic optimization runs have been done on my semantic model?”
“Can I see the optimization history for a base model?”
Tell an agent
List all agentic optimization runs for semantic model {semantic_model}.
Show every optimization run started on base model {semantic_model}.
GET /api/v2/cortex/analyst/agentic-optimization Check an agentic optimization run's status · Get the status and state of a specified agentic optimization run #
Ask an LLM
“Is my agentic optimization run finished yet?”
“What state is a specific semantic model optimization run in?”
Tell an agent
Get the status of agentic optimization {optimization_name}.
Check whether optimization run {optimization_name} has completed.
GET /api/v2/cortex/analyst/token Exchange a Cortex Analyst OAuth token · Internal endpoint to exchange a Cortex Analyst Oauth token #
Ask an LLM
“How is a Cortex Analyst OAuth token exchanged for a scoped token?”
“What does the internal Cortex Analyst token endpoint return?”
Tell an agent
Exchange my Cortex Analyst OAuth token for a scoped token.
Get a scoped Cortex Analyst token for this session.

Documentation

📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/account
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/alert
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/api-integration
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/catalog-integration
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/compute-pool
📖
Documentation
https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-analyst/rest-api
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/cortex-inference
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/cortex-search-service
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/database-role
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/database
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/dynamic-table
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/event-table
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/external-volume
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/function
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/grant
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/iceberg-table
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/image-repository
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/managed-account
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/network-policy
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/notebook
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/notification-integration
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/pipe
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/procedure
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/result
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/role
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/schema
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/service
📖
Documentation
https://docs.snowflake.com/en/developer-guide/sql-api/index
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/stage
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/stream
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/table
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/task
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/user-defined-function
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/user
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/view
📖
Documentation
https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/warehouse

Specifications

Schemas & Data

Other Resources

🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/account-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/alert-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/api-integration-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/catalog-integration-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/compute-pool-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/cortex-analyst-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/cortex-inference-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/cortex-search-service-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/database-role-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/database-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/dynamic-table-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/event-table-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/external-volume-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/function-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/grant-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/iceberg-table-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/image-repository-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/managed-account-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/network-policy-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/notebook-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/notification-integration-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/pipe-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/procedure-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/role-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/schema-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/service-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/sqlapi-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/snowflake-sql-rest-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/stage-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/stream-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/table-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/task-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/user-defined-function-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/user-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/view-context.jsonld
🔗
JSONLD
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/json-ld/warehouse-context.jsonld
🔗
Overlay
https://raw.githubusercontent.com/api-evangelist/snowflake/refs/heads/main/overlays/snowflake-cortex-analyst-overlay.yaml

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/snowflake:snowflake-cortex-analyst-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

snowflake-cortex-analyst-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  version: 0.0.1
  title: Cortex Analyst API
  description: The Snowflake Cortex Analyst API is a REST API that allows end user to chat with their data leveraging semantic models to generate SQL queries.
  contact:
    name: Snowflake, Inc.
    url: https://snowflake.com
    email: support@snowflake.com
servers:
- description: Snowflake API
  url: https://org-account.snowflakecomputing.com
security:
- KeyPair: []
- ExternalOAuth: []
- SnowflakeOAuth: []
- ProgrammaticAccessToken: []
tags:
- name: cortex-analyst
paths:
  /api/v2/cortex/analyst/feedback:
    post:
      operationId: sendFeedback
      tags:
      - cortex-analyst
      description: Send a user feedback of Cortex Analyst response
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendFeedbackRequest'
      responses:
        '200':
          $ref: common.yaml#/components/responses/200SuccessResponse
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
      summary: Send feedback
      x-summary-source: derived
  /api/v2/cortex/analyst/message:
    post:
      operationId: sendMessage
      tags:
      - cortex-analyst
      summary: Send a data question to the Cortex Analyst
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: common-cortex-analyst.yaml#/components/schemas/SendMessageRequest
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: common-cortex-analyst.yaml#/components/schemas/SendMessageResponse
            text/event-stream:
              schema:
                type: string
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
  /api/v2/cortex/analyst/verified-query-suggestions:
    post:
      operationId: generateVerifiedQuerySuggestions
      tags:
      - cortex-analyst
      summary: Generate VQ suggestions for a semantic model
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateVerifiedQuerySuggestionsRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateVerifiedQuerySuggestionsResponse'
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
  /api/v2/cortex/analyst/fast-generation:
    post:
      operationId: fastGeneration
      tags:
      - cortex-analyst
      summary: Rapidly generate a semantic model given source material
      description: Provides real-time suggestions for improving a given semantic model via a streaming response.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FastGenerationRequest'
      responses:
        '200':
          description: OK. Streaming suggestions.
          content:
            text/event-stream:
              schema:
                type: string
                description: 'Server-Sent Events stream. Each event''s data payload will be a JSON representation of a `FastGenerationResponse` object.

                  Events include:

                  - `response`: Contains a `FastGenerationResponse` payload.

                  - `error`: Contains a `StreamingError` payload if an error occurs during streaming.

                  - `done`: Contains the string payload "done"'
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
  /api/v2/cortex/analyst/pre-selection:
    post:
      operationId: preSelection
      tags:
      - cortex-analyst
      summary: Retrieve relevant table information from input data for semantic model…
      description: Retrieve relevant table information from input data for semantic model generation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreSelectionRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreSelectionResponse'
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
  /api/v2/cortex/analyst/filters-and-metrics-suggestions:
    post:
      operationId: generateFiltersAndMetricsSuggestions
      tags:
      - cortex-analyst
      summary: Generate filters, facts, and metrics suggestions for a semantic model
      description: Generate suggestions for filters, facts, and metrics on a semantic view/model.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateFiltersAndMetricsSuggestionsRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateFiltersAndMetricsSuggestionsResponse'
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
  /api/v2/cortex/analyst/agentic-optimizations:
    post:
      operationId: listAgenticOptimizations
      tags:
      - cortex-analyst
      summary: List all agentic optimization runs for a given base model
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ListAgenticOptimizationsRequest'
      responses:
        '200':
          description: OK. Retrieved optimizations.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListAgenticOptimizationsResponse'
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
  /api/v2/cortex/analyst/agentic-optimization:
    get:
      operationId: getAgenticOptimization
      tags:
      - cortex-analyst
      summary: Get the status and state of a specified agentic optimization run
      parameters:
      - name: optimization_name
        in: query
        description: The fully-qualified name of the optimization to retrieve.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: OK. Retrieved optimization.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAgenticOptimizationResponse'
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
  /api/v2/cortex/analyst/token:
    get:
      operationId: getScopedToken
      summary: Internal endpoint to exchange a Cortex Analyst Oauth token
      tags:
      - cortex-analyst
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenInfo'
        '400':
          $ref: common.yaml#/components/responses/400BadRequest
        '401':
          $ref: common.yaml#/components/responses/401Unauthorized
        '403':
          $ref: common.yaml#/components/responses/403Forbidden
        '404':
          $ref: common.yaml#/components/responses/404NotFound
        '405':
          $ref: common.yaml#/components/responses/405MethodNotAllowed
        '429':
          $ref: common.yaml#/components/responses/429LimitExceeded
        '500':
          $ref: common.yaml#/components/responses/500InternalServerError
        '503':
          $ref: common.yaml#/components/responses/503ServiceUnavailable
        '504':
          $ref: common.yaml#/components/responses/504GatewayTimeout
components:
  schemas:
    SemanticModelChangeValue:
      type: object
      description: One-of value. A map with exactly one key set corresponding to the semantic model object or primitive.
      additionalProperties: true
    ListAgenticOptimizationsRequest:
      type: object
      description: A request to list all agentic optimization runs for a given base model. Note that only semantic views and semantic model files are supported. Inline semantic models will lead to a 400 response.
      properties:
        semantic_model:
          $ref: common-cortex-analyst.yaml#/components/schemas/SemanticModelObject
        experimental:
          type: string
          description: JSON serialized string of experimental API fields (undocumented).
      required:
      - semantic_model
    GenerateVerifiedQuerySuggestionsResponse:
      type: object
      description: The non-streaming response object for the VQ Suggestions request
      properties:
        request_id:
          type: string
          description: Unique request ID
        vq_suggestions:
          type: array
          items:
            $ref: '#/components/schemas/VerifiedQuerySuggestion'
        warnings:
          type: array
          items:
            $ref: common-cortex-analyst.yaml#/components/schemas/Warning
    StagingData:
      type: object
      description: Contains information indicating where to stage data
      properties:
        database:
          type: string
          description: Database name
        schema:
          type: string
          description: Schema name
      required:
      - database
      - schema
    SemanticModelUpdateSuggestion:
      type: object
      description: A suggestion consisting of ordered semantic object changes with optional setup SQL and score.
      properties:
        changes:
          type: array
          description: Changes to be applied in order
          items:
            $ref: '#/components/schemas/SemanticModelChange'
        version:
          type: integer
          format: int32
          description: Version of SemanticModelUpdateSuggestion
        metadata:
          type: object
          description: Arbitrary metadata associated with this suggestion.
          additionalProperties: true
    SqlInputs:
      type: object
      description: Contains SQL queries which may be annotated with natural language
      properties:
        queries:
          type: array
          items:
            $ref: '#/components/schemas/AnnotatedSqlQuery'
      required:
      - queries
    SemanticModelChange:
      type: object
      description: A single change to apply to the semantic object
      properties:
        operation:
          $ref: '#/components/schemas/SemanticModelChangeOperation'
        path:
          type: string
          description: Path to the node in the semantic object to change
        value:
          $ref: '#/components/schemas/SemanticModelChangeValue'
      required:
      - operation
      - path
    FastGenerationRequest:
      type: object
      description: The request for the FastGeneration rpc
      properties:
        json_proto:
          type: object
          description: A JSON-mapped FastGenerationRequest protobuf
          additionalProperties: true
    PreSelectionResponse:
      type: object
      description: The response for the PreSelection rpc
      properties:
        request_id:
          type: string
          description: Unique request ID
        tables:
          type: array
          items:
            $ref: '#/components/schemas/TableColumns'
        warnings:
          type: array
          items:
            $ref: common-cortex-analyst.yaml#/components/schemas/Warning
        experimental:
          type: string
          description: JSON serialized string of experimental API fields (undocumented).
    AnnotatedSqlQuery:
      type: object
      description: Contains a SQL query with optional context and natural language annotation
      properties:
        sql_text:
          type: string
          description: SQL query text
        database:
          type: string
          description: Database associated with the SQL query
        schema:
          type: string
          description: Schema associated with the SQL query
        corresponding_question:
          type: string
          description: Natural language question that the SQL query answers
        additional_context:
          type: string
          description: Free-form string for additional context about the query
      required:
      - sql_text
    TableauAuth:
      type: object
      description: Authentication required to connect to Tableau
      properties:
        secret_fqn:
          type: string
          description: The fully qualified name of the secret containing the Tableau PAT
        server_url:
          type: string
          description: The Tableau server name to send requests to
      required:
      - secret_fqn
      - server_url
    GenerateVerifiedQuerySuggestionsRequest:
      type: object
      description: The request object for getting VQ suggestions
      properties:
        mode:
          type: string
          enum:
          - ca_requests_based
          - query_history_based
          description: Whether to generate suggestions based on historical CA requests or all SQL queries. One of 'ca_requests_based' or 'query_history_based'
          default: ca_requests_based
        semantic_model:
          $ref: common-cortex-analyst.yaml#/components/schemas/SemanticModelObject
        tables:
          type: array
          items:
            $ref: '#/components/schemas/TableColumns'
        tds_source:
          type: array
          items:
            $ref: '#/components/schemas/TdsInput'
        sql_source:
          $ref: '#/components/schemas/SqlInputs'
        warehouse:
          type: string
          description: Warehouse name to use for processing suggestions.
        offset:
          description: The suggestions offset index, offset = 0 indicates the first call
          type: integer
          format: int32
        limit:
          description: The number of suggestions to return starting from the provided offset value
          type: integer
          format: int32
        experimental:
          type: string
          description: JSON serialized string of experimental API fields (undocumented).
      required:
      - warehouse
    VerifiedQuerySuggestion:
      type: object
      description: A suggestion to add or remove or replace a Verified Query to a semantic model.
      properties:
        score:
          type: number
          description: Score of the suggestion, higher is better.
          format: float
        vq_to_add:
          $ref: common-cortex-analyst.yaml#/components/schemas/VerifiedQuery
        vq_to_remove:
          $ref: common-cortex-analyst.yaml#/components/schemas/VerifiedQuery
        metadata:
          type: object
          description: Arbitrary metadata associated with this suggestion.
          additionalProperties: true
    TokenInfo:
      type: object
      properties:
        token:
          type: string
        expiration_seconds:
          type: integer
    PreSelectionRequest:
      type: object
      description: The request for the PreSelection rpc
      properties:
        tds_source:
          type: array
          items:
            $ref: '#/components/schemas/TdsInput'
        sql_source:
          $ref: '#/components/schemas/SqlInputs'
        warehouse:
          type: string
          description: Warehouse name to use for processing.
        tableau_input:
          $ref: '#/components/schemas/TableauInput'
        experimental:
          type: string
          description: JSON serialized string of experimental API fields (undocumented).
      required:
      - tds_source
      - warehouse
    AgenticOptimizationStatus:
      type: string
      description: The status of an agentic optimization run.
      enum:
      - IN_PROGRESS
      - COMPLETED
      - FAILED
      - CANCELED
    TableauStageFiles:
      type: object
      description: Specifies stage paths of the Tableau files
      properties:
        stage_paths:
          type: array
          items:
            type: string
            description: The stage paths of where the Tableau file is stored
    TdsInput:
      type: object
      description: Tableau data source file stage paths
      properties:
        tds_stage_path:
          type: string
          description: TDS file stage path
        tds_file_content:
          type: string
          description: TDS file raw contents
      required:
      - tds_stage_path
    GenerateFiltersAndMetricsSuggestionsResponse:
      type: object
      description: The response object for filters, facts, and metrics suggestions
      properties:
        request_id:
          type: string
          description: Unique request ID
        suggestions:
          type: array
          items:
            $ref: '#/components/schemas/SemanticModelUpdateSuggestion'
        warnings:
          type: array
          items:
            $ref: common-cortex-analyst.yaml#/components/schemas/Warning
        experimental:
          type: string
          description: JSON serialized string of experimental API fields (undocumented).
    SendFeedbackRequest:
      type: object
      description: The request object for sending user feedback on Cortex Analyst responses
      properties:
        request_id:
          type: string
          description: Request id associated with the feedback
        positive:
          type: boolean
          description: Whether the response was good (true) or bad (false)
        feedback_message:
          type: string
          description: The text for the detailed feedback message
      required:
      - request_id
      - positive
    GetAgenticOptimizationResponse:
      type: object
      description: The status, state, and outcome of a specified agentic optimization run.
      properties:
        request_id:
          type: string
          description: Unique request ID
          example: abcd1234-5678-90ab-cdef-1234567890ab
        status:
          $ref: '#/components/schemas/AgenticOptimizationStatus'
        state:
          type: string
          description: An opaque string containing the state of the optimization.
          example: '{"progress": 0.5, "details": "Halfway through the optimization"}'
        outcome:
          type: string
          description: An opaque string containing the outcome of the optimization, separate from the state. This should be the JSON-encoded form of an AgenticOptimizationOutcome protobuf message.
          example: '{"extensions": ""}'
        base_semantic_view_name:
          type: string
          description: The fully-qualified name of the base semantic model. This can be either a semantic view FQN (e.g., 'DB.SCHEMA.VIEW') or a stage file path (e.g., '@STAGE/path/file.yaml').
          example: MY_DB.MY_SCHEMA.MY_SEMANTIC_VIEW
    TableColumns:
      type: object
      description: Contains information about table and column names
      properties:
        database:
          type: string
          description: Database name
        schema:
          type: string
          description: Schema name
        table:
          type: string
          description: Table name
        column_names:
          type: array
          items:
            type: string
            description: Column names
      required:
      - database
      - schema
      - table
      - column_names
    TableauInput:
      type: object
      description: Input required to extract data from Tableau. Tableau Cloud users can optionally provide integration data if files are not already uploaded
      properties:
        stage_files:
          $ref: '#/components/schemas/TableauStageFiles'
        server_files:
          $ref: '#/components/schemas/TableauServerFiles'
    GenerateFiltersAndMetricsSuggestionsRequest:
      type: object
      description: The request object for generating filters, facts, and metrics suggestions
      properties:
        semantic_model:
          $ref: common-cortex-analyst.yaml#/components/schemas/SemanticModelObject
        tables:
          type: array
          description: Tables and selected columns to build a basic semantic model from
          items:
            $ref: '#/components/schemas/TableColumns'
        warehouse:
          type: string
          description: Warehouse name to use for processing suggestions.
        metrics_offset:
          type: integer
          format: int32
          description: Pagination offset for metrics suggestions
        metrics_limit:
          type: integer
          format: int32
          description: Pagination limit for metrics suggestions
        facts_offset:
          type: integer
          format: int32
          description: Pagination offset for facts suggestions
        facts_limit:
          type: integer
          format: int32
          description: Pagination limit for facts suggestions
        filters_offset:
          type: integer
          format: int32
          description: Pagination offset for filters suggestions
        filters_limit:
          type: integer
          format: int32
          description: Pagination limit for filters suggestions
        experimental:
          type: string
          description: JSON serialized string of experimental API fields (undocumented).
    ListAgenticOptimizationsResponse:
      type: object
      description: The response from listing agentic optimization runs.
      properties:
        request_id:
          type: string
          description: Unique request ID
          example: abcd1234-5678-90ab-cdef-1234567890ab
        optimizations:
          type: array
          items:
            $ref: '#/components/schemas/AgenticOptimizationSummary'
    TableauIntegration:
      type: object
      description: Contains data on how to connect to Tableau and process data
      properties:
        auth:
          $ref: '#/components/schemas/TableauAuth'
        staging_data:
          $ref: '#/components/schemas/StagingData'
      required:
      - auth
      - staging_data
    AgenticOptimizationSummary:
      type: object
      description: A summary of an agentic optimization run.
      properties:
        optimization_name:
          type: string
          description: The fully-qualified name of the optimization.
        status:
          $ref: '#/components/schemas/AgenticOptimizationStatus'
    TableauServerFiles:
      type: object
      description: Contains Tableau URLs to retrieve files from Tableau server and information around Tableau integration
      properties:
        tableau_urls:
          type: array
          items:
            type: string
            description: The URLs in Tableau to retrieve files from
        integration:
          $ref: '#/components/schemas/TableauIntegration'
    SemanticModelChangeOperation:
      type: string
      description: Operation applied to a semantic object at a given path
      enum:
      - set
      - append
      - remove
  securitySchemes:
    KeyPair:
      $ref: common.yaml#/components/securitySchemes/KeyPair
    ExternalOAuth:
      $ref: common.yaml#/components/securitySchemes/ExternalOAuth
    SnowflakeOAuth:
      $ref: common.yaml#/components/securitySchemes/SnowflakeOAuth
    ProgrammaticAccessToken:
      $ref: common.yaml#/components/securitySchemes/ProgrammaticAccessToken