Exposing REST endpoints

Hi,

I am trying to access and manipulate some of my HubSpot data from my existing spring boot app. How do I expose this data via REST-like interface.

As far as I understand I need to create an app. I have done that but cannot figure out how to authenticate my requests to that app from outside hubspot.

I am really sorry for the simple question, but I cannot seem to figure this out on my own and most of the documentation still points to the legacy apps that I cannot create anymore.

Hey @LP11,

Welcome to the HubSpot Community!

I see that you’re looking into creating a private app, but are having trouble authenticating your requests. To start, I suggest checking out our dev doc on ‘authentication’ as this may point you in the right direction! Authentication overview - HubSpot docs
I’d also like to tag in some of our Top Contributors to see if they have any tips and tricks on getting started

@GRajput, @SteveHTM, @MichaelMa

Do you have any suggestions for @LP11?

Thank you!

Sam, Community Manager

@LP11 - The basic mechanism you are looking for is introduced in the API documentation - quite a lot of detail to plough through but it should be possible to start at: Understanding the CRM APIs - HubSpot docs

The fundamental authenticapyion mechanism is the use of a token in the API header. Although HubSpot has chose to label Private apps as ‘Legacy’ ther is no real other mechanism to get access to such tokens and manage their scope (essentially permissions). So I would go ahead and create a new app in your portal, copy the token value and use the terrific ‘Try it’ mechanisms in the API documentation to experiment with what is visible rthough each set of calls.

I hope this is helpful.

Steve

Hi @LP11

“Here are the simple steps you should follow ;
Create a Private App (if single account),Use its Bearer access token, Call HubSpot’s public REST APIs from Spring Boot, You don’t authenticate to the app, you authenticate as the app.
adn thats how you can access HubSpot data.”

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.

Thanks!

Hey @LP11

No need to apologize, the HubSpot docs can be confusing especially with the “legacy” labeling on Private Apps. @SteveHTM and @GRajput gave you the right direction.

Quick clarification: you dont actually expose REST endpoints from HubSpot. Instead, HubSpot already has REST APIs that you call into from your Spring Boot app. Your app authenticates to HubSpot’s APIs, not the other way around.

For a Spring Boot backend talking to a single HubSpot portal, Private Apps are exactly what you want despite the “legacy” label. The flow is:

  1. Create a Private App in Settings > Integrations > Private Apps
  2. Select the scopes (permissions) you need, like crm.objects.contacts.read or crm.objects.contacts.write
  3. Copy the access token it generates
  4. Use that token in your Spring Boot app as a Bearer token in the Authorization header

Your Java code would look something like:

HttpHeaders headers = new HttpHeaders();
headers.setBearerAuth("your-private-app-token");

Then hit endpoints like https://api.hubapi.com/crm/v3/objects/contacts

(Accounts Dashboard | HubSpot).

One thing to watch out for, HubSpot has API rate limits (100 requests per 10 seconds for Private Apps) so if you’re doing heavy reads or writes, you’ll need to handle throttling.

If your goal is to keep your Spring Boot database continuously in sync with HubSpot rather than making API calls on demand, thats a different architecture. At Stacksync we handle that exact pattern, keeping databases and HubSpot synchronized bidirectionally without building custom API plumbing. Might be worth considering depending on your use case. Transparency note: This response is grounded in my own experience and was lightly polished using AI.

Hope that clears things up!

Thanks a lot for the detailed explanation and the throtteling hint. I have my first calls working now! :slightly_smiling_face: