Skip to main content
Contributor III
December 20, 2022
Solved

Events API - specific date range

  • December 20, 2022
  • 4 replies
  • 396 views

Hi,

 

I am trying to make this work, but I keep getting ALL events and it seems the filtering doesn’t work…?

 

Please someone explain to me what I am doing wrong and suggest an edit to my HTTP:

https://a.klaviyo.com/api/events/?filter=greater-than(datetime,2022-01-01T11:30:00Z)&filter=less-or-equal(datetime,2022-08-01T11:30:00Z)

 

Brgds Lasse (and merry Christmas)

    This topic has been closed for replies.
    Best answer by jjensen_ksp

    Hi Larindom,

    in your example, you have 2 filter attributes that are probably cancelling out one another.

    You’re probably looking to use the “and” filter in combination with what you have. In this example I’m using a comma between filters (which implies “and”)

    https://a.klaviyo.com/api/events/?filter=greater-than(datetime,2022-01-01T11:30:00Z),less-or-equal(datetime,2022-08-01T11:30:00Z)

     

    Reference https://developers.klaviyo.com/en/docs/filtering_

     

    4 replies

    jjensen_ksp
    Problem Solver I
    Problem Solver I
    December 20, 2022

    Hi Larindom,

    in your example, you have 2 filter attributes that are probably cancelling out one another.

    You’re probably looking to use the “and” filter in combination with what you have. In this example I’m using a comma between filters (which implies “and”)

    https://a.klaviyo.com/api/events/?filter=greater-than(datetime,2022-01-01T11:30:00Z),less-or-equal(datetime,2022-08-01T11:30:00Z)

     

    Reference https://developers.klaviyo.com/en/docs/filtering_

     

    larindomAuthor
    Contributor III
    January 6, 2023

    Hi,

     

    I am trying to make this work, but I keep getting ALL events and it seems the filtering doesn’t work…?

     

    Please someone explain to me what I am doing wrong and suggest an edit to my HTTP:

    https://a.klaviyo.com/api/events/?filter=greater-than(datetime,2022-01-01T11:30:00Z)&filter=less-or-equal(datetime,2022-08-01T11:30:00Z)

     

    Brgds Lasse (and merry Christmas)

     

    Brilliant, thank you! :-)

    Contributor I
    February 23, 2023

    Any solution  for that I’m also facing same issue but  filtering doesn’t work . Any suggest ,how can do specific time for API filtering

    jjensen_ksp
    Problem Solver I
    Problem Solver I
    February 23, 2023

    @shalukumari , are you filtering events/metrics? Are you trying to filter them by something other than the “datetime” dates?