Print

Import GoHighLevel Data to Google Sheets

In this guide, we’ll walk through how to pull data from the GoHighLevel API directly into Google Sheets, using the API Connector add-on.

GoHighLevel has recently introduced a new OAuth-based API, so there are currently 2 ways to connect:

  • API token. Tokens are used for the v1 API, which will be deprecated on June 1, 2024.
  • OAuth. The v2 API only supports authorization via OAuth.

Contents

Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: GoHighLevel's V1 API

1) Get Your GoHighLevel v1 API Token

  1. Log in to GoHighLevel and click Settings from the menu.
    gohighlevel-key
  2. Scroll down the page and you'll see that an API token has been automatically created for you. Click to copy it to your clipboard. Congrats, you can now access the GoHighLevel API!

2) Pull GoHighLevel v1 API Data into Sheets

For this example, we'll fetch contacts, though you can select any endpoint provided in the v1 documentation. Where it says your_token, substitute in the token you got from your company settings page.

  1. Open up Google Sheets and click Extensions > API Connector > Open > Create request.
  2. In the request form enter the following:
    • ApplicationCustom
    • MethodGET
    • Request URLhttp://rest.gohighlevel.com/v1/contacts?limit=100
    • Headers:
      • AuthorizationBearer your_token
  3. Create a new tab and click Set current to use that tab as your data destination.
  4. Name your request and click Run. A moment later you’ll see your contacts populate your Google Sheet.
    gohighlevel-response

Part 2: GoHighLevel's v2 API

The GoHighLevel v2 API uses OAuth, so we'll use API Connector's custom OAuth connection manager.

1) Create a GoHighLevel v2 App

  1. Navigate to https://developers.gohighlevel.com/, create an account, and log in
  2. Once you're logged in, click on App Dashboard > +Create App from the top nav
    gohighlevel-createapp
  3. Fill in your app details and click Create App. Selecting a "Private" app means you don't need to upload brand-related images or go through their approval process.
    gohighlevel-appdetails
  4. From the Settings screen, add all the scopes you'd like to have access to
    gohighlevel-scopes
  5. Scroll down to the "Redirect URL" section and type in API Connector's redirect URL as provided here.
    gohighlevel-redirecturl
  6. Under Client Keys, click +Add
    gohighlevel-keys
  7. You'll be prompted to give your key a name (it can be anything). You'll then be presented with your client ID and key. Keep these safe as we'll need them shortly.
    gohighlevel-credentials
  8. Scroll to the bottom of the page and click Save before navigating away.

2) Connect GoHighLevel v2 to API Connector

  1. Open up Google Sheets and click Extensions > API Connector > Manage Connections
  2. Scroll to the bottom of the sidebar and click Add Custom OAuth
  3. Fill in the Custom OAuth modal as follows, substituting in your own scopes:
    • OAuth Grant TypeAuthorization Code
    • NameCustom HighLevel
    • Authorization Base URLhttps://marketplace.leadconnectorhq.com/oauth/chooselocation?scope=contacts.readonly locations.readonly calendars.readonly campaigns.readonly contacts.readonly locations.readonly products.readonly users.readonly
    • Token URLhttps://services.leadconnectorhq.com/oauth/token
    • Client IDprovided by GoHighLevel
    • Client Secretprovided by GoHighLevel
  4. Click Save
    gohighlevel-customoauth
  5. Click Manage Connections to return to the list of connections
  6. Scroll down until you find your new custom connection. Click Connect
    gohighlevel-customconnect
  7. You'll be prompted to give access to the new app you created above. Click on the account with which you'd like to log in (*note: in my tests, I was only able to log into the Sub-Account, as clicking on the Agency entry returned "You do not have access to this feature! Please contact the admin!")
    gohighlevel-subaccount
  8. You'll be logged in, and can return to your sheet to verify that the new connection is now active.

3) Pull GoHighLevel v2 API Data into Sheets

For this request we'll get a list of your contacts, though you can select any endpoint shown in the v2 documentation. This request (and most others) requires your location ID as a parameter. You can get your location ID by navigating to Settings > Business Profile > Location ID, or by simply checking the URL bar while logged into GoHighLevel:
gohighlevel-locationId

Now set up the request like this:

  • ApplicationCustom
  • MethodGET
  • Request URLhttps://services.leadconnectorhq.com/contacts/?limit=100&locationId=your_location_id
  • OAuth: custom HighLevel
  • Headers
    • Key = Version, Value = 2021-07-28

Part 3: Handle Pagination

  • Note GoHighLevel's limits on the number of records returned on a response. By default, only 20 records will be returned unless you set the limit parameter to 100. Then, if you need more than 100 records, use the startAfter and startAfterId parameters as described in their documentation.
    gohighlevel-pagination-docs

  • With API Connector you can loop through each page of results automatically with pagination handling, like this:
    • Pagination type: next page URL
    • Next page path: meta.nextPageUrl
    • Run until: choose when to stop fetching data
      gohighlevel-pagination-nextpageurl

Part 4: API Documentation

Official v1 API documentation: https://public-api.gohighlevel.com/

Official v2 API documentation: https://highlevel.stoplight.io/docs/integrations/0443d7d1a4bd0-overview

Leave a Comment

Jump To