canonical: https://jentic.com/apis/hubapi.com/hubspot-auth-api

# HubSpot OAuth API

Jentic publishes the only available OpenAPI specification for HubSpot OAuth API, keeping it validated and agent-ready. This API exposes the token endpoints behind HubSpot's OAuth 2.0 flow - exchanging an authorization code or refresh token for an access token, inspecting an existing access or refresh token, and revoking a refresh token. It is the integration surface for any app that connects HubSpot accounts via OAuth instead of static keys.

## For AI agents

Exchange, inspect, and revoke HubSpot OAuth access and refresh tokens for installed apps.

## Scope

Does not authenticate end users into the HubSpot UI, manage SSO, or call CRM data - use only for HubSpot OAuth token exchange, inspection, and revocation.

## Capabilities

- Exchange an authorization code or refresh token for an access token via POST /oauth/v1/token
- Inspect an access token's scopes, hub ID, and user via GET /oauth/v1/access-tokens/{token}
- Look up a refresh token's account and expiry via GET /oauth/v1/refresh-tokens/{token}
- Revoke a refresh token via DELETE /oauth/v1/refresh-tokens/{token}
- Build the install + refresh + revoke lifecycle for HubSpot apps

## Use cases

### Complete the HubSpot App Install OAuth Flow

After a user authorises a HubSpot app, exchange the authorization code at POST /oauth/v1/token to receive an access token and refresh token bound to their HubSpot account. The refresh token can then be stored to refresh access tokens on demand without re-prompting the user.

Example prompt: POST to /oauth/v1/token with grant_type=authorization_code, the client ID, secret, redirect URI, and code; store the returned refresh_token securely.

### Refresh Expired Access Tokens

HubSpot access tokens are short-lived. Use POST /oauth/v1/token with grant_type=refresh_token to mint a fresh access token from the stored refresh token, keeping the integration online without prompting the user again.

Example prompt: POST to /oauth/v1/token with grant_type=refresh_token and the stored refresh_token to mint a new access_token.

### Revoke Tokens on Uninstall

When a user uninstalls the app or revokes consent, call DELETE /oauth/v1/refresh-tokens/{token} to invalidate the refresh token cleanly. This prevents the integration from continuing to mint access tokens after consent has been withdrawn.

Example prompt: DELETE /oauth/v1/refresh-tokens/{token} as part of the uninstall webhook handler so the token is invalidated immediately.

### AI Agent OAuth Automation via Jentic

An AI agent provisioning HubSpot integrations on a customer's behalf can use Jentic to drive the token exchange and refresh endpoints, keeping the OAuth client secret in your Jentic One instance and out of agent context.

Example prompt: Search Jentic for exchange a hubspot authorization code, load POST /oauth/v1/token, and execute with the stored client credentials and the user's code.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /oauth/v1/token | Exchange an authorization code or refresh token for an access token |
| GET | /oauth/v1/access-tokens/{token} | Inspect an access token |
| GET | /oauth/v1/refresh-tokens/{token} | Inspect a refresh token |
| DELETE | /oauth/v1/refresh-tokens/{token} | Revoke a refresh token |

## Key resources

- **Tokens** — Exchange authorization codes and refresh tokens for access tokens
- **Access Tokens** — Inspect access tokens for scopes, hub ID, and user
- **Refresh Tokens** — Inspect or revoke refresh tokens

## Why Jentic

- **Setup:** Wiring the HubSpot OAuth API by hand means running the token exchange yourself, holding the client id and secret, and tracking access and refresh tokens across the api.hubapi.com host. Through Jentic you install once, import the HubSpot OAuth API from the API Directory, store the client credentials once, and your agent calls it.
- **Permission scoping:** This API covers token exchange, inspection, and revocation, so limit the agent to the operations it needs, such as exchanging an authorization code or inspecting an access token. You choose that set, so revoking a refresh token with DELETE /oauth/v1/refresh-tokens/{token} is not included unless you add it.
- **Credential handling:** Your HubSpot OAuth client id and secret are stored once, encrypted, by your own Jentic One instance and injected at execution time. They never enter the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'exchange a hubspot authorization code' or 'refresh a hubspot access token', and Jentic returns the matching /oauth/v1 operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **HubSpot CRM API** — The CRM API that the freshly-minted access tokens authorise calls against
- **Auth0** — Identity provider that can broker HubSpot OAuth alongside many other connections
- **Okta** — Enterprise IdP that integrates HubSpot logins via SAML or OAuth

## FAQ

### Why is there no official OpenAPI spec for HubSpot OAuth?

HubSpot does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call HubSpot OAuth via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the HubSpot OAuth API itself require?

POST /oauth/v1/token uses the OAuth client_id and client_secret of your HubSpot app rather than a bearer token. The token-inspection and revocation endpoints take the token in the URL path and are protected by knowledge of the token itself. Through Jentic, the client secret is held in the encrypted vault.

### Can I refresh a HubSpot access token without prompting the user?

Yes. POST to /oauth/v1/token with grant_type=refresh_token and the stored refresh_token. HubSpot returns a new short-lived access_token without requiring a new user consent.

### What are the rate limits for the HubSpot OAuth API?

OAuth endpoints share HubSpot's standard rate limits but are typically called only on install, refresh, and revoke - well below per-hapikey ceilings. Cache access tokens until they near expiry to keep the call rate low.

### How do I revoke a refresh token through Jentic?

Search Jentic for revoke a hubspot refresh token, load DELETE /oauth/v1/refresh-tokens/{token}, and execute with the token to invalidate. Jentic injects the OAuth client credentials from the vault.

### How can I tell which HubSpot account a token belongs to?

GET /oauth/v1/access-tokens/{token} returns the hub ID, user, and scopes attached to the access token. GET /oauth/v1/refresh-tokens/{token} returns equivalent metadata for refresh tokens.

### Can I limit what my agent is allowed to do with the HubSpot OAuth API?

Yes. Because you run Jentic One yourself, you decide which of this API's operations your agent may call, so you can grant only token exchange via POST /oauth/v1/token and inspection via GET /oauth/v1/access-tokens/{token} while withholding others. Revoking a refresh token with DELETE /oauth/v1/refresh-tokens/{token} is not available to the agent unless you add it to the allowed set. Your HubSpot OAuth client id and secret stay stored by your own instance and are injected only at execution time, never in the agent's context.
