Hey everyone! 👋 Working on some Marketo cleanup at my org and realized how much hidden clutter can build up over the years in the form of old smart lists and programs that aren't actually being used by any active campaigns or automations.
It's a common pain point, right? They slow down instance searches, make onboarding new team members trickier, and just generally add noise. I wanted a way to systematically identify them, so I put together a Python script that taps into the Marketo REST API.
Hereβs what the script does:
* Fetches all smart lists and programs in your instance.
* Checks for active membership in a campaign or trigger campaign flow.
* Cross-references against being used in a landing page template or form.
* Outputs a simple CSV report listing the "orphaned" assets, along with last updated date and owner.
It's been super helpful for us to prioritize what can be archived. For example, we found over 200 smart lists created for one-off events years ago that were just sitting there.
You'll need your Marketo API credentials (Client ID, Client Secret, Munchkin ID). The script uses the `requests` library. I'm happy to share the code if anyone's interestedβjust drop a comment. It's a starting point you can adapt for your own audit rules.
Has anyone else tackled something similar? I'd love to compare notes on audit strategies or hear if other platforms like HubSpot have similar challenges with asset sprawl.
✨
Ship fast. Learn faster.
Scripts like this are a good starting point, but you need to be careful about the definition of "unused." In my last audit, we almost deleted several smart lists that weren't in active campaigns but were referenced by critical API integrations and external BI dashboards pulling data via Marketo exports. The script didn't flag them because those aren't standard operational assets within the Marketo UI.
You should extend your checks to include any external references documented in your CI/CD pipeline or integration mappings. Also, consider adding a warning flag for assets touched in the last 90 days, even if they're not in a campaign. Sometimes a human is actively debugging or revising something and hasn't attached it to the flow yet.
Post your code, I'll take a look at the API calls you're making. I bet we can add a check for membership in trigger campaigns versus batch campaigns, as the former are often the culprits for hidden, hard-to-track dependencies.
You're absolutely right about external dependencies being a blind spot. The API and export use case is a critical one we discovered the hard way in our own cleanup last quarter.
Our approach was to add a secondary data source check. We configured the script to also pull all API-based activity from our audit logs for the last 180 days and cross-reference smart list IDs. If a list appeared there, we moved it to a separate "external dependency" report for manual review. It's not perfect, but it surfaces those hidden connections.
Adding a recency filter is also a good safeguard. We found that filtering out any asset modified in the last 60 days prevented interrupting work-in-progress, though the exact threshold depends on your team's development cycle length.
infra nerd, cost hawk
You're hitting on a real problem, and a script is the right way to tackle it. But before you share that code, let's talk about where it runs. Please tell me you're not planning to execute this from a GitHub Actions runner on their infrastructure, hitting your Marketo instance with API credentials. That's a compliance nightmare waiting to happen.
If you are, the script's value is completely negated by the delivery mechanism. Self-hosted runner or a simple cron job on an internal machine is the only sane path here.
null