SearchUsersCommand

Searches users in an Amazon Connect instance, with optional filtering.

AfterContactWorkTimeLimit is returned in milliseconds.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { ConnectClient, SearchUsersCommand } from "@aws-sdk/client-connect"; // ES Modules import
// const { ConnectClient, SearchUsersCommand } = require("@aws-sdk/client-connect"); // CommonJS import
const client = new ConnectClient(config);
const input = { // SearchUsersRequest
  InstanceId: "STRING_VALUE", // required
  NextToken: "STRING_VALUE",
  MaxResults: Number("int"),
  SearchFilter: { // UserSearchFilter
    TagFilter: { // ControlPlaneTagFilter
      OrConditions: [ // TagOrConditionList
        [ // TagAndConditionList
          { // TagCondition
            TagKey: "STRING_VALUE",
            TagValue: "STRING_VALUE",
          },
        ],
      ],
      AndConditions: [
        {
          TagKey: "STRING_VALUE",
          TagValue: "STRING_VALUE",
        },
      ],
      TagCondition: "<TagCondition>",
    },
    UserAttributeFilter: { // ControlPlaneUserAttributeFilter
      OrConditions: [ // AttributeOrConditionList
        { // AttributeAndCondition
          TagConditions: "<TagAndConditionList>",
          HierarchyGroupCondition: { // HierarchyGroupCondition
            Value: "STRING_VALUE",
            HierarchyGroupMatchType: "EXACT" || "WITH_CHILD_GROUPS",
          },
        },
      ],
      AndCondition: {
        TagConditions: "<TagAndConditionList>",
        HierarchyGroupCondition: {
          Value: "STRING_VALUE",
          HierarchyGroupMatchType: "EXACT" || "WITH_CHILD_GROUPS",
        },
      },
      TagCondition: "<TagCondition>",
      HierarchyGroupCondition: "<HierarchyGroupCondition>",
    },
  },
  SearchCriteria: { // UserSearchCriteria
    OrConditions: [ // UserSearchConditionList
      {
        OrConditions: [
          "<UserSearchCriteria>",
        ],
        AndConditions: [
          "<UserSearchCriteria>",
        ],
        StringCondition: { // StringCondition
          FieldName: "STRING_VALUE",
          Value: "STRING_VALUE",
          ComparisonType: "STARTS_WITH" || "CONTAINS" || "EXACT",
        },
        ListCondition: { // ListCondition
          TargetListType: "PROFICIENCIES",
          Conditions: [ // Conditions
            { // Condition
              StringCondition: {
                FieldName: "STRING_VALUE",
                Value: "STRING_VALUE",
                ComparisonType: "STARTS_WITH" || "CONTAINS" || "EXACT",
              },
              NumberCondition: { // NumberCondition
                FieldName: "STRING_VALUE",
                MinValue: Number("int"),
                MaxValue: Number("int"),
                ComparisonType: "GREATER_OR_EQUAL" || "GREATER" || "LESSER_OR_EQUAL" || "LESSER" || "EQUAL" || "NOT_EQUAL" || "RANGE",
              },
            },
          ],
        },
        HierarchyGroupCondition: "<HierarchyGroupCondition>",
      },
    ],
    AndConditions: [
      "<UserSearchCriteria>",
    ],
    StringCondition: "<StringCondition>",
    ListCondition: {
      TargetListType: "PROFICIENCIES",
      Conditions: [
        {
          StringCondition: "<StringCondition>",
          NumberCondition: {
            FieldName: "STRING_VALUE",
            MinValue: Number("int"),
            MaxValue: Number("int"),
            ComparisonType: "GREATER_OR_EQUAL" || "GREATER" || "LESSER_OR_EQUAL" || "LESSER" || "EQUAL" || "NOT_EQUAL" || "RANGE",
          },
        },
      ],
    },
    HierarchyGroupCondition: "<HierarchyGroupCondition>",
  },
};
const command = new SearchUsersCommand(input);
const response = await client.send(command);
// { // SearchUsersResponse
//   Users: [ // UserSearchSummaryList
//     { // UserSearchSummary
//       Arn: "STRING_VALUE",
//       DirectoryUserId: "STRING_VALUE",
//       HierarchyGroupId: "STRING_VALUE",
//       Id: "STRING_VALUE",
//       IdentityInfo: { // UserIdentityInfoLite
//         FirstName: "STRING_VALUE",
//         LastName: "STRING_VALUE",
//       },
//       PhoneConfig: { // UserPhoneConfig
//         PhoneType: "SOFT_PHONE" || "DESK_PHONE", // required
//         AutoAccept: true || false,
//         AfterContactWorkTimeLimit: Number("int"),
//         DeskPhoneNumber: "STRING_VALUE",
//       },
//       RoutingProfileId: "STRING_VALUE",
//       SecurityProfileIds: [ // SecurityProfileIds
//         "STRING_VALUE",
//       ],
//       Tags: { // TagMap
//         "<keys>": "STRING_VALUE",
//       },
//       Username: "STRING_VALUE",
//     },
//   ],
//   NextToken: "STRING_VALUE",
//   ApproximateTotalCount: Number("long"),
// };

SearchUsersCommand Input

See SearchUsersCommandInput for more details

Parameter
Type
Description
InstanceId
Required
string | undefined

The identifier of the Amazon Connect instance. You can find the instance ID  in the Amazon Resource Name (ARN) of the instance.

MaxResults
number | undefined

The maximum number of results to return per page.

NextToken
string | undefined

The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

SearchCriteria
UserSearchCriteria | undefined

The search criteria to be used to return users.

The name and description fields support "contains" queries with a minimum of 2 characters and a maximum of 25 characters. Any queries with character lengths outside of this range will throw invalid results.

SearchFilter
UserSearchFilter | undefined

Filters to be applied to search results.

SearchUsersCommand Output

See SearchUsersCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
ApproximateTotalCount
number | undefined

The total number of users who matched your search query.

NextToken
string | undefined

If there are additional results, this is the token for the next set of results.

Users
UserSearchSummary[] | undefined

Information about the users.

Throws

Name
Fault
Details
InternalServiceException
server

Request processing failed because of an error or failure with the service.

InvalidParameterException
client

One or more of the specified parameters are not valid.

InvalidRequestException
client

The request is not valid.

ResourceNotFoundException
client

The specified resource was not found.

ThrottlingException
client

The throttling limit has been exceeded.

ConnectServiceException
Base exception class for all service exceptions from Connect service.