Skip to main content
Solved

Get list total member count by date


Forum|alt.badge.img+4

Hi,

I need list size and growth data via API

please refer below screenshot and help me to get the same data

 

Best answer by Brian Turcotte

Hi @santiagosanti!

This functionality isn’t available yet via the APIs, but our Product Team is considering the possibility of adding it to future releases, so I will keep you updated if anything changes.

 

Best,

Brian

View original
Did this topic or the replies in the thread help you find an answer to your question?

6 replies

Brian Turcotte
Forum|alt.badge.img+37
  • Klaviyo Alum
  • 1393 replies
  • Answer
  • August 2, 2023

Hi @santiagosanti!

This functionality isn’t available yet via the APIs, but our Product Team is considering the possibility of adding it to future releases, so I will keep you updated if anything changes.

 

Best,

Brian


Forum|alt.badge.img+1
  • Contributor II
  • 3 replies
  • October 6, 2023

Hello @Brian Turcotte 

Is your reply still accurate or has this now changed? I was looking at the following guide: https://developers.klaviyo.com/en/docs/using_the_query_metric_aggregates_endpoint#flow-revenue-performance-reporting 

In the list of example uses of this API endpoint it says: “Get list growth data broken down by month, per list.” 

Sounds like it would be possible then? It would be good if an example could be given in the same guide as I think this is going to be a popular use of the API (the need to track list growth over time in external reports etc.)


Brian Turcotte
Forum|alt.badge.img+37

Hi @ipn-jonathan!

While there’s not a direct list growth metric that you can grab with this endpoint, there are two ways you could track list growth with the APIs, depending on how you define it:

 

  • Using the Query Metrics Aggregates endpoint, you could obtain the count of Subscribed to List metrics in a monthly period and filter/group by the List attribute
     
  • Making monthly calls to the Get List endpoint and adding the profile_count Query field to retrieve list size in the response:

 

 

 

I hope this helps to clarify!

- Brian


Forum|alt.badge.img+5
  • Contributor IV
  • 7 replies
  • January 14, 2024

Hey @Brian Turcotte trying to implement what you said above but the unsubscribed are quite inaccurate. Much lower than is what is seen in Klaviyo. I believe this is because of people being suppressed as Klaviyo says “Members Gained/Lost” not Subscribed/Unsubscribed. 

When I tried to run the same query with “Suppressed from List for Email Marketing” the endpoint worked, but there were no dimensions. 

I ran this 
 

start_date = "2023-01-15T00:00:00"
end_date = "2024-01-14T23:59:59"
page_size = 1000
interval = "month"
measurement = "sum_value"


url = "https://a.klaviyo.com/api/metric-aggregates/"
payload = {
    "data": {
        "type": "metric-aggregate",
        "attributes": {
            "metric_id": metric_id,
            "interval": interval,
            "page_size": page_size,
            "timezone": "US/Eastern",
            "measurements": [measurement],
            "filter": [
                f"greater-or-equal(datetime,{start_date})",
                f"less-than(datetime,{end_date})",
            ],
            "by": ["List"],
        },
    }
}

headers = {
    "accept": "application/json",
    "revision": "2023-02-22",
    "content-type": "application/json",
    "Authorization": f"Klaviyo-API-Key {api_key}",
}

response = requests.post(url, json=payload, headers=headers)

response_json = response.json()
response_json

And the response was  

{'type': 'metric-aggregate',
  'id': '6066036689615639135',
  'attributes': {'dates': ['2023-01-01T05:00:00+00:00',
    '2023-02-01T05:00:00+00:00',
    '2023-03-01T05:00:00+00:00',
    '2023-04-01T04:00:00+00:00',
    '2023-05-01T04:00:00+00:00',
    '2023-06-01T04:00:00+00:00',
    '2023-07-01T04:00:00+00:00',
    '2023-08-01T04:00:00+00:00',
    '2023-09-01T04:00:00+00:00',
    '2023-10-01T04:00:00+00:00',
    '2023-11-01T04:00:00+00:00',
    '2023-12-01T05:00:00+00:00',
    '2024-01-01T05:00:00+00:00'],
   'data': [{'dimensions': [''],
     'measurements': {'sum_value': [0.0,
       0.0,
       0.0,
       0.0,

...

 

As you can see, the dimensions are empty, even though I added "by": ["List"] to the parameters of the request. 

Anything I can do here? I’ve tried each of the measurements count, unique, sum_value, and I tried different intervals of day and month. It seems like a bug?


Brian Turcotte
Forum|alt.badge.img+37

Hi @MoneyJ2k!

Our API team is currently working on a way to streamline reporting tasks like this, so I will update this thread when that is released.

 

Best,

Brian


Forum|alt.badge.img+4
  • Author
  • Active Contributor II
  • 25 replies
  • May 16, 2024

Hi @Brian Turcotte!

Any update on getting list growth data via API?