---
title: "Cancels the execution of a statement."
method: POST
path: "/api/v2/statements/{statementHandle}/cancel"
tags: ["statements"]
---

# Cancels the execution of a statement.

`POST /api/v2/statements/{statementHandle}/cancel`

Cancels the execution of the statement with the specified statement handle.

## Response `200`

The execution of the statement was successfully canceled.

- CancelStatus
  - `code` string
  - `sqlState` string
  - `message` string
  - `statementHandle` string, uuid, required
  - `statementStatusUrl` string, uri

## Other responses

- `400` — Bad Request. The request payload is invalid or malformed. This happens if the application didn't send the correct request payload. The response body may include the error code and message indicating the actual cause. The application must reconstruct the request body for retry.
- `401` — Unauthorized. The request is not authorized. This happens if the attached access token is invalid or missing. The response body may include the error code and message indicating the actual cause, e.g., expired, invalid token. The application must obtain a new access token for retry.
- `403` — Forbidden. The request is forbidden. This happens if the request is made even if the API is not enabled.
- `404` — Not Found. The request endpoint is not valid. This happens if the API endpoint is wrong. For example, if the application hits /api/api/hello which doesn't exist, it will receive this code.
- `405` — Method Not Allowed. The request method doesn't match the supported API. This happens, for example, if the application calls the API with GET method but the endpoint accepts only POST. The application must change a method for retry.
- `422` — An error occurred when cancelling the execution of the statement. Check the error code and error message for details.
- `500` — Internal Server Error. The server hits an unrecoverable system error. The response body may include the error code and message for further guidance. The application owner may need to reach out the customer support.
- `503` — Service Unavailable. The request was not processed due to server side timeouts. The application may retry with backoff. The jittered backoff is recommended. https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
- `504` — Gateway Timeout. The request was not processed due to server side timeouts. The application may retry with backoff. The jittered backoff is recommended. https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/

## Changes

- **2026-01-14** `095e8cdd2a84` — 4 info
  - the endpoint scheme security `KeyPair` was added to the API
  - the endpoint scheme security `SnowflakeOAuth` was added to the API
  - the endpoint scheme security `keyPair` was removed from the API
  - the endpoint scheme security `snowflakeOAuth` was removed from the API

[Change history](https://skmtc.dev/snowflakedb/apis/snowflake-sql-api/changes/api/v2/statements/:statementHandle/cancel/post.md)

---

[API](https://skmtc.dev/snowflakedb/apis/snowflake-sql-api.md) · [All operations](https://skmtc.dev/snowflakedb/apis/snowflake-sql-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/snowflakedb/snowflake-sql-api/revisions/28b780dd0569/schema)
