programmatically get smart list total people count | Community
Skip to main content
Adobe Employee
June 18, 2024
Solved

programmatically get smart list total people count

  • June 18, 2024
  • 1 reply
  • 2379 views

Hello all, I understand there are no API endpoints available to get the total people to count for Smart-lists. I was wondering if anyone has found a workaround for this. I am more looking for a programmatic approach. Would it be possible to create a batch campaign to add the Smart-list members to a list (list name would be predefined) and then query the list by name to get the total member count? any other approaches? 

 

Thank you In advanced. 

 

Best answer by SanfordWhiteman

You could have a nightly batch that passes all members of the Smart List through a webhook-compatible service. The service would merely increment a counter variable for every call. (And of course you’d want to zero out the counter each day.) Then you’d query the service instead of Marketo. It’s pretty easy to set up but obviously is outside of Marketo proper.

 

Then again, depending on the typical size of your Smart List, you could just enqueue the SL each day using the Bulk Export API + smartListId filter and poll the status. The status.json endpoint returns a numberOfRecords value. The issue with this is large SLs take a long time to export. Since you don’t ever need the file itself, that’s a lot of wasted time/resources, especially if you’re running other export jobs.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
June 18, 2024

You could have a nightly batch that passes all members of the Smart List through a webhook-compatible service. The service would merely increment a counter variable for every call. (And of course you’d want to zero out the counter each day.) Then you’d query the service instead of Marketo. It’s pretty easy to set up but obviously is outside of Marketo proper.

 

Then again, depending on the typical size of your Smart List, you could just enqueue the SL each day using the Bulk Export API + smartListId filter and poll the status. The status.json endpoint returns a numberOfRecords value. The issue with this is large SLs take a long time to export. Since you don’t ever need the file itself, that’s a lot of wasted time/resources, especially if you’re running other export jobs.

Level 2
October 8, 2025

Why Marketo always recommends hard way of doing things instead of bringing in a direct way?  We are spending a lot of money on your subscriptions and yet there isn't any improvements in terms of tool's UI and API supports. And the crazy part is whenever we search for something the questions were asked in Marketo Nation like long time ago, yet the enhancements are not done. There is no visibility on Enhancement requests that are placed through TAMs and there isn't even a roadmap of when that request will be fulfilled. 

Also, I'm not sure why these threads are marked as "Answered" or "Correct Answer"

SanfordWhiteman
Level 10
October 9, 2025

Also, I'm not sure why these threads are marked as "Answered" or "Correct Answer"

Because a correct answer was provided! You can get the count using the REST API (that’s what programmatic approach means). There’s another method mentioned which is also correct. There’s no “more correct” answer than these two.

 

In other cases, the correct answer to Is <thing> currently possible? is a firm No. That’ll also be marked correct.

 

As a technical note, Marketo Smart Lists are dynamic SQL queries across a virtually unlimited number of tables (not just the main person table but custom objects, accounts, and the time series of activities). There’s no database in the world that lets you fetch the row count as of <now> without running the query now. Of course it’s not always necessary to return all fields if you’re only checking the count. But it’s absolutely necessary to run the query — not sure why anyone would imagine there’s a way around that.