---
title: "POST /knowledgeBases/{knowledgeBaseId}/search/messageTemplates"
method: POST
path: "/knowledgeBases/{knowledgeBaseId}/search/messageTemplates"
---

# POST /knowledgeBases/{knowledgeBaseId}/search/messageTemplates

`POST /knowledgeBases/{knowledgeBaseId}/search/messageTemplates`

Searches for Amazon Q in Connect message templates in the specified knowledge base.

## Path parameters

- `knowledgeBaseId` string, required

## Query parameters

- `nextToken` string
- `maxResults` integer

## Request body

- object
  - `searchExpression` object, required — The search expression of the message template.
    - `queries` MessageTemplateQueryField[] — The message template query expressions.
      - `name` string, required — The name of the attribute to query the message templates by.
      - `values` MessageTemplateQueryValue[], required — The values of the attribute to query the message templates by.
      - `operator` 'CONTAINS' | 'CONTAINS_AND_PREFIX', required — The operator to use for matching attribute field values in the query.
      - `allowFuzziness` boolean — Whether the query expects only exact matches on the attribute field values. The results of the query will only include exact matches if this parameter is set to false.
      - `priority` 'HIGH' | 'MEDIUM' | 'LOW' — The importance of the attribute field when calculating query result relevancy scores. The value set for this parameter affects the ordering of search results.
    - `filters` MessageTemplateFilterField[] — The configuration of filtering rules applied to message template query results.
      - `name` string, required — The name of the attribute field to filter the message templates by.
      - `values` MessageTemplateFilterValue[] — The values of attribute field to filter the message template by.
      - `operator` 'EQUALS' | 'PREFIX', required — The operator to use for filtering.
      - `includeNoExistence` boolean — Whether to treat null value as a match for the attribute field.
    - `orderOnField` object — The message template attribute fields on which the query results are ordered.
      - `name` string, required — The name of the message template.
      - `order` 'ASC' | 'DESC' — The order at which the message templates are sorted by.

## Response `200`

Success

- SearchMessageTemplatesResponse
  - `results` MessageTemplateSearchResultData[], required — The results of the message template search.
    - `messageTemplateArn` string, required — The Amazon Resource Name (ARN) of the message template.
    - `messageTemplateId` string, required — The identifier of the message template.
    - `knowledgeBaseArn` string, required — The Amazon Resource Name (ARN) of the knowledge base.
    - `knowledgeBaseId` string, required — The identifier of the knowledge base.
    - `name` string, required — The name of the message template.
    - `channel` string, password — The channel of the message template.
    - `channelSubtype` 'EMAIL' | 'SMS' | 'WHATSAPP' | 'PUSH', required — The channel subtype this message template applies to.
    - `createdTime` string, date-time, required — The timestamp when the message template was created.
    - `lastModifiedTime` string, date-time, required — The timestamp when the message template data was last modified.
    - `lastModifiedBy` string, required — The Amazon Resource Name (ARN) of the user who last updated the message template data.
    - `isActive` boolean — Whether the version of the message template is activated.
    - `versionNumber` integer — The version number of the message template version.
    - `description` string — The description of the message template.
    - `sourceConfigurationSummary` object — The source configuration summary of the message template.
      - `whatsApp` object — The sourceConfiguration summary of the message template that applies to the WHATSAPP channel subtype.
        - `businessAccountId` string, required — The ID of the End User Messaging WhatsApp Business Account to associate with this template.
        - `templateId` string, required — The ID of WhatsApp template.
        - `name` string — The name of the WhatsApp template.
        - `language` string — The language of the WhatsApp template.
        - `components` WhatsAppMessageTemplateComponent[] — The list of component mapping from WhatsApp template parameters to Message Template attributes.
        - `status` 'VALID' | 'INVALID' | 'REJECTED' — The status of the message template.
        - `statusReason` string, password — The status reason of the message template.
    - `groupingConfiguration` GroupingConfiguration — The configuration information of the grouping of Amazon Q in Connect users.
      - `criteria` string, password — <p>The criteria used for grouping Amazon Q in Connect users.</p> <p>The following is the list of supported criteria values.</p> <ul> <li> <p> <code>RoutingProfileArn</code>: Grouping the users by their <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_RoutingProfile.html">Amazon Connect routing profile ARN</a>. User should have <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_SearchRoutingProfiles.html">SearchRoutingProfile</a> and <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_DescribeRoutingProfile.html">DescribeRoutingProfile</a> permissions when setting criteria to this value.</p> </li> </ul>
      - `values` GroupingValue[] — <p>The list of values that define different groups of Amazon Q in Connect users.</p> <ul> <li> <p>When setting <code>criteria</code> to <code>RoutingProfileArn</code>, you need to provide a list of ARNs of <a href="https://docs.aws.amazon.com/connect/latest/APIReference/API_RoutingProfile.html">Amazon Connect routing profiles</a> as values of this parameter.</p> </li> </ul>
    - `language` string — The language code value for the language in which the quick response is written. The supported language codes include <code>de_DE</code>, <code>en_US</code>, <code>es_ES</code>, <code>fr_FR</code>, <code>id_ID</code>, <code>it_IT</code>, <code>ja_JP</code>, <code>ko_KR</code>, <code>pt_BR</code>, <code>zh_CN</code>, <code>zh_TW</code>
    - `tags` object — The tags used to organize, track, or control access for this resource.
  - `nextToken` string — If there are additional results, this is the token for the next set of results.

## Other responses

- `480` — ValidationException
- `481` — UnauthorizedException
- `482` — AccessDeniedException
- `483` — ResourceNotFoundException
- `484` — ThrottlingException

---

[API](https://skmtc.net/aws/apis/qconnect.md) · [All operations](https://skmtc.net/aws/apis/qconnect/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/qconnect/versions/833f5de92023/schema)
