Find Leads by Custom Field Value

November 22, 2014 | by

Let’s say you want to get leads from the Marketo API who match certain activity or inactivity criteria. For example, maybe you want to find leads whose score has not changed in the past 30 days. By following the steps in this post, you will be able to get this list of leads.

To do this, we will create a smart campaign in Marketo that identifies leads whose score has not changed in the past 30 days, and then store a value on these leads to identify them. We will then query the API with this value.

Step One: Create a new custom field called customLeadStatus

Login to Marketo, and go to the Admin panel. Click on Field Management.


Click New Custom Field.


Name the field. Then click Create.


Step Two: Create a smart campaign with a smart list that looks for leads that have not been updated in 30 days.

Click New Smart Campaign.


Name the new smart campaign.


Drag Not Score Was Changed from right panel to middle panel.


Step Three: Add a flow step to the smart campaign from Step 3 to update customLeadStatus field with a new value.

Drag Change Data Value from right panel to middle panel.


Step Four: Update Smart Campaign to allow leads to run through multiple times.

Click Schedule. Then click Edit.


Select every time. Then click Save.


The campaign will now start running.


Step Five: Query the Get Multiple Leads by Filter Type REST API. Providing the parameters filterType=customLeadStatus & filterValue=needsEnrichment.

This is an example request that will return this data.

A successful API call will return JSON data with leads whose customLeadStatus field matches the value of needsEnrichment.


Please review the the Get Multiple Leads by Filter Type REST API for more information.