Setup Guide
This guide walks you through creating a HubSpot Private App and obtaining the access token required to use the HubSpot CRM Schemas connector.
Prerequisites
- A HubSpot account with permission to create and manage custom objects. If you do not have one, sign up for a free HubSpot account.
Create a HubSpot private app
- Log in to your HubSpot account.
- Click the Settings (gear) icon in the top navigation bar.
- In the left sidebar, navigate to Integrations → Private Apps.
- Click Create a private app.
- Under the Basic Info tab, enter a name (e.g.,
Ballerina Schemas Connector) and an optional description for your app.
Configure scopes
- Click the Scopes tab.
- Search for and select the following scopes required by the Schemas API:
crm.schemas.custom.read: read custom object schemascrm.schemas.custom.write: create, update, and delete custom object schemas
- Add any additional scopes your integration requires.
Grant only the minimum scopes your integration needs. You can edit scopes later, but doing so invalidates the existing access token and requires you to generate a new one.
Create the app and copy the access token
- Click Create app (top right). Review the scopes summary and confirm by clicking Continue creating.
- After the app is created, HubSpot displays your Access token on the app detail page.
- Click Show token and copy the value. This is the Bearer token you will use to authenticate the connector.
The access token is shown only once immediately after creation. Store it securely in a secrets manager or Ballerina's Config.toml. Do not commit it to source control.
Obtain OAuth 2.0 credentials (alternative)
If you prefer OAuth 2.0 with a refresh token instead of a static access token:
-
In your HubSpot developer account, navigate to Apps and create a public app to obtain a Client ID and Client Secret.
-
Implement the OAuth 2.0 Authorization Code flow to obtain an authorization code, then exchange it for an access token and refresh token using the HubSpot token endpoint:
POST https://api.hubapi.com/oauth/v1/token
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
&code=<AUTHORIZATION_CODE>
&client_id=<YOUR_CLIENT_ID>
&client_secret=<YOUR_CLIENT_SECRET>
&redirect_uri=<YOUR_REDIRECT_URI> -
Copy the
refresh_tokenfrom the response for use in the connector'sOAuth2RefreshTokenGrantConfig.
The HubSpot token refresh endpoint used by this connector is https://api.hubapi.com/oauth/v1/token.
Next steps
- Actions Reference - Available operations