Queries with AWS | MuleSoft Documentation
# Queries with AWS
The Queries with AWS action step enables you to extract specific data from a document by specifying queries in natural language so that the response contains the data you need, without having to apply further filtering on the JSON output to get the relevant values.
For example, if you are processing a credit card statement, you can specify queries such as:
  * "What is the customer name?"
  * "What is the credit card company name?"
  * "What is the account number?"
  * "What is the payment due date?"


This action step processes the document in a synchronous fashion (Amazon does not store the document) and automatically converts PDF files to PNG images. You can adjust the fidelity of the conversion in the properties grid.
## Inbound Variables
  * **Alias text**
  * **Query text**
  * **Directory Path**
  * **File Name**
  * **Password**
  * **Read text from page**
  * **Read text to page**
  * **AWS Credentials**
Or, if **Use custom settings** is selected in the wizard:
    * **Client Id**
    * **Client Secret**
    * **Session Token**
    * **Use Session Token**
    * **Region Endpoint**
  * **Json Path**


## Outbound Variables
  * **Raw Json**
The complete AWS response
  * **Normalized Json**
The parsed result based on the normalized result and defined Json path
  * **First answer**
A string containing the first result based on the specified query
  * **All answers**
An array containing all results received as a response to the specified query
  * **Answers count**
The number of matching answers to the specified query
  * **Confidence first answer**
The confidence value of the first result as a floating point number.


## Wizard
  * **Authentication Settings**
The AWS credentials to use for authentication
    * **Pin credentials**
Use this option to reference an existing **Credentials for AWS** configuration.
    * **Use custom settings**
Use this option to manually specify an AWS **Cliend ID** , **Client Secret** , **Region Endpoint** , and **Session Token** for this action step.
  * **Response settings**
    * **JsonPath Expression**
The Json path to the property of the response object
  * **File Settings**
    * **Directory path**
The path to the directory where the file is located
    * **File name**
The name of the file to analyze. Supported file types: PDF, JPEG, and PNG
  * **PDF Settings**
These settings show when the selected file is a PDF.
    * **Automatically detect the best quality for conversion**
Disable this option to manually adjust the image quality.
    * **Image Quality**
Specifies the quality of the image created from the PDF. The value ranges from `10` (lowest quality) to `100` (highest quality).
This property is not available in the Wizard.
    * **PDF file is password protected**
Specifies if the selected PDF file is password protected. When selected, specify the password to open the file in the **Password to open PDF file** filed.
    * **Read entire file**
Instructs the service to read the entire file.
    * **Read page range**
Instructs the service to read the selected range of pages.
      * **From page**
Specify from which page the service starts reading the file.
      * **To page**
Specifies until which page the service reads the file.
      * **Read to end of file**
Instructs the service to continue reading until the end of the file.
  * **Query Settings**
    * **Query text**
Specifies the query to extract the data from the document
The maximum length for this field is 200 characters.
    * **Alias text**
Specifies an alias for the query, for ease of location
The maximum length allowed for this field is 200 characters.
    * **The query results in…​ otherwise the action step results is…​**
Specifies the behavior of the action step based on the result
The first dropdown menu enables you to select the expected result of the query: **a single answer** , **one or more results** , or **multiple results**. If this selection matches the query result, the action step finishes successfully. When the expected result does not match the actual result from the query, the action step results either in **a warning** or **an error** , depending on the value configured in the second dropdown menu.
  * **Analyze Query**
Enables you to test the configured query and see the results in the Wizard


## See Also
  *   * Amazon Textract: Best Practices for Queries
  * Building JSONPath Expressions