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

# Redshift Data List Statements

List the SQL statements that were run through the Redshift Data API, newest first, with each statement's `Id`, status and query text.

Use it to find the `Id` of an earlier statement, to check what a workflow ran, or to poll for statements that have finished.

Results are paginated. When the response contains a `NextToken`, run the action again with that value in `Next Token` to fetch the next page.

<Note>
  External Documentation

  To learn more, visit the [AWS documentation](https://docs.aws.amazon.com/redshift-data/latest/APIReference/API_ListStatements.html).
</Note>

## Basic Parameters

<div className="integrations-table">
  | Parameter                           | Description                                                                                                                                                                            |
  | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | AWS Region                          | The AWS Region of the Redshift cluster or Serverless workgroup.                                                                                                                        |
  | Cluster Identifier                  | The provisioned cluster to list statements for.<br /><br />Cannot be combined with `Workgroup Name`.                                                                                   |
  | Database                            | The database to list statements for.<br /><br />Can be obtained using the `Redshift Data List Databases` action.                                                                       |
  | Include All Statements For The Role | Select to list every statement run by the caller's IAM role. When cleared, only the statements run by that role in the current IAM session are listed.<br /><br />Selected by default. |
  | Max Results                         | The maximum number of statements to return in a single response.<br /><br />Valid values range from `0` to `100`.                                                                      |
  | Next Token                          | The pagination token for fetching the next page of records, taken from the `NextToken` field of a previous response.<br /><br />Leave empty to fetch the first page.                   |
  | Statement Name                      | The statement name prefix to match.<br /><br />The match is case-sensitive, so a value of `myStatement` returns `myStatement1`, `myStatement2` and so on.                              |
  | Status                              | Select the state that a statement must be in to appear in the results.                                                                                                                 |
  | Workgroup Name                      | The Redshift Serverless workgroup to list statements for.<br /><br />Cannot be combined with `Cluster Identifier`.                                                                     |
</div>

## Advanced Parameters

<div className="integrations-table">
  | Parameter                        | Description                                                                   |
  | -------------------------------- | ----------------------------------------------------------------------------- |
  | Disable XML To JSON Auto Convert | When checked, XML responses are not automatically converted into JSON format. |
</div>

## Example Output

```json theme={"dark"}
{
	"NextToken": "",
	"Statements": [
		{
			"CreatedAt": 1598323175.823,
			"Id": "d9b6c0c9-0747-4bf4-b142-e8883122f766",
			"IsBatchStatement": false,
			"QueryString": "select * from users limit 10",
			"ResultFormat": "CSV",
			"SecretArn": "arn:aws:secretsmanager:us-east-1:123456789012:secret:redshift-1",
			"SessionId": "1e2f3a4b-5c6d-7e8f-9a0b-1c2d3e4f5a6b",
			"StatementName": "list-users",
			"Status": "FINISHED",
			"UpdatedAt": 1598323179.774
		}
	]
}
```

## Workflow Library Example

[Redshift Data List Statements with Aws and Send Results Via Email](https://library.blinkops.com/workflows/redshift-data-list-statements-with-aws-and-send-results-via-email)

<div className="iframe-wrapper">
  <div className="iframe-media">
    <img src="https://mintcdn.com/blinkops-2/ojHYuDeYX5FWuN8a/img/Icons/play-box.svg?fit=max&auto=format&n=ojHYuDeYX5FWuN8a&q=85&s=b8af968e71438a9499c3223c9bd29fb2" alt="Workflow Library" width="16" height="16" data-path="img/Icons/play-box.svg" />

    Preview this Workflow on desktop
  </div>

  <iframe className="iframe" src="https://library.blinkops.com/workflows/redshift-data-list-statements-with-aws-and-send-results-via-email/canvas" />
</div>
