

# CancelStatement
<a name="API_CancelStatement"></a>

Cancels a running query. To be canceled, a query must be running. 

For more information about the Amazon Redshift Data API and AWS CLI usage examples, see [Using the Amazon Redshift Data API](https://docs.aws.amazon.com/redshift/latest/mgmt/data-api.html) in the *Amazon Redshift Management Guide*. 

## Request Syntax
<a name="API_CancelStatement_RequestSyntax"></a>

```
{
   "Id": "string"
}
```

## Request Parameters
<a name="API_CancelStatement_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

**Note**  
In the following list, the required parameters are described first.

 ** [Id](#API_CancelStatement_RequestSyntax) **   <a name="redshiftdata-CancelStatement-request-Id"></a>
The identifier of the SQL statement to cancel. This value is a universally unique identifier (UUID) generated by Amazon Redshift Data API. This identifier is returned by `BatchExecuteStatment`, `ExecuteStatment`, and `ListStatements`.   
Type: String  
Pattern: `[a-z0-9]{8}(-[a-z0-9]{4}){3}-[a-z0-9]{12}(:\d+)?`   
Required: Yes

## Response Syntax
<a name="API_CancelStatement_ResponseSyntax"></a>

```
{
   "Status": boolean
}
```

## Response Elements
<a name="API_CancelStatement_ResponseElements"></a>

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

 ** [Status](#API_CancelStatement_ResponseSyntax) **   <a name="redshiftdata-CancelStatement-response-Status"></a>
A value that indicates whether the cancel statement succeeded (true).   
Type: Boolean

## Errors
<a name="API_CancelStatement_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** DatabaseConnectionException **   
Connection to a database failed.  
HTTP Status Code: 500

 ** InternalServerException **   
The Amazon Redshift Data API operation failed due to invalid input.     
 ** Message **   
The exception message.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The Amazon Redshift Data API operation failed due to a missing resource.     
 ** Message **   
The exception message.  
 ** ResourceId **   
Resource identifier associated with the exception.
HTTP Status Code: 400

 ** ValidationException **   
The Amazon Redshift Data API operation failed due to invalid input.     
 ** Message **   
The exception message.
HTTP Status Code: 400

## See Also
<a name="API_CancelStatement_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/redshift-data-2019-12-20/CancelStatement) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/redshift-data-2019-12-20/CancelStatement) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/redshift-data-2019-12-20/CancelStatement) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/redshift-data-2019-12-20/CancelStatement) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/redshift-data-2019-12-20/CancelStatement) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/redshift-data-2019-12-20/CancelStatement) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/redshift-data-2019-12-20/CancelStatement) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/redshift-data-2019-12-20/CancelStatement) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/redshift-data-2019-12-20/CancelStatement) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/redshift-data-2019-12-20/CancelStatement) 