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 v2 API without paying any additional API fee.
Ahrefs also has a new v3 API, but unfortunately that one is only available for their Enterprise customers.
- Before You Begin
- Part 1: Connect to the Ahrefs API
- Part 2: Pull Data from Ahrefs to Sheets
- Part 3: Create a Custom API Request
- Part 4: API Documentation
- Appendix: Connect to the Ahrefs v3 API (Enterprise only)
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Connect to the Ahrefs API
The easiest way to get started with the Ahrefs API is through API Connector’s built-in integration.
- In Sheets, open API Connector and create a new request (Extensions > API Connector > Open > Create request)
- Select Ahrefs from the drop-down list of applications
- Under Authorization, click Connect to Ahrefs
- You will see a modal asking you to approve the connection. Click Allow.
- You'll then be returned to your Google Sheet, and can verify that your Ahrefs connection is now active.
Part 2: Pull Data from Ahrefs to Sheets
Now that we're connected, let's pull some data into Sheets.
- There's only one endpoint for Ahrefs so skip straight to Request parameters. Choose the table from which you'd like to retrieve data. For this example, we'll choose
- Fill out the other required parameters (mode and target). For this example we'll set mode as
domainand target as
ahrefs.com, but you can use your own values.
- Set a destination sheet, name your request, and click Run to see response data in your sheet.
- Now select any other "from" table of interest and adjust parameters to get different data sets. You can pull in any of the data you see while logged into Ahrefs.
Part 3: Create a Custom API Request
Alternatively, you can run your own custom API requests instead of using API Connector’s pre-built integration, using any of the URLs shown in the API documentation. To create a custom request, open API Connector, add the complete URL into the request URL field and select Ahrefs from the OAuth menu. Here's an example request setup:
- Request URL:
Part 4: API Documentation
Official v2 API documentation: https://ahrefs.com/api/documentation
Appendix: Connect to the v3 API (Enterprise only)
Ahref's newest v3 API was released in September, 2022 and has a lot of really nice features. However, unlike their v2 API, it's only* available for users on Ahref's Enterprise plan. If that's you, here's how to connect and run a request.
ahrefs.com. More info >
- Log into Ahrefs and click Account Settings > API keys > Generate API key
- You'll see a key, copy it and keep it handy as we'll insert it into a request header (details shown in the next step).
- Create an API request using any endpoint of interest from Ahref's v3 documentation. Open API Connector, and enter that request like this:
- Request URL:
Bearer 1234567(insert your own API key where it says 1234567)
- Save and Run the request to see response data from Ahref's v3 API in your Sheet.