Get User Profiles
  • 21 Feb 2024
  • 4 Minutes to read

    Get User Profiles


      Article Summary

      Overview

      This API returns the attributes and events you request for a single user that you specify by an identifier. It takes identifier, attribute list, and event list along with the date range. In its response, it provides the data you choose. 

      You can get user profiles for these or similar use-cases:

      • Personalization of the content for your other providers
      • Connecting user profiles to your services like call centers

      Endpoint and Headers

      POST https://unification.useinsider.com/api/user/v1/profile

      Headers

      HeaderSample ValueDescription
      X-PARTNER-NAMEmybrandThis is your partner name. Navigate to Inone > Inone Settings > Account Preferences to copy your partner name. The partner name should be lowercase.
      X-REQUEST-TOKEN1a2b3c4d5e6f

      This key is required to authorize your request. Refer to API Authentication Tokens to generate your token.

      Content-Typeapplication/jsonThis header specifies the media type of the resource.

      Body Parameters

      Each POST body must have an identifiers object. 

      your title goes here
      Each request must have attributes or events object to return the respective user profiles. In the event of using events object, its keys are required as stated in the table below. 
      ParameterDescriptionData TypeRequired
      identifiersIdentifier keyObjectRequired
      attributesArray of wanted attributesArray (of string)Yes (if the body does not have the events object)
      eventsObject of eventsObjectYes (if the body does not have the attributes object)
      start_date
      Beginning of the date range for the wanted eventsNumber (Epoch Timestamp)
      Yes (if the body has the events object)
      end_date
      End of the date range for the wanted eventsNumber (Epoch Timestamp)
      Yes (if the body has the events object)
      wanted
      Object of the wanted eventsArrayYes (if the body has the events object)
      event_name
      Name of the eventStringYes (if the body has the events object)
      params
      Wanted event parameters of the eventArray (of string)Yes (if the body has the events object)
      quotaFlag to display quota usageBooleanNo

      Sample Example

      Sample Request

      The sample below displays a request to get user data with an identifier.

      You can refer to Default Events & Attributes to see the list of events and attributes. If an event or attribute name consists of more than one word, you can use an underscore (_) between the words. E.g. email_optin, homepage_view, etc.

      curl --location --request POST 'https://unification.useinsider.com/api/user/v1/profile' \
      --header 'X-REQUEST-TOKEN: 1a2b3c4d5e6f' \
      --header 'X-PARTNER-NAME: mybrand' \
      --header 'Content-Type: application/json' \
      --header 'Cookie: __cfduid=d1a0bc0c8335c7fecbd3485839787329b1615112066' \
      --data-raw '{
         "identifiers":{
            "email":"example@useinsider.com"
         },
         "attributes":[
            "email",
            "name",
            "surname"
         ],
         "events":{
            "start_date":1606311893,
            "end_date":1611582293,
            "wanted":[
               {
                  "event_name":"email_click",
                  "params":[
                     "campaign_id",
                     "timestamp"
                  ]
               },
               {
                  "event_name":"item_added_to_cart",
                  "params":[
                     "product_id",
                     "name",
                     "timestamp"
                  ]
               },
               {
                  "event_name":"journey_entered",
                  "params":[
                     "journey_id",
                     "timestamp"
                  ]
               }
            ]
         },
         "quota": true
      }'  

      The sample below displays a request to get user data with a custom attribute.

      curl --location --request POST 'https://unification.useinsider.com/api/user/v1/profile' \
      --header 'X-REQUEST-TOKEN: 1a2b3c4d5e6f' \
      --header 'X-PARTNER-NAME: mybrand' \
      --header 'Content-Type: application/json' \
      --header 'Cookie: __cfduid=d1a0bc0c8335c7fecbd3485839787329b1615112066' \
      --data-raw '{
          "identifiers": {
              "email": "example@useinsider.com"
          },
          "attributes": [
              "email",
              "name",
              "surname",
              "c_member_code"
          ],
          "events": {
              "start_date": 1606311893,
              "end_date": 1611582293,
              "wanted": [
                  {
                      "event_name": "email_click",
                      "params": [
                          "campaign_id",
                          "timestamp"
                      ]
                  },
                  {
                      "event_name": "item_added_to_cart",
                      "params": [
                          "product_id",
                          "name",
                          "timestamp"
                      ]
                  },
                  {
                      "event_name": "journey_entered",
                      "params": [
                          "journey_id",
                          "timestamp"
                      ]
                  }
              ]
          },
          "quota": true
      }'  

      The sample below displays a request to get user data with insider_id.

      Your title goes here
      insider_id is an internal ID maintained by the Insider for each user. To find the insider_id, you can refer to the Profile ID on the User Profile.
      curl --location --request POST 'https://unification.useinsider.com/api/user/v1/profile' \
      --header 'X-REQUEST-TOKEN: 1a2b3c4d5e6f' \
      --header 'X-PARTNER-NAME: mybrand' \
      --header 'Content-Type: application/json' \
      --header 'Cookie: __cfduid=d1a0bc0c8335c7fecbd3485839787329b1615112066' \
      --data-raw '{
        "insider_id": "sampleinsiderid",
        "attributes": [
          "email",
          "name",
          "surname"
        ],
        "events": {
          "start_date": 1606311893,
          "end_date": 1611582293,
          "wanted": [
            {
              "event_name": "email_click",
              "params": [
                "campaign_id",
                "timestamp"
              ]
            },
            {
              "event_name": "item_added_to_cart",
              "params": [
                "product_id",
                "name",
                "timestamp"
              ]
            },
            {
              "event_name": "journey_entered",
              "params": [
                "journey_id",
                "timestamp"
              ]
            }
          ]
        },
        "quota": true
      }'

      Sample Responses

      200 OK

      {
        "attributes": {
          "email": "john.doe@email.com",
          "name": "John",
          "surname": "Doe"
        },
        "events": {
          "email_click": [
            {
              "campaign_id": 1456,
              "created_date": "2021-01-06T23:34:09Z"
            },
            {
              "campaign_id": 1245,
              "created_date": "2021-01-01T12:56:21Z"
            }
          ],
          "item_added_to_cart": [
            {
              "product_id": "3254634",
              "name": "Blue Shirt",
              "created_date": "2021-01-04T15:04:34Z"
            }
          ],
          "journey_entered": [
            {
              "journey_id": 12,
              "created_date": "2021-01-02T09:35:46Z"
            }
          ]
        },
        "quota": {
              "cost": 2.5,
              "used": 2.5,
              "total": 1000
          }
      }

      404 Not Found

      {"error":"no such user for these identifiers: no data"}

      429 Too Many Requests

      If you exceed the rate limits, you receive an error shown below:

      {
          "error": "rejected: too many requests"
      }

      Limitations

      • All functions must be executed with a simple HTTPS POST request.
      • Only new data can be retrieved via this API. No data can be inserted.
      • The request token should be provided on the request header. If the token is incorrect, the operation will not be executed.
      • The API can prepare the data only for one user that is specified by the identifier
      • If the limit_per_source value is set, then only that many events are assigned from every source. For example, if the limit_per_source value is set to 1 for the purchase event, then 1 purchase event is acquired from email, web, and other sources as well.
      • If you wish to see the quota usage for the payload then set Quota=true.
      • The quota is limited to 1000 units per minute.
      • The user base size and the number of types of events define the quota usage. The attribute number or set of attributes doesn't matter.
      • The value of X-PARTNER-NAME header should be lowercase.

      Was this article helpful?

      ESC

      Eddy, a super-smart generative AI, opening up ways to have tailored queries and responses