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

**********************
get_segment_membership
**********************



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

  

  Determines if the given profiles are within a segment.

  

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


  **Request Syntax**
  ::

    response = client.get_segment_membership(
        DomainName='string',
        SegmentDefinitionName='string',
        ProfileIds=[
            'string',
        ]
    )
    
  :type DomainName: string
  :param DomainName: **[REQUIRED]** 

    The unique name of the domain.

    

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

    The Id of the wanted segment. Needs to be a valid, and existing segment Id.

    

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

    The list of profile IDs to query for.

    

  
    - *(string) --* 

    

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

    
    ::

      {
          'SegmentDefinitionName': 'string',
          'Profiles': [
              {
                  'ProfileId': 'string',
                  'QueryResult': 'PRESENT'|'ABSENT',
                  'Profile': {
                      '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'
                              },
                          ]
                      }
                  }
              },
          ],
          'Failures': [
              {
                  'ProfileId': 'string',
                  'Message': 'string',
                  'Status': 123
              },
          ],
          'LastComputedAt': datetime(2015, 1, 1)
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **SegmentDefinitionName** *(string) --* 

        The unique name of the segment definition.

        
      

      - **Profiles** *(list) --* 

        An array of maps where each contains a response per profile requested.

        
        

        - *(dict) --* 

          Object that holds the results for membership.

          
          

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

            The profile id the result belongs to.

            
          

          - **QueryResult** *(string) --* 

            Describes whether the profile was absent or present in the segment.

            
          

          - **Profile** *(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.

                    
              
            
          
        
      
    
      

      - **Failures** *(list) --* 

        An array of maps where each contains a response per profile failed for the request.

        
        

        - *(dict) --* 

          Object that holds failures for membership.

          
          

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

            The profile id the failure belongs to.

            
          

          - **Message** *(string) --* 

            A message describing the failure.

            
          

          - **Status** *(integer) --* 

            The status describing the failure.

            
      
    
      

      - **LastComputedAt** *(datetime) --* 

        The timestamp indicating when the segment membership was last computed or updated.

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

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

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

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

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

  