

# Creating adapters


Before you can train an adapter, you must create an adapter. To do so, use the [CreateAdapter](API_CreateAdapter.md) operation. After you create an adapter, get information about it with the [GetAdapter](API_GetAdapter.md) operation. Configuration elements of adapters can be updated with the [UpdateAdapter](API_UpdateAdapter.md) operation. Get a list of adapters with the [ListAdapters](API_ListAdapters.md) operation. Delete an adapter you no longer need with the [DeleteAdapter](API_DeleteAdapter.md) operation.

# Create an Adapter


To customize the Amazon Textract base model, create an adapter. To do so, use the [CreateAdapter](API_CreateAdapter.md) operation. When calling `CreateAdapter,` you provide an AdapterName and FeatureType as an input. Currently Queries is the only feature type supported. 

When creating an adapter you can also provide a Description, Tags, and a ClientRequestToken. Finally, you can choose whether the adapter should be auto-updated with the AutoUpdate argument. After creating an adapter, you can start training it on your own sample documents by using the [CreateAdapterVersion](API_CreateAdapterVersion.md) operation. 

To create an adapter with the Amazon Textract console:
+ Sign in to the Amazon Textract console.
+ Select **Custom Queries** from the left navigation panel.
+ Select **Create adapter**.

To create an adapter with the AWS CLI or AWS SDK:
+ If you haven't already done so, install and configure the AWS CLI and the AWS SDKs. For more information, see [Step 2: Set Up the AWS CLI and AWS SDKs](setup-awscli-sdk.md).
+ Use the following code to create an adapter: 

------
#### [ CLI ]

```
aws textract create-adapter \
--adapter-name "test-w2" \
--feature-types '["QUERIES"]' \
--description 'demo'
```

------

# Get adapter


You can retrieve configuration information for an adapter at any time by calling the [GetAdapter](API_GetAdapter.md) operation and specifying an AdapterId. GetAdapter returns information on AdapterName, Description, CreationTime, AutoUpdate status, and FeatureTypes.

To see details for your adapter with the console:
+ Sign into the AWS console for Amazon Textract.
+ Select **Custom Queries** from the navigation panel on the left.
+ From the list of **Your adapters**, select the adapter you want to view the details for.
+ Review the details for the adapter on your Adapter details page.

To see details for your adapter with the CLI/SDK:
+ If you haven't already done so, install and configure the AWS CLI and the AWS SDKs. For more information, see [Step 2: Set Up the AWS CLI and AWS SDKs](setup-awscli-sdk.md).
+ Use the following code to create an adapter: 

------
#### [ CLI ]

```
aws textract get-adapter \
--adapter-id "abcdef123456"
```

------

# List adapters


You can list all of the adapters associated with your account by using the [ListAdapters](API_ListAdapters.md) operation. You can filter the list of returned adapters by the date and time of creation by using the AfterCreationTime and BeforeCreationTime arguments. You can also set a number of maximum results to return using MaxResults.

To see a list of your adapters with the console:
+ Sign into the AWS console for Amazon Textract.
+ Select **Custom Queries** from the navigation panel on the left.
+ View your adapters in the list of your adapters.

To create an adapter with the CLI/SDK:
+ If you haven't already done so, install and configure the AWS CLI and the AWS SDKs. For more information, see [Step 2: Set Up the AWS CLI and AWS SDKs](setup-awscli-sdk.md).
+ Use the following code to create an adapter: 

------
#### [ CLI ]

```
aws textract list-adapters 
```

------

# Update adapter


With Amazon Textract, you can update some configuration options of an adapter. Simultaneously, you can update any adapter versions associated with the adapter. To do this, call the [UpdateAdapter](API_UpdateAdapter.md) operation and provide the operation with the AdapterId and configuration elements that you want to update. The AdapterName and FeatureTypes elements cannot be updated. 

To update an adapter with the AWS CLI or AWS SDK:
+ If you haven't already done so, install and configure the AWS CLI and the AWS SDKs. For more information, see [Step 2: Set Up the AWS CLI and AWS SDKs](setup-awscli-sdk.md).
+ Use the following code to create an adapter: 

------
#### [ CLI ]

```
aws textract update-adapter \
--adapter-id 'abcdef123456' \  
--description 'demo new'
```

------

# Delete an Adapter


You can delete a custom Amazon Textract adapter at any time by calling the [DeleteAdapter](API_DeleteAdapter.md) API operation. You can delete an adapter by providing the DeleteAdapter operation with the AdapterId of the adapter that you want to delete. Invoke DeleteAdapter will delete all Adapter Versions associated with the Adapter ARN.

To delete an adapter with the console:
+ Sign in to the Amazon Textract console.
+ Select **Custom Queries** from the left navigation panel.
+ From the list of your adapters, select the adapter to delete.
+ Select **Delete** and follow the instructions to delete your adapter.

To create an adapter with the AWS CLI or AWS SDK:
+ If you haven't already done so, install and configure the AWS CLI and the AWS SDKs. For more information, see [Step 2: Set Up the AWS CLI and AWS SDKs](setup-awscli-sdk.md).
+ Use the following code to create an adapter: 

------
#### [ CLI ]

```
aws textract delete-adapter \
--adapter-id 'abcdef123456'
```

------