---
title: "Finish signing the current user in to HubSpot"
method: POST
path: "/api/integration/hubspot/user/access-token"
tags: ["User"]
---

# Finish signing the current user in to HubSpot

`POST /api/integration/hubspot/user/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/user/access-token`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/sponsorunited/apis/sponsorunited-api/docs/api/integration/hubspot/user/access-token/post.ts> (a function with typed inputs; its response is checked against the schema)

Exchanges the authorization code HubSpot redirected back with, checks the user signed in to the HubSpot account their organization connected, finds their HubSpot owner by their HubSpot email (preferring the owner with their HubSpot user id), and stores the user's tokens and owner. Answers the user's HubSpot settings. Requires integration-hubspot and a connected portal.

## 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 current user's HubSpot settings, with hubspot_connected true.

- UserHubspotIntegrationResource: Whether the user's organization has HubSpot connected, whether HubSpot export is available to this user, whether the user has signed in to HubSpot themselves, and whether the organization's connection needs to be set up again. Never carries the access or refresh token.
  - `connected` boolean: True when the user's organization has a connected portal whose token is still valid, whatever the user's permissions
  - `has_set_hubspot_integration` boolean: True when the user's organization has a connected portal whose token is still valid and the user holds the HubSpot integration permission
  - `hubspot_connected` boolean: True when the user has signed in to their organization's connected HubSpot account themselves, so their exports can use their own sign-in and set them as Contact Owner. False means the next HubSpot export should ask them to sign in.
  - `token_invalid_at` string, date-time, nullable: Set when the connection needs to be set up again

## Other responses

- `400`: The user could not be signed in, for example because they signed in to a different HubSpot account than the one their organization connected.
- `403`: Forbidden - missing integration-hubspot or no connected portal.

---

[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)
