Version 4.0.26.22 (latest)

### Run a saved query.

This runs a previously saved query. You can use this on a query that was generated in the Looker UI
or one that you have explicitly created using the API. You can also use a query 'id' from a saved 'Look'.

The 'result_format' parameter specifies the desired structure and format of the response.

Supported formats:

| result_format | Description |
|:---:|:---|
| json | Plain json |
| json_bi | (*RECOMMENDED*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema |
| json_detail | (*LEGACY*) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query |
| csv | Comma separated values with a header |
| txt | Tab separated values with a header |
| html | Simple html |
| md | Simple markdown |
| xlsx | MS Excel spreadsheet |
| sql | Returns the generated SQL rather than running the query |
| png | A PNG image of the visualization of the query |
| jpg | A JPG image of the visualization of the query |

**Note** : Streaming queries only write results to the cache when using the `json_detail` format. Queries in other formats only populate the cache if they cannot be streamed (such as when table calculations or row totals are present). Once cached, all result formats can retrieve results from the cache.

## Request

GET /queries/{query_id}/run/{result_format} Datatype Description Request HTTP Request path HTTP Path Expand HTTP Path definition... query_id string Id of query result_format string Format of result query HTTP Query Expand HTTP Query definition... limit integer Row limit (may override the limit in the saved query). apply_formatting boolean Apply model-specified formatting to each result. apply_vis boolean Apply visualization options to results. cache boolean Get results from cache if available. image_width integer Render width for image formats. image_height integer Render height for image formats. generate_drill_links boolean Generate drill links (only applicable to 'json_detail' format. force_production boolean Force use of production models even if the user is in development mode. Note that this flag being false does not guarantee development models will be used. cache_only boolean Retrieve any results from cache even if the results have expired. path_prefix string Prefix to use for drill links (url encoded). rebuild_pdts boolean Rebuild PDTS used in query. server_table_calcs boolean Perform table calculations on query results

## Response

### 200: Query

Datatype Description (string) string

### 400: Bad Request

Datatype Description (object) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

### 403: Database OAuth Error

Datatype Description (object) [ValidationError](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/ValidationError) message string Error details errors [ValidationErrorDetail](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/ValidationErrorDetail)\[\] Expand ValidationErrorDetail definition... field string Field with error code string Error code message string Error info message documentation_url string Documentation link documentation_url string Documentation link

### 404: Not Found

Datatype Description (object) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

### 422: Validation Error

Datatype Description (object) [ValidationError](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/ValidationError) message string Error details errors [ValidationErrorDetail](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/ValidationErrorDetail)\[\] Expand ValidationErrorDetail definition... field string Field with error code string Error code message string Error info message documentation_url string Documentation link documentation_url string Documentation link

### 429: Too Many Requests

Datatype Description (object) [Error](https://docs.cloud.google.com/looker/docs/reference/looker-api/latest/types/Error) message string Error details documentation_url string Documentation link

## Examples

### Python


|---|
| [https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/cloud-function-content-cleanup-automation/main.py](https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/cloud-function-content-cleanup-automation/main.py#L118 "https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/cloud-function-content-cleanup-automation/main.py") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/cloud-function-content-cleanup-automation/main.py](https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/cloud-function-content-cleanup-automation/main.py#L169 "https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/cloud-function-content-cleanup-automation/main.py") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/cloud-function-write-to-bigquery/main.py](https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/cloud-function-write-to-bigquery/main.py#L23 "https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/cloud-function-write-to-bigquery/main.py") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/large_dashboard_warning_text_automation/add_warning_to_large_dashboards.py](https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/large_dashboard_warning_text_automation/add_warning_to_large_dashboards.py#L43 "https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/large_dashboard_warning_text_automation/add_warning_to_large_dashboards.py") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/python/tests/integration/test_methods.py](https://github.com/looker-open-source/sdk-codegen/blob/main/python/tests/integration/test_methods.py#L306 "https://github.com/looker-open-source/sdk-codegen/blob/main/python/tests/integration/test_methods.py") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/python/tests/integration/test_methods.py](https://github.com/looker-open-source/sdk-codegen/blob/main/python/tests/integration/test_methods.py#L309 "https://github.com/looker-open-source/sdk-codegen/blob/main/python/tests/integration/test_methods.py") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/python/tests/integration/test_methods.py](https://github.com/looker-open-source/sdk-codegen/blob/main/python/tests/integration/test_methods.py#L319 "https://github.com/looker-open-source/sdk-codegen/blob/main/python/tests/integration/test_methods.py") |

### Kotlin


|---|
| [https://github.com/looker-open-source/sdk-codegen/blob/main/kotlin/src/test/TestMethods.kt](https://github.com/looker-open-source/sdk-codegen/blob/main/kotlin/src/test/TestMethods.kt#L201 "https://github.com/looker-open-source/sdk-codegen/blob/main/kotlin/src/test/TestMethods.kt") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/kotlin/src/test/TestMethods.kt](https://github.com/looker-open-source/sdk-codegen/blob/main/kotlin/src/test/TestMethods.kt#L234 "https://github.com/looker-open-source/sdk-codegen/blob/main/kotlin/src/test/TestMethods.kt") |

### TypeScript


|---|
| [https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts](https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts#L730 "https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts](https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts#L740 "https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts](https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts#L743 "https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts](https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts#L852 "https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts](https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts#L855 "https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/methods.spec.ts") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts](https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts#L664 "https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts](https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts#L674 "https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts](https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts#L677 "https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts](https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts#L783 "https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts](https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts#L786 "https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-node/test/sdk.apispec.ts") |

### Swift


|---|
| [https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/Tests/lookerTests/smokeTests.swift](https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/Tests/lookerTests/smokeTests.swift#L117 "https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/Tests/lookerTests/smokeTests.swift") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/Tests/lookerTests/smokeTests.swift](https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/Tests/lookerTests/smokeTests.swift#L121 "https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/Tests/lookerTests/smokeTests.swift") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/Tests/lookerTests/smokeTests.swift](https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/Tests/lookerTests/smokeTests.swift#L125 "https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/Tests/lookerTests/smokeTests.swift") |
| [https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/Tests/lookerTests/smokeTests.swift](https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/Tests/lookerTests/smokeTests.swift#L142 "https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/Tests/lookerTests/smokeTests.swift") |