APIs & Integrations

StewartM82
Member

Server to Server Deals API integration

My company is building a design platform that is looking to integrate with hubspot. We already create new users via the forms API and that integration is working well. We would like to take the next step and start creating deals on hubspot. For our platform each design that a user creates represents a sales opportunity and thus should have a deal in hubspot.

I'm confused about the use case for oAuth in hubspot. We wish to call the deals API directly from our server. Does this mean we somehow need to store an access token on our server? Before we perform a request to the deals api do we need to make sure the token is not expired? If our token has been invalided by hubspot do we need to refresh that token somehow and retry the request? Is there are more streamlined way for server to server communication?

0 Upvotes
2 Replies 2
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Server to Server Deals API integration

Hi @Stewart_Matheson,

In short; yes. When a user installs your app to their portal, they're actually completing the OAuth flow so that your integration can receive a refresh and an access token. You then uses these tokens to make authenticated requests to the HubSpot API; access tokens are used to authenticate requests, and the refresh token is used to generate new access tokens when they expire.

To start, I'd recommend reading up on the HubSpot OAuth system below:

OAuth 2.0 Overview

Overview for authentication using OAuth 2

0 Upvotes
StewartM82
Member

Server to Server Deals API integration

Tuns out that I could use an API key. Thanks for your help Derek.