<?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: Using hubspot.fetch() to call the hubspot API in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Using-hubspot-fetch-to-call-the-hubspot-API/m-p/1218192#M85176</link>
    <description>&lt;P data-start="0" data-end="19"&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/1004025"&gt;@OStangenberg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="21" data-end="532"&gt;You’re reading it right. hubspot.fetch() is for calling external services you allowlist, not HubSpot’s own APIs. It won’t carry your HubSpot auth context to api.hubapi.com or api-eu1.hubapi.com, so you’ll hit hublet mismatch or 401. The supported pattern is front end &amp;gt; your backend (or HubSpot Functions) &amp;gt; HubSpot REST with OAuth or a private app token stored as a secret, and you add only your backend URL to permittedUrls (&lt;A href="https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/fetching-data" target="_blank"&gt;https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/fetching-data&lt;/A&gt; )&lt;/P&gt;
&lt;P data-start="21" data-end="532"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="534" data-end="982"&gt;On the server side, authenticate with OAuth or private app access tokens and return just what the card needs. That keeps tokens off the client, avoids CORS, and works across regions consistently in 2025&lt;BR /&gt;(&lt;A href="https://developers.hubspot.com/docs/apps/legacy-apps/authentication/intro-to-auth" target="_blank"&gt;https://developers.hubspot.com/docs/apps/legacy-apps/authentication/intro-to-auth&lt;/A&gt; )&lt;/P&gt;
&lt;P data-start="534" data-end="982"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="534" data-end="982"&gt;One quick question: are you distributing this as a marketplace app or only for a single account? It affects whether you choose OAuth vs a private app token. When this hinges on reliable two-way sync, Stacksync handles the mapping and timing so records stay consistent without manual patches.&lt;/P&gt;</description>
    <pubDate>Thu, 30 Oct 2025 17:27:30 GMT</pubDate>
    <dc:creator>RubenBurdin</dc:creator>
    <dc:date>2025-10-30T17:27:30Z</dc:date>
    <item>
      <title>Using hubspot.fetch() to call the hubspot API</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Using-hubspot-fetch-to-call-the-hubspot-API/m-p/1214634#M85031</link>
      <description>&lt;P&gt;I am working on a CRM extension with 2025.2 and would like to use hubspot.fetch() to directly call the Hubspot API. For me the fact that the api.hubapi.com is in some examples for the permittedUrls implies that this should be possible. But if i try to call it from our portal hosted in eu1 i get an error&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hub *** is unknown to this Hublet, but it appears to exist in Hublet eu1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I then tried making the call to api-eu1.hubapi.com instead but that just resulted in a 401.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So is there a way to make this work? Or do i always have to go through a backend?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 14:20:44 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Using-hubspot-fetch-to-call-the-hubspot-API/m-p/1214634#M85031</guid>
      <dc:creator>OStangenberg</dc:creator>
      <dc:date>2025-10-21T14:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using hubspot.fetch() to call the hubspot API</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Using-hubspot-fetch-to-call-the-hubspot-API/m-p/1214649#M85034</link>
      <description>&lt;P&gt;You can’t really call HubSpot’s own REST API directly from a CRM extension using hubspot.fetch(). It appears to work, but it’s blocked by design. The unknown to this hublet error happens because your portal is in EU1, but api.hubapi.com points to the US hublet. When you switch to api-eu1.hubapi.com, it connects to the right region but still fails with 401 since hubspot.fetch() doesn’t include your auth context for HubSpot’s own domains.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The right way to do it is through a backend. You can use HubSpot Functions or any simple external service to handle the API call. Store your private app token as a secret, make the API request from there, and just call that function from your extension. That keeps your token secure and avoids CORS or hublet issues. Basically, think of hubspot.fetch() as something for safe external calls, not internal API access&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2025 14:52:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Using-hubspot-fetch-to-call-the-hubspot-API/m-p/1214649#M85034</guid>
      <dc:creator>TOlis</dc:creator>
      <dc:date>2025-10-21T14:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using hubspot.fetch() to call the hubspot API</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Using-hubspot-fetch-to-call-the-hubspot-API/m-p/1218192#M85176</link>
      <description>&lt;P data-start="0" data-end="19"&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/1004025"&gt;@OStangenberg&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="21" data-end="532"&gt;You’re reading it right. hubspot.fetch() is for calling external services you allowlist, not HubSpot’s own APIs. It won’t carry your HubSpot auth context to api.hubapi.com or api-eu1.hubapi.com, so you’ll hit hublet mismatch or 401. The supported pattern is front end &amp;gt; your backend (or HubSpot Functions) &amp;gt; HubSpot REST with OAuth or a private app token stored as a secret, and you add only your backend URL to permittedUrls (&lt;A href="https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/fetching-data" target="_blank"&gt;https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/fetching-data&lt;/A&gt; )&lt;/P&gt;
&lt;P data-start="21" data-end="532"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="534" data-end="982"&gt;On the server side, authenticate with OAuth or private app access tokens and return just what the card needs. That keeps tokens off the client, avoids CORS, and works across regions consistently in 2025&lt;BR /&gt;(&lt;A href="https://developers.hubspot.com/docs/apps/legacy-apps/authentication/intro-to-auth" target="_blank"&gt;https://developers.hubspot.com/docs/apps/legacy-apps/authentication/intro-to-auth&lt;/A&gt; )&lt;/P&gt;
&lt;P data-start="534" data-end="982"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="534" data-end="982"&gt;One quick question: are you distributing this as a marketplace app or only for a single account? It affects whether you choose OAuth vs a private app token. When this hinges on reliable two-way sync, Stacksync handles the mapping and timing so records stay consistent without manual patches.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Oct 2025 17:27:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Using-hubspot-fetch-to-call-the-hubspot-API/m-p/1218192#M85176</guid>
      <dc:creator>RubenBurdin</dc:creator>
      <dc:date>2025-10-30T17:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using hubspot.fetch() to call the hubspot API</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Using-hubspot-fetch-to-call-the-hubspot-API/m-p/1218348#M85188</link>
      <description>&lt;P&gt;This app is only deployed to a single account and not intended for the marketplace&lt;/P&gt;</description>
      <pubDate>Thu, 30 Oct 2025 22:52:42 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Using-hubspot-fetch-to-call-the-hubspot-API/m-p/1218348#M85188</guid>
      <dc:creator>OStangenberg</dc:creator>
      <dc:date>2025-10-30T22:52:42Z</dc:date>
    </item>
  </channel>
</rss>

