OAuth Flow
- Generate URL - Call this endpoint with your
stateandredirect_url - Redirect User - Redirect the user to the generated URL
- User Authorizes - User grants permissions on Google’s consent screen
- Callback - User is redirected back to your
redirect_urlwith authorization results
Scopes Included
The generated OAuth URL requests the following permissions:userinfo.email- Access to user’s email addressuserinfo.profile- Access to user’s basic profile informationbusiness.manage- Manage Google Business Profile locations
Callback Query Parameters
After the OAuth flow completes, the user will be redirected to your specifiedredirect_url with the following query parameters:
Success Callback
When authorization is successful, your callback URL will receive:uid- User identifier (null for external API)googleId- Google user IDbilling_id- Organization IDtoken_refreshed- Whether a refresh token was obtainedexternal_api- Always true for external API callsstate- The original state parameter
Error Callbacks
If there’s an error during the OAuth flow, your callback URL will receive anerror parameter:
User Denied Access
Invalid State
Invalid Grant/Scope
business.manage) was not granted by the user.
General OAuth Error
Connect Account Endpoint
After receiving the OAuth callback with the authorization parameters, you need to call the connect account endpoint to complete the account connection process. This endpoint processes the authorization and creates the Google Business Profile account connection.Endpoint
Query Parameters
uid(string) - User identifiergoogleId(string) - Google user ID from the OAuth callbackid(string) - Account identifierbilling_id(string) - Organization/billing IDexternal_api(boolean) - Must betruefor external API callsstate(string) - The state parameter from your OAuth flow
External API Response Format
Whenexternal_api=true, the endpoint returns a JSON object with a redirect URL instead of the standard response:
Success Response
When the account is successfully connected, the returned URL contains:status- Alwayssuccessfor successful connectionsgmb_profile_id- The Google Business Profile account IDbusiness_name- The name of the connected business (URL encoded)state- The original state parameter from your OAuth flow
Error Responses
When an error occurs during account connection, the returned URL contains error details:status- Alwayserrorfor failed connectionserror_message- A description of the error (URL encoded)state- The original state parameter from your OAuth flow
Specific Error Messages
ACCOUNT_ALREADY_CONNECTEDerror_message parameter.
Example Flow
- User completes OAuth authorization and is redirected to your callback URL with authorization parameters
- Your application calls
POST /connect/accountwith all required parameters, includingexternal_api=true - If successful, redirect the user to the
urlprovided in the response (contains success status and profile details) - If an error occurs, redirect the user to the
urlprovided in the response (contains error status and message)
Disconnect Account Endpoint
The disconnect account endpoint allows you to remove a connected Google Business Profile account from your organization. This will disconnect the account, remove all associated data, and update subscription billing accordingly.Endpoint
Query Parameters
uid(string) - User identifiergoogleId(string) - Google user ID of the account to disconnectid(string) - Account identifier (GMB profile ID)external_api(boolean) - Must betruefor external API callsstate(string) - The state parameter from your OAuth flow
External API Response Format
Whenexternal_api=true, the endpoint returns a JSON object with a redirect URL:
Success Response
When the account is successfully disconnected, the returned URL contains:status- Alwayssuccess_disconnectfor successful disconnectionsstate- The original state parameter from your OAuth flowaccount_id- The ID of the disconnected account
What Happens on Disconnect
When an account is disconnected, the following actions are performed:- The business account is removed from the user’s account
- The Google account access tokens are removed
- The account is removed from the billing/organization
- If there’s an active subscription, it’s updated to reflect the new number of locations (excluding the disconnected account)
Example Flow
- Your application calls
DELETE /disconnect/accountwith the account details andexternal_api=true - The account is disconnected and all associated data is removed
- Redirect the user to the
urlprovided in the response (contains success status and account ID)
Reconnect Account Endpoint
The reconnect account endpoint allows you to refresh and update the connection for an existing Google Business Profile account. This is useful when access tokens have expired or need to be refreshed. The endpoint updates the access tokens and triggers a data export.Endpoint
Query Parameters
uid(string) - User identifiergoogleId(string) - Google user ID of the account to reconnectid(string) - Account identifier (GMB profile ID)external_api(boolean) - Must betruefor external API callsstate(string) - The state parameter from your OAuth flow
External API Response Format
Whenexternal_api=true, the endpoint returns a JSON object with a redirect URL instead of the standard response:
Success Response
When the account is successfully reconnected, the returned URL contains:status- Alwayssuccess_reconnectfor successful reconnectionsstate- The original state parameter from your OAuth flowaccount_id- The ID of the reconnected account
Error Responses
When an error occurs during account reconnection, the returned URL contains error details:status- Alwayserrorfor failed reconnectionserror_message- A description of the error (URL encoded)state- The original state parameter from your OAuth flow
Common Error Scenarios
NotFoundException The account or refresh token was not found. This typically occurs when:- The account ID does not exist
- The refresh token is missing or invalid
- The Google user ID does not match an existing account
error_message parameter. These may include token refresh failures or API communication errors.
What Happens on Reconnect
When an account is reconnected, the following actions are performed:- The refresh token is retrieved for the Google account
- The account access token is updated with the new refresh token
- The business account reconnect information is updated
- A data export is triggered for the account
Example Flow
- Your application calls
POST /reconnect/accountwith the account details andexternal_api=true - The account access tokens are refreshed and updated
- If successful, redirect the user to the
urlprovided in the response (contains success status and account ID) - If an error occurs, redirect the user to the
urlprovided in the response (contains error status and message)
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
OAuth URL generation parameters