<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Trying to pull through a contract (or billing start date) in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Trying-to-pull-through-a-contract-or-billing-start-date/m-p/1123471#M80929</link>
    <description>&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't mind running multiple requests i.e. this is what I'm doing to get the company name&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;# Fetch associated company&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;company_response = requests.get(&lt;/SPAN&gt;&lt;SPAN&gt;f&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;A href="https://api.hubapi.com/crm/v3/objects/deals/" target="_blank"&gt;https://api.hubapi.com/crm/v3/objects/deals/&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;{deal_id}&lt;/SPAN&gt;&lt;SPAN&gt;?associations=companies"&lt;/SPAN&gt;&lt;SPAN&gt;, headers=headers)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;company_id = company_response.json().get(&lt;/SPAN&gt;&lt;SPAN&gt;"associations"&lt;/SPAN&gt;&lt;SPAN&gt;, {}).get(&lt;/SPAN&gt;&lt;SPAN&gt;"companies"&lt;/SPAN&gt;&lt;SPAN&gt;, {}).get(&lt;/SPAN&gt;&lt;SPAN&gt;"results"&lt;/SPAN&gt;&lt;SPAN&gt;, [{}])[&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;].get(&lt;/SPAN&gt;&lt;SPAN&gt;"id"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;# Fetch company name&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;company_name = &lt;/SPAN&gt;&lt;SPAN&gt;"Unknown"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; company_id:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;company_name_response = requests.get(&lt;/SPAN&gt;&lt;SPAN&gt;f&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;A href="https://api.hubapi.com/crm/v3/objects/companies/" target="_blank"&gt;https://api.hubapi.com/crm/v3/objects/companies/&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;{company_id}&lt;/SPAN&gt;&lt;SPAN&gt;?properties=name"&lt;/SPAN&gt;&lt;SPAN&gt;, headers=headers)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;company_name = company_name_response.json().get(&lt;/SPAN&gt;&lt;SPAN&gt;"properties"&lt;/SPAN&gt;&lt;SPAN&gt;, {}).get(&lt;/SPAN&gt;&lt;SPAN&gt;"name"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Unknown"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;My real problem is how to get the billing start date (which is effectively) the contract start date for each line item when the 'hs_recurring_billing_start_date' resides in the Subscription Information group&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Mar 2025 19:01:17 GMT</pubDate>
    <dc:creator>SLoomb</dc:creator>
    <dc:date>2025-03-17T19:01:17Z</dc:date>
    <item>
      <title>Trying to pull through a contract (or billing start date)</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trying-to-pull-through-a-contract-or-billing-start-date/m-p/1123441#M80923</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to extract (integrate to) the hs_recurring_billing_start_date field which I have selected as a custom date when entering the line items for a deal. I am able to extract all other information I need from the line items and other info from the deal - including the Company name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I have is that the 'hs_recurring_billing_start_date' seems to be in the Subscription Information Group and I cannot seem to link to it. &amp;nbsp;Is there any way I can do this or do I need to request all users of our app create a custom field for the start date (a potential issue with this is that each line item could have a different start date). Here is an example of how I'm extracing the line items in python "&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A href="https://api.hubapi.com/crm/v3/objects/deals/" target="_blank"&gt;https://api.hubapi.com/crm/v3/objects/deals/&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;{deal_id}&lt;/SPAN&gt;&lt;SPAN&gt;/associations/line_items". &amp;nbsp;Thanks, any assistance would be greatly appreciated.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 17 Mar 2025 17:57:02 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trying-to-pull-through-a-contract-or-billing-start-date/m-p/1123441#M80923</guid>
      <dc:creator>SLoomb</dc:creator>
      <dc:date>2025-03-17T17:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to pull through a contract (or billing start date)</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trying-to-pull-through-a-contract-or-billing-start-date/m-p/1123461#M80927</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;After you run that association API request, are you then running another request on the Line Item IDs to retrieve the properties of each Line Item? &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If you don't want to do multiple calls, you might consider doing a GraphQL call which can pull all the data in a single go.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 17 Mar 2025 18:41:27 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trying-to-pull-through-a-contract-or-billing-start-date/m-p/1123461#M80927</guid>
      <dc:creator>MichaelMa</dc:creator>
      <dc:date>2025-03-17T18:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to pull through a contract (or billing start date)</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trying-to-pull-through-a-contract-or-billing-start-date/m-p/1123471#M80929</link>
      <description>&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't mind running multiple requests i.e. this is what I'm doing to get the company name&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;# Fetch associated company&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;company_response = requests.get(&lt;/SPAN&gt;&lt;SPAN&gt;f&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;A href="https://api.hubapi.com/crm/v3/objects/deals/" target="_blank"&gt;https://api.hubapi.com/crm/v3/objects/deals/&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;{deal_id}&lt;/SPAN&gt;&lt;SPAN&gt;?associations=companies"&lt;/SPAN&gt;&lt;SPAN&gt;, headers=headers)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;company_id = company_response.json().get(&lt;/SPAN&gt;&lt;SPAN&gt;"associations"&lt;/SPAN&gt;&lt;SPAN&gt;, {}).get(&lt;/SPAN&gt;&lt;SPAN&gt;"companies"&lt;/SPAN&gt;&lt;SPAN&gt;, {}).get(&lt;/SPAN&gt;&lt;SPAN&gt;"results"&lt;/SPAN&gt;&lt;SPAN&gt;, [{}])[&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;].get(&lt;/SPAN&gt;&lt;SPAN&gt;"id"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;# Fetch company name&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;company_name = &lt;/SPAN&gt;&lt;SPAN&gt;"Unknown"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; company_id:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;company_name_response = requests.get(&lt;/SPAN&gt;&lt;SPAN&gt;f&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;A href="https://api.hubapi.com/crm/v3/objects/companies/" target="_blank"&gt;https://api.hubapi.com/crm/v3/objects/companies/&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;{company_id}&lt;/SPAN&gt;&lt;SPAN&gt;?properties=name"&lt;/SPAN&gt;&lt;SPAN&gt;, headers=headers)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;company_name = company_name_response.json().get(&lt;/SPAN&gt;&lt;SPAN&gt;"properties"&lt;/SPAN&gt;&lt;SPAN&gt;, {}).get(&lt;/SPAN&gt;&lt;SPAN&gt;"name"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Unknown"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;My real problem is how to get the billing start date (which is effectively) the contract start date for each line item when the 'hs_recurring_billing_start_date' resides in the Subscription Information group&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 19:01:17 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trying-to-pull-through-a-contract-or-billing-start-date/m-p/1123471#M80929</guid>
      <dc:creator>SLoomb</dc:creator>
      <dc:date>2025-03-17T19:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to pull through a contract (or billing start date)</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trying-to-pull-through-a-contract-or-billing-start-date/m-p/1123480#M80938</link>
      <description>&lt;P&gt;Your code is a perfect example of what you would need to do to get the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To reiterate, you want to retrieve the property "&lt;SPAN&gt;hs_recurring_billing_start_date" from the Line Items of the deal (if more than 1 Line Item, then there are more than 1 "hs_recurring_billing_start_date" even if they might be the same value).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In part 1 of your code, you're pulling the IDs of the company associated with the Deal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In part 2, you're using the ID you pulled to pull in the rest of the data (the name) that you need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You would need to do the same with Line Items. You first fetch all the Line Items associated with the deal.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rough code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Fetch associated line items
line_items_response = requests.get(f"https://api.hubapi.com/crm/v3/objects/deals/{deal_id}?associations=line_items", headers=headers)
line_item_ids = line_items_response.json().get("associations", {}).get("line items", {}).get("results", [{}])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once you have the Line Item IDs, you can then retrieve the Line Item data. You likely should do a BATCH request to get them all at once instead of multiple requests.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# Request line items from deal
line_items = line_item_ids.get("associations", {}).get("line items", {}).get("results", [{}])

# Builds the basic batch data request payload
line_item_request = {"inputs": [], "properties": ["hs_recurring_billing_start_date"]}

# Add the Line Item IDs to the request
for l in line_items:
    line_item_request["inputs"].append({"id": l["id"]})

# BATCH request from hubspot
line_item_data = requests.post(f"https://api.hubapi.com/crm/v3/objects/line_items/batch/read", headers=headers, json=line_item_request)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once you do your batch request, you then have to iterate over response to obtain the data that you want which is the "hs_recurring_billing_start_date" value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All rough code so sorry if it doesn't compile.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An alternative is doing a GraphQL request which you can retrieve all the data in a single request.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 20:03:20 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trying-to-pull-through-a-contract-or-billing-start-date/m-p/1123480#M80938</guid>
      <dc:creator>MichaelMa</dc:creator>
      <dc:date>2025-03-17T20:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to pull through a contract (or billing start date)</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Trying-to-pull-through-a-contract-or-billing-start-date/m-p/1123540#M80940</link>
      <description>&lt;P&gt;Thanks that worked!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Mar 2025 21:25:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Trying-to-pull-through-a-contract-or-billing-start-date/m-p/1123540#M80940</guid>
      <dc:creator>SLoomb</dc:creator>
      <dc:date>2025-03-17T21:25:18Z</dc:date>
    </item>
  </channel>
</rss>

