Skip to main content
Solved

Incorrect & "duplicate" data returning from Get Events API

  • April 18, 2025
  • 5 replies
  • 118 views

Forum|alt.badge.img

I am using the Get Events API (v2025-01-15) to pull event data for specific metrics and return specific event properties (Ex: Campaign Name for Opened Email) and the associated profile information as well (Email, ID) . I am noticing that this returns “duplicated” data that is not matching what I’m validating when looking at a profile in the Klaviyo web portal and the “activity feed” for that same event. It isn’t true duplicate data, the UUIDs are unique, but the timestamps are all within seconds of each other and the Campaign Names look like nearly every campaign we have, not just one Campaign Name. Also in some cases the Campaign Name and timestamp for a profile are not even showing up in the web portal for the user, so I’m not sure where the incorrect data is coming from, could it be the way I am filtering? When I filter to a specific Profile ID and without the datetime filters the data comes through correctly, but I need all to query all profile info. 

This is my URL: "https://a.klaviyo.com/api/events?include=profile&fields[event]="+field_list+"&fields[profile]=email,id&filter=equals(metric_id,%22"+METRIC_ID+"%22),greater-than(datetime%2C"+filter_date+"),less-than(datetime%2C"+var_new_filter_date+")&page[size]=100"

With Field List being: 

 "timestamp,"
    "datetime,"
    "uuid,"
    "event_properties.Campaign Name,"
    "event_properties.$klaviyo_bounce_category,"
    "event_properties.machine_open,"
    "event_properties.Bounce Type,"
    "event_properties.URL"

Best answer by whereisjad

@bkleier_sbc Are you referring to the entries within the “included” array in the JSON response? Are you expecting them to follow the same order as the events in the “data” array? Please note that all entries beneath the “included” array serve as a mapping table for the items in the “data” array.

5 replies

whereisjad
Expert Problem Solver IV
Forum|alt.badge.img+16
  • Expert Problem Solver IV
  • April 18, 2025

@bkleier_sbc could it be possible that the Get Events API is returning records associated with profiles that have been suppressed within your system? Alternatively, might these records correspond to an Email Opened event related to a Campaign or Flow that have since been deleted from the system?


Forum|alt.badge.img
  • Author
  • Contributor I
  • April 18, 2025

@whereisjad I appreciate your thoughts! I’m not sure they are related to suppressions because it more seems like an error I am making on my end. I notice the incorrect records when I am parsing the JSON data and it depends on which Profile fields I select to parse (I am using Matillion ETL tool and they have a Extract Nested Data component). When I bring in Email, which I specify in the URL to bring from Profiles, thats when I notice the incorrect and extra records. It seems like it does not link the Email to the correct event ID maybe?  

 


whereisjad
Expert Problem Solver IV
Forum|alt.badge.img+16
  • Expert Problem Solver IV
  • Answer
  • April 18, 2025

@bkleier_sbc Are you referring to the entries within the “included” array in the JSON response? Are you expecting them to follow the same order as the events in the “data” array? Please note that all entries beneath the “included” array serve as a mapping table for the items in the “data” array.


Forum|alt.badge.img
  • Author
  • Contributor I
  • April 18, 2025

@whereisjad  Yes! Can you explain more on how the included values should be used? 


Forum|alt.badge.img
  • Author
  • Contributor I
  • April 18, 2025

I think that was my problem...I didn’t know they were a mapping table. Also, I can get the profile ID from the Data array, so I don’t really need to bring in Profile data for “included”. I can just use the Profile ID. I think that solves my issues...hopefully. Double checking