Search API Connector Documentation


Import Ahrefs Data to Google Sheets


In this guide, I’ll get you started on pulling data from the awesome Ahrefs SEO tool suite into Google Sheets, using the API Connector add-on for Sheets. Targeted around backlinks, you can use the Site Explorer, Content Explorer, Keywords Explorer, Rank Tracker, and Site Audit to compare your website to competitors. All in all, it’s a pretty sweet tool and we can integrate its native API with Google Sheets!

Note: You need an account with Ahrefs to use this integration, and Ahrefs is not a free tool. However, through this integration, you can access their API without paying their additional API fee ($500+ a month, as shown here).


Before You Begin

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

Part 1: Connect to the Ahrefs API

If you haven’t connected to the Ahrefs API before, you’ll first need to initiate the connection.

  1. Open up Google Sheets and click Extensions > API Connector > Manage Connections.
  2. In the list of available connections, find Ahrefs and click Connect.
  3. You will see a modal asking you to approve the connection. Click Allow.
  4. You’ll then be returned to your Google Sheet, and can verify that your Ahrefs connection is active in the Connections screen.

Part 2: Create Your Ahrefs API Request URL

Ahrefs is nice enough to avoid a lot of the headache of piecing together an API request URL by providing us with this API request builder tool. You can access it by clicking “API Request Builder” in the left sidebar.

From here, it’s super easy! Under Target, enter the website you’re interested in, then choose which data you want to get in the Mode and From drop-downs. Set your Limit and any Options, and copy the API URL Request that gets printed out below. Just remove the API token since we’ll include that automatically through the OAuth connection.


Part 3: Pull Ahrefs API Data into Sheets

We can now enter these values into API Connector and grab that data.

  1. Open up Google Sheets and click Extensions > API Connector > Open.
  2. In the Create Request tab, enter the Request URL we just created
  3. Under OAuth2 Authentication, choose Ahrefs from the dropdown menu.
  4. Leave the Headers section empty as we don’t need them for this request
  5. Create a new tab and click Set current to use that tab as your data destination.
  6. Name your request and click Run. A moment later you’ll see some Ahrefs data populate your spreadsheet:

Part 4: More Example API URLs

Check the documentation for the full list of endpoints, but here a few other example endpoints that may be useful:

  • Top 10 backlinks:
  • Top 10 referring domains ordered by Domain Rating:
  • New backlinks on 2021-08-20"new",date:"2021-08-20"&mode=domain&output=json

Part 5: API Documentation

Official API documentation:

API request builder tool:

Previous Import AfterShip Data to Google Sheets
Next Import Airtable Data to Google Sheets

10 thoughts on “Import Ahrefs Data to Google Sheets”

  1. Hi there

    Does this works as integration app? Ahrefs offers API and integration as 2 separate things for some reason. Even the premium plan doesnt offer direct API access however you can connect your Ahrefs account with some existing App to get the required data. Will this work with an account or do you need API?

  2. Hi Ana,

    when im using the sidebar this works perfect! But im trying to use importAPI with this and im getting this error:
    “Request failed: Access not granted or expired. Please click Manage Connections and check OAuth2 connection status.”

  3. You mention that I can grab Keywords in your intro. What ‘From’ do I need to set in order to grab my saved keywords data for a specific domain?


Leave a Comment

Table of Contents