# B2B Integration

**URL:** <https://community.hubspot.com/t/b2b-integration/12027>\
**Category:** APIs & Integrations\
**Created:** [January 29, 2017, 10:29am UTC](https://community.hubspot.com/t/b2b-integration/12027 "2017-01-29T10:29:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [January 29, 2017, 10:29am UTC](https://community.hubspot.com/t/b2b-integration/12027/1 "2017-01-29T10:29:17Z")

</div>

Hi,

I’m new to HubSpot and managed to workout the API - wow  
 ![slightly_smiling_face.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/2/42c4d129a1c6aa74d89f3066ee8fbb15db46b3b5.png)  
But there is something I don’t get.

To get the access code, you need [https://app.hubspot.com/oauth/authorize](https://app.hubspot.com/oauth/authorize) you are redirected to a page and need to select a GUID (code) for the next call to get the OAuth? So far so good but then this code cannot be reused and the next call [https://api.hubapi.com/oauth/v1/token](https://api.hubapi.com/oauth/v1/token) has an expiry on the access token. I can’t see how, having to select and grant permission as a user in a browser, will work with an automated batch process that wants to update hubspot.

What am I doing wrong? Is there another way? Maybe by IP address or permanent token?

Yoram

---

<div class="post-metadata">

**Author:** ![Dadams](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dadams/32/21752_2.png) [@Dadams](https://community.hubspot.com/u/Dadams)\
**Post date:** [January 30, 2017, 3:44pm UTC](https://community.hubspot.com/t/b2b-integration/12027/2 "2017-01-30T15:44:54Z")

</div>

Hi [@yoram](https://community.hubspot.com/u/yoram)

When you use the code to get your first access token, you’ll also get a refresh token. That refresh token can be used to generate a new access token whenever the existing access token expires.  
 [developers.hubspot.com](https://developers.hubspot.com/docs/methods/oauth2/refresh-access-token)

### [Refresh OAuth 2.0 Access Token](https://developers.hubspot.com/docs/methods/oauth2/refresh-access-token)

POST /oauth/v1/token
