# API Get All Deals with Lead Source

**URL:** <https://community.hubspot.com/t/api-get-all-deals-with-lead-source/41837>\
**Category:** APIs & Integrations\
**Tags:** object\
**Created:** [August 5, 2021, 4:20am UTC](https://community.hubspot.com/t/api-get-all-deals-with-lead-source/41837 "2021-08-05T04:20:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ganken](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ganken/32/78108_2.png) [@ganken](https://community.hubspot.com/u/ganken)\
**Post date:** [August 5, 2021, 4:20am UTC](https://community.hubspot.com/t/api-get-all-deals-with-lead-source/41837/1 "2021-08-05T04:20:13Z")

</div>

Is there a way for me to get all deals with the lead source property for the deals? The API is returning the lead source when I get a single lead but not in a batch. I tried a few different options but nothing worked.

The below just returns an empty property array.

[https://api.hubapi.com/deals/v1/deal/paged?hapikey=](https://api.hubapi.com/deals/v1/deal/paged?hapikey=) \<key\> &limit=100&includePropertyVersions=true&properties=lead\_source

Any help will be much appreciated.

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [August 5, 2021, 5:54pm UTC](https://community.hubspot.com/t/api-get-all-deals-with-lead-source/41837/2 "2021-08-05T17:54:31Z")

</div>

@Bryantworks , would you be able to assist here 🙏

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [August 6, 2021, 1:36pm UTC](https://community.hubspot.com/t/api-get-all-deals-with-lead-source/41837/3 "2021-08-06T13:36:58Z")

</div>

Hi @ganken ,  
Hope this code work for you :  
Api Documentation :  
“[Search the CRM - HubSpot docs](https://developers.hubspot.com/docs/api/crm/search)”  
For deal php code fetch result:  
\<?php  
$data = ‘{  
“properties”: [“dealname”, “amount”, “lead\_source”]  
“filterGroups”:[  
{  
“filters”:[  
{  
“propertyName”: “\<deal\_key\>”,  
“operator”: “EQ”,  
“value”: “\<deal\_value\>”  
}  
]  
}  
]  
}’;  
$ch = curl\_init();  
curl\_setopt($ch, CURLOPT\_URL, ‘[https://api.hubapi.com/crm/v3/objects/deals/search?hapikey=YOUR\_HUBSPOT\_API\_KEY](https://api.hubapi.com/crm/v3/objects/deals/search?hapikey=YOUR_HUBSPOT_API_KEY)’);  
curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, 1);  
curl\_setopt($ch, CURLOPT\_POST, 1);  
curl\_setopt($ch, CURLOPT\_POSTFIELDS, $data);  
$headers = array();  
$headers[] = ‘Content-Type: application/json’;  
curl\_setopt($ch, CURLOPT\_HTTPHEADER, $headers);  
$result = curl\_exec($ch);  
if (curl\_errno($ch)) {  
echo ‘Error:’ . curl\_error($ch);  
}  
curl\_close($ch);  
?\>

Hope this helps!

If we were able to answer your query, kindly help the community by marking it as a solution.  
Thanks and Regards.
