Receiving leads and mqls by api


Hello all,

I’m developing digital signage in my company. I would like to fetch from your API data from “this month”.

I need Number of Leads and number of MQLs for each of the months. Then I will also need information about lead source.

API documentation is so unclear and does not cover those topics.

Let’s say I want to get MQLs so I call:

def search_for_contacts():

xulr = "/contacts/v1/lists/all/contacts/all"

url = hubspot_api_url + xulr + api_key +"&property=hs_lifecyclestage_marketingqualifiedlead_date"
# Now we use urllib3 to open the url and read it
response = urllib2.urlopen(url).read()
str_response = response.decode('utf-8')
statistics = json.loads(str_response)
#df = pd.DataFrame(statistics["contacts"])
#lista = statistics["contacts"]


But this data is totally not comparable with the information that I have in my Funnel report…

What is more, how to use “this month” option?

Best Konrad

PS: I will be using python.


HI @Konrad_Bujak,

The endpoint you listed is used to pull all contact records from a portal. Using this endpoint would require pulling all contacts from the portal, and counting the number whose hs_lifecyclestage_marketingqualifiedlead_date property is within the current month. You might instead consider creating a smart list with the criteria you mentioned (became an MQL in the last month) and pulling the information on that list via the API.



Thanks Derek!

Is there option to set “This month” in the Smart Lists? Right now I have date between but it requires me to change it every month.

And how to fetch data from this specific smart list? I see this endpoint

However this endpoint gives option to take specific list by its id:


Hi @Konrad_Bujak,

You can apply a rolling date filter (i.e. last 30 days) or a specific calendar date, but it’s not possible to say ‘this month’ exactly. Using the API, you can programmatically create lists very quickly, so you might consider creating lists for the next few months at once. Regarding pulling the data; you’ll want to use the following endpoint to pull the contacts in a list: