:doc:`CustomerProfiles <../../customer-profiles>` / Client / search_profiles

***************
search_profiles
***************



.. py:method:: CustomerProfiles.Client.search_profiles(**kwargs)

  

  Searches for profiles within a specific domain using one or more predefined search keys (e.g., _fullName, _phone, _email, _account, etc.) and/or custom-defined search keys. A search key is a data type pair that consists of a ``KeyName`` and ``Values`` list.

   

  This operation supports searching for profiles with a minimum of 1 key-value(s) pair and up to 5 key-value(s) pairs using either ``AND`` or ``OR`` logic.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/customer-profiles-2020-08-15/SearchProfiles>`_  


  **Request Syntax**
  ::

    response = client.search_profiles(
        NextToken='string',
        MaxResults=123,
        DomainName='string',
        KeyName='string',
        Values=[
            'string',
        ],
        AdditionalSearchKeys=[
            {
                'KeyName': 'string',
                'Values': [
                    'string',
                ]
            },
        ],
        LogicalOperator='AND'|'OR'
    )
    
  :type NextToken: string
  :param NextToken: 

    The pagination token from the previous SearchProfiles API call.

    

  
  :type MaxResults: integer
  :param MaxResults: 

    The maximum number of objects returned per page.

     

    The default is 20 if this parameter is not included in the request.

    

  
  :type DomainName: string
  :param DomainName: **[REQUIRED]** 

    The unique name of the domain.

    

  
  :type KeyName: string
  :param KeyName: **[REQUIRED]** 

    A searchable identifier of a customer profile. The predefined keys you can use to search include: _account, _profileId, _assetId, _caseId, _orderId, _fullName, _phone, _email, _ctrContactId, _marketoLeadId, _salesforceAccountId, _salesforceContactId, _salesforceAssetId, _zendeskUserId, _zendeskExternalId, _zendeskTicketId, _serviceNowSystemId, _serviceNowIncidentId, _segmentUserId, _shopifyCustomerId, _shopifyOrderId.

    

  
  :type Values: list
  :param Values: **[REQUIRED]** 

    A list of key values.

    

  
    - *(string) --* 

    

  :type AdditionalSearchKeys: list
  :param AdditionalSearchKeys: 

    A list of ``AdditionalSearchKey`` objects that are each searchable identifiers of a profile. Each ``AdditionalSearchKey`` object contains a ``KeyName`` and a list of ``Values`` associated with that specific key (i.e., a key-value(s) pair). These additional search keys will be used in conjunction with the ``LogicalOperator`` and the required ``KeyName`` and ``Values`` parameters to search for profiles that satisfy the search criteria.

    

  
    - *(dict) --* 

      A data type pair that consists of a ``KeyName`` and ``Values`` list that is used in conjunction with the `KeyName <https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html#customerprofiles-SearchProfiles-request-KeyName>`__ and `Values <https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html#customerprofiles-SearchProfiles-request-Values>`__ parameters to search for profiles using the `SearchProfiles <https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html>`__ API.

      

    
      - **KeyName** *(string) --* **[REQUIRED]** 

        A searchable identifier of a customer profile.

        

      
      - **Values** *(list) --* **[REQUIRED]** 

        A list of key values.

        

      
        - *(string) --* 

        
    
    

  :type LogicalOperator: string
  :param LogicalOperator: 

    Relationship between all specified search keys that will be used to search for profiles. This includes the required ``KeyName`` and ``Values`` parameters as well as any key-value(s) pairs specified in the ``AdditionalSearchKeys`` list.

     

    This parameter influences which profiles will be returned in the response in the following manner:

     

    
    * ``AND`` - The response only includes profiles that match all of the search keys.
     
    * ``OR`` - The response includes profiles that match at least one of the search keys.
    

     

    The ``OR`` relationship is the default behavior if this parameter is not included in the request.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'Items': [
              {
                  'ProfileId': 'string',
                  'AccountNumber': 'string',
                  'AdditionalInformation': 'string',
                  'PartyType': 'INDIVIDUAL'|'BUSINESS'|'OTHER',
                  'BusinessName': 'string',
                  'FirstName': 'string',
                  'MiddleName': 'string',
                  'LastName': 'string',
                  'BirthDate': 'string',
                  'Gender': 'MALE'|'FEMALE'|'UNSPECIFIED',
                  'PhoneNumber': 'string',
                  'MobilePhoneNumber': 'string',
                  'HomePhoneNumber': 'string',
                  'BusinessPhoneNumber': 'string',
                  'EmailAddress': 'string',
                  'PersonalEmailAddress': 'string',
                  'BusinessEmailAddress': 'string',
                  'Address': {
                      'Address1': 'string',
                      'Address2': 'string',
                      'Address3': 'string',
                      'Address4': 'string',
                      'City': 'string',
                      'County': 'string',
                      'State': 'string',
                      'Province': 'string',
                      'Country': 'string',
                      'PostalCode': 'string'
                  },
                  'ShippingAddress': {
                      'Address1': 'string',
                      'Address2': 'string',
                      'Address3': 'string',
                      'Address4': 'string',
                      'City': 'string',
                      'County': 'string',
                      'State': 'string',
                      'Province': 'string',
                      'Country': 'string',
                      'PostalCode': 'string'
                  },
                  'MailingAddress': {
                      'Address1': 'string',
                      'Address2': 'string',
                      'Address3': 'string',
                      'Address4': 'string',
                      'City': 'string',
                      'County': 'string',
                      'State': 'string',
                      'Province': 'string',
                      'Country': 'string',
                      'PostalCode': 'string'
                  },
                  'BillingAddress': {
                      'Address1': 'string',
                      'Address2': 'string',
                      'Address3': 'string',
                      'Address4': 'string',
                      'City': 'string',
                      'County': 'string',
                      'State': 'string',
                      'Province': 'string',
                      'Country': 'string',
                      'PostalCode': 'string'
                  },
                  'Attributes': {
                      'string': 'string'
                  },
                  'FoundByItems': [
                      {
                          'KeyName': 'string',
                          'Values': [
                              'string',
                          ]
                      },
                  ],
                  'PartyTypeString': 'string',
                  'GenderString': 'string',
                  'ProfileType': 'ACCOUNT_PROFILE'|'PROFILE',
                  'EngagementPreferences': {
                      'Phone': [
                          {
                              'KeyName': 'string',
                              'KeyValue': 'string',
                              'ProfileId': 'string',
                              'ContactType': 'PhoneNumber'|'MobilePhoneNumber'|'HomePhoneNumber'|'BusinessPhoneNumber'|'EmailAddress'|'PersonalEmailAddress'|'BusinessEmailAddress'
                          },
                      ],
                      'Email': [
                          {
                              'KeyName': 'string',
                              'KeyValue': 'string',
                              'ProfileId': 'string',
                              'ContactType': 'PhoneNumber'|'MobilePhoneNumber'|'HomePhoneNumber'|'BusinessPhoneNumber'|'EmailAddress'|'PersonalEmailAddress'|'BusinessEmailAddress'
                          },
                      ]
                  }
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Items** *(list) --* 

        The list of Profiles matching the search criteria.

        
        

        - *(dict) --* 

          The standard profile of a customer.

          
          

          - **ProfileId** *(string) --* 

            The unique identifier of a customer profile.

            
          

          - **AccountNumber** *(string) --* 

            An account number that you have assigned to the customer.

            
          

          - **AdditionalInformation** *(string) --* 

            Any additional information relevant to the customer’s profile.

            
          

          - **PartyType** *(string) --* 

            The type of profile used to describe the customer.

            
          

          - **BusinessName** *(string) --* 

            The name of the customer’s business.

            
          

          - **FirstName** *(string) --* 

            The customer’s first name.

            
          

          - **MiddleName** *(string) --* 

            The customer’s middle name.

            
          

          - **LastName** *(string) --* 

            The customer’s last name.

            
          

          - **BirthDate** *(string) --* 

            The customer’s birth date.

            
          

          - **Gender** *(string) --* 

            The gender with which the customer identifies.

            
          

          - **PhoneNumber** *(string) --* 

            The customer's phone number, which has not been specified as a mobile, home, or business number.

            
          

          - **MobilePhoneNumber** *(string) --* 

            The customer’s mobile phone number.

            
          

          - **HomePhoneNumber** *(string) --* 

            The customer’s home phone number.

            
          

          - **BusinessPhoneNumber** *(string) --* 

            The customer’s home phone number.

            
          

          - **EmailAddress** *(string) --* 

            The customer’s email address, which has not been specified as a personal or business address.

            
          

          - **PersonalEmailAddress** *(string) --* 

            The customer’s personal email address.

            
          

          - **BusinessEmailAddress** *(string) --* 

            The customer’s business email address.

            
          

          - **Address** *(dict) --* 

            A generic address associated with the customer that is not mailing, shipping, or billing.

            
            

            - **Address1** *(string) --* 

              The first line of a customer address.

              
            

            - **Address2** *(string) --* 

              The second line of a customer address.

              
            

            - **Address3** *(string) --* 

              The third line of a customer address.

              
            

            - **Address4** *(string) --* 

              The fourth line of a customer address.

              
            

            - **City** *(string) --* 

              The city in which a customer lives.

              
            

            - **County** *(string) --* 

              The county in which a customer lives.

              
            

            - **State** *(string) --* 

              The state in which a customer lives.

              
            

            - **Province** *(string) --* 

              The province in which a customer lives.

              
            

            - **Country** *(string) --* 

              The country in which a customer lives.

              
            

            - **PostalCode** *(string) --* 

              The postal code of a customer address.

              
        
          

          - **ShippingAddress** *(dict) --* 

            The customer’s shipping address.

            
            

            - **Address1** *(string) --* 

              The first line of a customer address.

              
            

            - **Address2** *(string) --* 

              The second line of a customer address.

              
            

            - **Address3** *(string) --* 

              The third line of a customer address.

              
            

            - **Address4** *(string) --* 

              The fourth line of a customer address.

              
            

            - **City** *(string) --* 

              The city in which a customer lives.

              
            

            - **County** *(string) --* 

              The county in which a customer lives.

              
            

            - **State** *(string) --* 

              The state in which a customer lives.

              
            

            - **Province** *(string) --* 

              The province in which a customer lives.

              
            

            - **Country** *(string) --* 

              The country in which a customer lives.

              
            

            - **PostalCode** *(string) --* 

              The postal code of a customer address.

              
        
          

          - **MailingAddress** *(dict) --* 

            The customer’s mailing address.

            
            

            - **Address1** *(string) --* 

              The first line of a customer address.

              
            

            - **Address2** *(string) --* 

              The second line of a customer address.

              
            

            - **Address3** *(string) --* 

              The third line of a customer address.

              
            

            - **Address4** *(string) --* 

              The fourth line of a customer address.

              
            

            - **City** *(string) --* 

              The city in which a customer lives.

              
            

            - **County** *(string) --* 

              The county in which a customer lives.

              
            

            - **State** *(string) --* 

              The state in which a customer lives.

              
            

            - **Province** *(string) --* 

              The province in which a customer lives.

              
            

            - **Country** *(string) --* 

              The country in which a customer lives.

              
            

            - **PostalCode** *(string) --* 

              The postal code of a customer address.

              
        
          

          - **BillingAddress** *(dict) --* 

            The customer’s billing address.

            
            

            - **Address1** *(string) --* 

              The first line of a customer address.

              
            

            - **Address2** *(string) --* 

              The second line of a customer address.

              
            

            - **Address3** *(string) --* 

              The third line of a customer address.

              
            

            - **Address4** *(string) --* 

              The fourth line of a customer address.

              
            

            - **City** *(string) --* 

              The city in which a customer lives.

              
            

            - **County** *(string) --* 

              The county in which a customer lives.

              
            

            - **State** *(string) --* 

              The state in which a customer lives.

              
            

            - **Province** *(string) --* 

              The province in which a customer lives.

              
            

            - **Country** *(string) --* 

              The country in which a customer lives.

              
            

            - **PostalCode** *(string) --* 

              The postal code of a customer address.

              
        
          

          - **Attributes** *(dict) --* 

            A key value pair of attributes of a customer profile.

            
            

            - *(string) --* 
              

              - *(string) --* 
        
      
          

          - **FoundByItems** *(list) --* 

            A list of items used to find a profile returned in a `SearchProfiles <https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html>`__ response. An item is a key-value(s) pair that matches an attribute in the profile.

             

            If the optional ``AdditionalSearchKeys`` parameter was included in the `SearchProfiles <https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html>`__ request, the ``FoundByItems`` list should be interpreted based on the ``LogicalOperator`` used in the request:

             

            
            * ``AND`` - The profile included in the response matched all of the search keys specified in the request. The ``FoundByItems`` will include all of the key-value(s) pairs that were specified in the request (as this is a requirement of ``AND`` search logic).
             
            * ``OR`` - The profile included in the response matched at least one of the search keys specified in the request. The ``FoundByItems`` will include each of the key-value(s) pairs that the profile was found by.
            

             

            The ``OR`` relationship is the default behavior if the ``LogicalOperator`` parameter is not included in the `SearchProfiles <https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html>`__ request.

            
            

            - *(dict) --* 

              A data type pair that consists of a ``KeyName`` and ``Values`` list that were used to find a profile returned in response to a `SearchProfiles <https://docs.aws.amazon.com/customerprofiles/latest/APIReference/API_SearchProfiles.html>`__ request.

              
              

              - **KeyName** *(string) --* 

                A searchable identifier of a customer profile.

                
              

              - **Values** *(list) --* 

                A list of key values.

                
                

                - *(string) --* 
            
          
        
          

          - **PartyTypeString** *(string) --* 

            An alternative to PartyType which accepts any string as input.

            
          

          - **GenderString** *(string) --* 

            An alternative to Gender which accepts any string as input.

            
          

          - **ProfileType** *(string) --* 

            The type of the profile.

            
          

          - **EngagementPreferences** *(dict) --* 

            The customer or account’s engagement preferences.

            
            

            - **Phone** *(list) --* 

              A list of phone-related contact preferences

              
              

              - *(dict) --* 

                Object that defines users contact preference.

                
                

                - **KeyName** *(string) --* 

                  A searchable, unique identifier of a customer profile.

                  
                

                - **KeyValue** *(string) --* 

                  The key value used to look up profile based off the keyName.

                  
                

                - **ProfileId** *(string) --* 

                  The unique identifier of a customer profile.

                  
                

                - **ContactType** *(string) --* 

                  The contact type used for engagement. For example: HomePhoneNumber, PersonalEmailAddress.

                  
            
          
            

            - **Email** *(list) --* 

              A list of email-related contact preferences

              
              

              - *(dict) --* 

                Object that defines users contact preference.

                
                

                - **KeyName** *(string) --* 

                  A searchable, unique identifier of a customer profile.

                  
                

                - **KeyValue** *(string) --* 

                  The key value used to look up profile based off the keyName.

                  
                

                - **ProfileId** *(string) --* 

                  The unique identifier of a customer profile.

                  
                

                - **ContactType** *(string) --* 

                  The contact type used for engagement. For example: HomePhoneNumber, PersonalEmailAddress.

                  
            
          
        
      
    
      

      - **NextToken** *(string) --* 

        The pagination token from the previous SearchProfiles API call.

        
  
  **Exceptions**
  
  *   :py:class:`CustomerProfiles.Client.exceptions.BadRequestException`

  
  *   :py:class:`CustomerProfiles.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`CustomerProfiles.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`CustomerProfiles.Client.exceptions.ThrottlingException`

  
  *   :py:class:`CustomerProfiles.Client.exceptions.InternalServerException`

  