Skip to main content
POST
/
oauth
/
v1
/
token
Get or refresh OAuth 2.0 tokens
curl --request POST \
  --url https://api.hubapi.com/oauth/v1/token \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data grant_type=authorization_code \
  --data 'client_id=<string>' \
  --data 'client_secret=<string>' \
  --data 'redirect_uri=<string>' \
  --data 'code=<string>'
{
  "access_token": "<string>",
  "refresh_token": "<string>",
  "expires_in": 123
}

Body

application/x-www-form-urlencoded
grant_type
enum<string>
required

The grant type of the request, must be authorization_code for the initial request to get the access and refresh tokens.

Available options:
authorization_code
client_id
string
required

The Client ID of your app.

client_secret
string
required

The Client Secret of your app.

redirect_uri
string
required

The redirect URI that was used when the user authorized your app. This must exactly match the redirect_uri used when initiating the OAuth 2.0 connection.

code
string
required

The code parameter returned to your redirect URI when the user authorized your app.

Response

Tokens retrieved successfully

access_token
string
required

The access token

refresh_token
string
required

The refresh token

expires_in
integer
required

Number of seconds until the access token expires