Migration guide — Migrate an API key integration to a private app

Hey, HubSpot Developers! There are plenty of questions about the upcoming sunset and how to migrate your apps using API keys to use Private Apps.

Luckily, our amazing team put together this guide, Migrate an API key integration to a private app :white_check_mark:

Changelog information here — Upcoming: API Key Sunset

If you have questions about the guide or the information included, please leave your feedback in the comments. If you have specific questions about migration of your app, please consider starting a new thread. This will help make sure your request gets the attention it deserves from our community.

Have fun coding! — Jaycee :orange_heart:

I’ve been attempting to migrate from API KEY auth to Private App using the guide, but the scopes on the Private App were causing difficulty, the e-commerce scope had been added to the Private App ( and the key rotated ) but the calls to the API using the Private App are still giving “One or more of the following scopes are required.” requiredScopes":[“e-commerce”] turned out to be attempting to use the e-commerce on the Products on a non-enterprise/non-professional account, would be handy if the guide had a reminder or the api message was more specific

Thanks for your feedback, @MWeddup :raising_hands: I’ll pass it along to my team. — Jaycee

Any update on this? I’m getting the same error using a developer account that was just renewed. Created a Private APP with the e-commerce scope and I can’t create Projects.

Sorry I just noticed this detail " turned out to be attempting to use the e-commerce on the Products on a non-enterprise/non-professional account," Can we not create projects through the API if we are using a free developer account? What is the minimum we need to properly test? Do we need to pay for 2 accounts? One for production data and one for testing?

Hi, we’ve moved to the new method, but we can’t get the Blog Author Name and Blog Author Image and these aren’t mentioned in the documentation. Can you advise?

Hey, @GDell :waving_hand: Which endpoint are you referring to? I am happy to take a brief look.

Best,

Jaycee

https://api.hubapi.com/blogs/v3/blog-authors/

It’s this one. Just need the equivalent for both Blog Author Name and associated image.

The new API is returning the user who created the post rather than the user the post is assigned to

Just more info:

We are using the Blog endpoints here Accounts Dashboard | HubSpot, see Endpoints tab. The “authorName”: “string” seems to return the name of the user creating the post, rather than the Author assigned to it. And there is no endpoint for Author image in this list. Hope this helps.

Hi, we are preparing to move to the new method. On the Article Guide it directs to the V3 API Enpoints.
My question is, on the required method, Private Apps, is the only possible API available for the new method the V3 API?

One of the features only possible in the V1 API is the Property History, and we wanted to keep this feature after the change.

Hey, @GustavoOliveira :waving_hand: I am happy to check for us.

Can you tell me specifically which v1 API you are referring to? For example, the Get a contact by vid endpoint works with private apps.

Thank you! — Jaycee

Thanks!

It’s the Get all deals (hubspot.com) or Get a deal | Deals API (hubspot.com) enpoints. But specifcally the parameters to get all version of a property (“Properties with History” and “Include property versions”, respectively), which is something the newer APIs don’t seem to provide.

Hey, @GustavoOliveira :waving_hand: Thank you very much for clarifying. I successfully ran quick tests of both v1 endpoints using Postman and included the additional params:

Get all deals

  • EndpointGET https://api.hubapi.com/deals/v1/deal/paged?propertiesWithHistory=dealname​

  • Response (edited to only include the relevant Deal)

    {
     "portalId": 22245342,
     "dealId": 9669508372,
     "isDeleted": false,
     "associations": null,
     "properties": {
     "dealname": {
     "value": "Changer v2",
     "timestamp": 1659390587045,
     "source": "CRM_UI",
     "sourceId": "userId:10233975",
     "updatedByUserId": 10233975,
     "versions": [
     {
     "name": "dealname",
     "value": "Changer v2",
     "timestamp": 1659390587045,
     "sourceId": "userId:10233975",
     "source": "CRM_UI",
     "sourceVid": [],
     "updatedByUserId": 10233975
     },
     {
     "name": "dealname",
     "value": "Changer v1",
     "timestamp": 1659390567632,
     "source": "CRM_UI",
     "sourceVid": [],
     "updatedByUserId": 10233975
     }
     ]
     }
     },
     "stateChanges": []
     }
     ],
     "hasMore": false,
     "offset": 9669508373​
    

Get a deal

  • EndpointGET https://api.hubapi.com/deals/v1/deal/9669508372?includePropertyVersions=true​

  • Response (edited to include only the relevant deal property)

    "dealname": {
     "value": "Changer v2",
     "timestamp": 1659390587045,
     "source": "CRM_UI",
     "sourceId": "userId:10233975",
     "updatedByUserId": 10233975,
     "versions": [
     {
     "name": "dealname",
     "value": "Changer v2",
     "timestamp": 1659390587045,
     "sourceId": "userId:10233975",
     "source": "CRM_UI",
     "sourceVid": [],
     "updatedByUserId": 10233975
     },
     {
     "name": "dealname",
     "value": "Changer v1",
     "timestamp": 1659390567632,
     "source": "CRM_UI",
     "sourceVid": [],
     "updatedByUserId": 10233975
     }
     ]
     },​
    

Thank you for asking this question. It helps other community members as well as helping us identify areas where more clarity is needed.

Best,

Jaycee

I forgot the most important detail :upside_down_face: Both of these requests were made using a Private App I created in my app testing account. — Jaycee

Thank you so much for the answer, it’s really thorough.

Now it’s clear that I can make this change.

How can i use this for my project www.emiratesevisaonline.com

Hi HubSpot Developers :slightly_smiling_face:,

I have a similar problem as others when using a method from the V1 version:

https://api.hubapi.com/integrations/v1/limit/daily

Even though the Private App that we created was allowing the access to every scope.

The message error is the following: “The scope needed for this API call isn’t available for public use. If you have questions, contact support or post in our developer forum.”

Thanks for your time!

Hi,

Can the access token of Private App be rotated by manual interaction only?

Does it have refresh token to regenerate token?

Many thanks!

Hi,

I have migrated our serverless functions over to using a private app by including the Authorisation header and have updated the Hubspot Client Library calls to include the access token of the new private app.

What i don’t know how to do is change the call made by HubL functions within our HTML, for example:

{% set contacts = crm_associations(propertyID, “USER_DEFINED”, ASSOCIATION_TYPE_CONTACT_TO_COMAPNY, “”,“phone,firstname,lastname,email,ownership_status,customer_services_owner”) %}

When I check the logs I see traffic coming in using the old API key, where is the authorisastion for this function set?

Regards,

Jordan

How do HubL calls authenticate? I have changed our severless functions to use the authorisation header with the access code from our private app and i have changed our calls that use the client libraries to use the access code also.

I cannot find out how to change the authorization method of my HubL calls present in our dynamic pages. I can see from the API logs that the HubL calls continue to use the old API key.