> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# API

> API reference for Snowflake: every `snowflake.api.*` operation with input and output types.

Every `snowflake.api.*` operation is listed below with parameter shapes and return types from the plugin Zod schemas.

> [!NOTE]
>
> **New to Corsair?** See [API access](https://docs.corsair.dev/concepts/api.md), [authentication](https://docs.corsair.dev/concepts/auth.md), and [error handling](https://docs.corsair.dev/concepts/error-handling).

## Statements

### cancel

`statements.cancel`

Cancel a running SQL statement.

**Risk:** `write`

```ts theme={null}
await corsair.snowflake.api.statements.cancel({ statementHandle: '019c06a4-0000-df4f-0000-00100006589e' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `statementHandle` | `string` | Yes | UUID-shaped handle (8-4-4-4-12 hex). |
| `requestId` | `string` | No | UUID-shaped request ID (8-4-4-4-12 hex). |
| `retry` | `boolean` | No | Requires `requestId`. `true` resubmits the same request without running it twice. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `code` | `string` | No | — |
| `sqlState` | `string` | No | — |
| `message` | `string` | No | — |
| `statementHandle` | `string` | Yes | — |
| `statementStatusUrl` | `string` | No | — |
| `createdOn` | `number` | No | — |

***

### get

`statements.get`

Fetch the status of a statement and one partition of its result.

**Risk:** `read`

```ts theme={null}
await corsair.snowflake.api.statements.get({ statementHandle: '019c06a4-0000-df4f-0000-00100006589e', partition: 0 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `statementHandle` | `string` | Yes | UUID-shaped handle (8-4-4-4-12 hex). |
| `requestId` | `string` | No | UUID-shaped request ID (8-4-4-4-12 hex). |
| `partition` | `number` | No | Partition index, starting at 0. |
| `retry` | `boolean` | No | Requires `requestId`. `true` resubmits the same request without running it twice. |

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `code` | `string` | No | — |
| `sqlState` | `string` | No | — |
| `message` | `string` | No | — |
| `statementHandle` | `string` | Yes | — |
| `statementHandles` | `string[]` | No | — |
| `createdOn` | `number` | No | — |
| `statementStatusUrl` | `string` | No | — |
| `resultSetMetaData` | `object` | No | — |
| `data` | `(string \| null)[][]` | No | Rows. Each cell is a string or null. |
| `stats` | `object` | No | — |

> [accordion] resultSetMetaData full type
>
> ```ts theme={null}
> {
>   format?: string,
>   numRows?: number,
>   rowType?: {
>     name?: string,
>     type?: string,
>     length?: number | null,
>     precision?: number | null,
>     scale?: number | null,
>     nullable?: boolean
>   }[],
>   partitionInfo?: {
>     rowCount?: number,
>     uncompressedSize?: number,
>     compressedSize?: number
>   }[]
> }
> ```

> [accordion] stats full type
>
> ```ts theme={null}
> {
>   numRowsInserted?: number,
>   numRowsUpdated?: number,
>   numRowsDeleted?: number,
>   numDuplicateRowsUpdated?: number
> }
> ```

***

### submit

`statements.submit`

Submit SQL for execution. Returns rows, a handle while the statement is still running, or DML stats.

**Risk:** `write`

```ts theme={null}
await corsair.snowflake.api.statements.submit({ statement: 'SELECT 1', timeout: 10, warehouse: 'COMPUTE_WH' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `requestId` | `string` | No | UUID-shaped request ID (8-4-4-4-12 hex). |
| `async` | `boolean` | No | Return the handle immediately when true. |
| `nullable` | `boolean` | No | `false` returns SQL NULL as the string `"null"`. |
| `retry` | `boolean` | No | Requires `requestId`. `true` resubmits the same request without running it twice. |
| `statement` | `string` | Yes | — |
| `timeout` | `number` | No | — |
| `database` | `string` | No | — |
| `schema` | `string` | No | — |
| `warehouse` | `string` | No | — |
| `role` | `string` | No | — |
| `bindings` | `object` | No | — |
| `parameters` | `object` | No | — |

> [accordion] bindings full type
>
> ```ts theme={null}
> {
>   [key: string]: { type: string, value: string }
> }
> ```

> [accordion] parameters full type
>
> ```ts theme={null}
> {
>   timezone?: string,
>   query_tag?: string,
>   binary_output_format?: string,
>   date_output_format?: string,
>   time_output_format?: string,
>   timestamp_output_format?: string,
>   timestamp_ltz_output_format?: string,
>   timestamp_ntz_output_format?: string,
>   timestamp_tz_output_format?: string,
>   multi_statement_count?: number | string,
>   client_result_chunk_size?: number, // 16 to 160, megabytes
>   rows_per_resultset?: number,
>   use_cached_result?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `code` | `string` | No | — |
| `sqlState` | `string` | No | — |
| `message` | `string` | No | — |
| `statementHandle` | `string` | Yes | — |
| `statementHandles` | `string[]` | No | — |
| `createdOn` | `number` | No | — |
| `statementStatusUrl` | `string` | No | — |
| `resultSetMetaData` | `object` | No | — |
| `data` | `(string \| null)[][]` | No | Rows. Each cell is a string or null. |
| `stats` | `object` | No | — |

> [accordion] resultSetMetaData full type
>
> ```ts theme={null}
> {
>   format?: string,
>   numRows?: number,
>   rowType?: {
>     name?: string,
>     type?: string,
>     length?: number | null,
>     precision?: number | null,
>     scale?: number | null,
>     nullable?: boolean
>   }[],
>   partitionInfo?: {
>     rowCount?: number,
>     uncompressedSize?: number,
>     compressedSize?: number
>   }[]
> }
> ```

> [accordion] stats full type
>
> ```ts theme={null}
> {
>   numRowsInserted?: number,
>   numRowsUpdated?: number,
>   numRowsDeleted?: number,
>   numDuplicateRowsUpdated?: number
> }
> ```

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.