API Reference version 2

Generate token

POST/v2/oauth/token

Gets an OAuth token for requested grant type. Grant types supported:

  • personal
  • client_credentials
  • password
  • refresh_token
  • authorization_code

Form parameters

Type Parameter Description Required?
string username

The user name to generate a token on behalf of. Only valid in the 'password' and 'client_credentials' grants.

string grant_type

The type of grant request.

Valid values: authorization_code, refresh_token, password, client_credentials, personal, room_notification.

Required
string user_id

The id of the user the token is acting on behalf of. Only valid in the 'authorization_code' and 'refresh_token' grants.

string code

The authorization code to exchange for an access token. Only valid in the 'authorization_code' grant.

string client_name

The name of the public oauth client retrieving a token for. Only valid in the 'authorization_code' and 'refresh_token' grants.

string redirect_uri

The URL that was used to generate an authorization code, and it must match that value. Only valid in the 'authorization_code' grant.

string scope

A space-delimited list of scopes that is requested.

string password

The user's password to use for authentication when creating a token. Only valid in the 'password' grant.

string group_id

The name of the group to which the related user belongs. Only valid in the 'authorization_code' and 'refresh_token' grants.

string refresh_token

The refresh token to use to generate a new access token. Only valid in the 'refresh_token' grant.

200 application/json
Type Property Description Required?
string access_token

The generated access token to use to authenticate future requests.

Required
integer expires_in

The number of seconds this token will be valid for.

Required
string group_name

The HipChat group name this token belongs to

Required
string token_type

The type of token returned. Always 'bearer'.

Defaults to 'bearer'.

Required
string scope

A space-delimited list of scopes that this token is allowed to use.

Required
integer group_id

The HipChat group ID this token belongs to

Required
string refresh_token

The generated refresh token to use when requesting new access tokens.