You’d want to set a time range in the filter param, e.g.
klaviyo.Events.get_events(
fields_event=e'event_properties'],
filter="equals(metric_id,\"aBc123\"),greater-than(datetime,2023-01-01T00:00:00Z),less-than(datetime,2023-01-02T00:00:00Z)",
sort='-datetime'
)
Thank you! One more question, would limiting the set of fields I want, possibly make the API calls faster or does that not have anything to do with the number of requests I can make?
For example, if I only cared about:
id,
event_properties.$message,
event_properties.$event_id,
relationships.profiles.data.id
How could I modify the API call and would this even help?
You mean with sparse fieldsets? https://developers.klaviyo.com/en/reference/api_overview#sparse-fieldsets
It won’t change the Get Events rate limit but will shrink the response size, so any code calling the API might process faster with a smaller response to parse.
As for properties you can fetch, for fieldseevent] it’s t'datetime', 'event_properties', 'id', 'timestamp', 'uuid'].
The ID of the event’s profile will already be returned, but you can fetch additional properties like first_name and email without having to make a separate API call to get the profile, e.g.
https://a.klaviyo.com/api/events/?filter=equals(metric_id,"ABC123")&fieldsmprofile]=email&include=profile