---
title: "Finish connecting a HubSpot portal"
method: POST
path: "/api/integration/hubspot/access-token"
tags: ["User"]
---

# Finish connecting a HubSpot portal

`POST /api/integration/hubspot/access-token`

## Request

- Base URL: `https://api.sponsorunited.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.sponsorunited.com/api/integration/hubspot/access-token`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/sponsorunited/apis/sponsorunited-api/docs/api/integration/hubspot/access-token/post.ts> (a function with typed inputs; its response is checked against the schema)

Exchanges the authorization code HubSpot redirected back with, stores the organization's tokens and answers the connected portal. Requires integration-hubspot and account-administrator.

## Request body

- HubspotAccessTokenRequest
  - `code` string, required: The authorization code HubSpot sent to the redirect URI
  - `state` string, required: The state HubSpot sent back, as issued by the authorize-url endpoint

## Response `200`

The connected HubSpot portal.

- HubspotConnectionResource
  - `portal_id` integer, nullable
  - `portal_domain` string, nullable
  - `granted_scopes` string[]
  - `token_expires_at` string, date-time, nullable

## Other responses

- `400`: The portal could not be connected.
- `403`: Forbidden - missing the HubSpot integration permissions.

---

[API](https://skmtc.dev/sponsorunited/apis/sponsorunited-api.md) - [All operations](https://skmtc.dev/sponsorunited/apis/sponsorunited-api/llms.txt) - [OpenAPI document](https://skmtc.dev/sponsorunited/apis/sponsorunited-api/revisions/cbf1ca5bff8f?raw)
