Table of Contents

Stop exporting CSVs by hand. Here’s how to pull Ahrefs data into Google Sheets automatically in 2026 — with the current API, a scheduled refresh, and copy-paste code — plus the honest bit about cost.

Quick answer

To fetch Ahrefs reports into Google Sheets dynamically, use the Ahrefs API v3 (the v2 API was shut down on 1 November 2025) via one of two routes: a no-code connector (API Connector, Apipheny, Coupler.io, or Supermetrics) where you set a refresh schedule, or Google Apps Script that calls the API with an Authorization: Bearer header and runs on a time-driven trigger. “Dynamic” simply means it auto-refreshes on a schedule. One caveat to plan for: Ahrefs API access is a separate paid subscription priced by rows, so it isn’t free even though the tools around it can be.

Read this first — it saves hours. Ahrefs API v2 was fully discontinued on 1 November 2025, along with the old Integrations program. Any guide you find that uses apiv2.ahrefs.com or a token= URL parameter is dead. Everything below uses API v3 (api.ahrefs.com/v3/… with a Bearer token), which is the only supported option now.

Pulling Ahrefs metrics — domain rating, backlinks, keywords, organic traffic — into a live Google Sheet is the backbone of good SEO reporting. Done right, your dashboards and client reports update themselves. Done from an outdated tutorial, you’ll spend an afternoon debugging an API that no longer exists. This guide covers the current, working approach, from prerequisites to scheduled automation.

What “dynamically” means here

Dynamic just means scheduled and automatic — the sheet refreshes on its own instead of you exporting a file each week. In Apps Script that’s a time-driven trigger; in a connector it’s the add-on’s built-in refresh schedule. Either way, you set it once and the data keeps itself current.

Before you start: prerequisites (and the cost reality)

  • An Ahrefs API v3 subscription. This is separate from a normal Ahrefs tool plan and is billed in tiers by the number of rows you pull (higher tiers include more rows and a lower per-row rate). Confirm current pricing on Ahrefs’ site — but assume the API is a real, ongoing cost, not a free add-on.
  • Your API key/token, generated from your Ahrefs API dashboard.
  • A Google account and the destination Sheet.
  • A method decision: no-code connector (fastest) or Apps Script (most control). Both are below.

Keep the official Ahrefs API v3 docs (docs.ahrefs.com) open in a tab — endpoints, parameters, and exact response field names live there, and they’re the source of truth if a field name in your code needs adjusting.

Method 1 — No-code connector (easiest)

Best if you don’t want to touch code. The steps are similar across API Connector (Mixed Analytics), Apipheny, Coupler.io, and Supermetrics:

  1. Install the add-onAdd your chosen connector from the Google Workspace Marketplace, then open it from Extensions in your Sheet.
  2. Authenticate to AhrefsEither pick Ahrefs from the connector’s app list and authorize it, or create a custom request and add your key as a header: Authorization: Bearer YOUR_API_KEY.
  3. Build the v3 requestPoint it at the endpoint you need, e.g. https://api.ahrefs.com/v3/site-explorer/domain-rating?target=example.com&date=2026-07-14. Swap in other endpoints (backlinks, keywords history, metrics) as required.
  4. Map the response to your sheetChoose the destination tab and cell; the connector flattens the JSON into rows and columns.
  5. Set the refresh scheduleTurn on automatic refresh (hourly/daily/weekly). That’s the “dynamic” part — done.

Note these connectors have their own subscription on top of your Ahrefs API cost, and some gate Ahrefs presets behind a paid tier — check before committing.

Method 2 — Google Apps Script (most control, free tool)

Best if you want full control, custom transformations, or to avoid a connector subscription. You only need a little JavaScript.

Step 1 — Store your key safely. In the Sheet, open Extensions → Apps Script. In the editor, go to Project Settings → Script Properties and add a property named AHREFS_API_KEY with your token as the value. (Never hard-code the key in the script.)

Step 2 — Add the fetch function. Paste this into Code.gs, adjusting the endpoint and field names to match the report you want (verify exact response keys in the v3 docs):

// Pulls a metric from Ahrefs API v3 and logs it to the sheet.
function fetchAhrefs() {
const apiKey = PropertiesService.getScriptProperties()
.getProperty(‘AHREFS_API_KEY’);
const target = ‘example.com’;
const today = Utilities.formatDate(new Date(), ‘UTC’, ‘yyyy-MM-dd’);

// Swap this endpoint for backlinks, keywords, metrics, etc.
const url = ‘https://api.ahrefs.com/v3/site-explorer/domain-rating’
+ ‘?target=’ + encodeURIComponent(target)
+ ‘&date=’ + today;

const options = {
method: ‘get’,
headers: {
‘Authorization’: ‘Bearer ‘ + apiKey,
‘Accept’: ‘application/json’
},
muteHttpExceptions: true
};

const res = UrlFetchApp.fetch(url, options);
if (res.getResponseCode() !== 200) {
Logger.log(‘Ahrefs error: ‘ + res.getContentText());
return;
}
const data = JSON.parse(res.getContentText());

// Adjust these keys to match the actual v3 response shape.
const dr = data.domain_rating && data.domain_rating.domain_rating;

const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheetByName(‘Ahrefs’) || ss.insertSheet(‘Ahrefs’);
sheet.appendRow([new Date(), target, dr]);
}

Step 3 — Run it once to authorize the script’s permissions and confirm a row lands in your sheet. Check View → Logs if anything errors.

Step 4 — Make it dynamic with a trigger. Either use the UI (Triggers → Add Trigger → choose fetchAhrefs → time-driven → day timer), or add this helper and run it once:

function createDailyTrigger() {
  ScriptApp.newTrigger('fetchAhrefs')
    .timeBased().everyDays(1).atHour(6).create();
}

Now the fetch runs automatically every morning and appends fresh data — a self-updating report.

Method 3 — Automation platforms

If Ahrefs data needs to flow into a bigger workflow (Slack alerts, a database, multiple destinations), platforms like Make, Pipedream, or Latenode can trigger on a schedule, call the Ahrefs API v3, and write to Google Sheets as one step in a chain. More power and more moving parts than a simple connector — worth it only when the workflow genuinely needs it.

Which method should you choose?

Method Best for Coding? Extra cost beyond Ahrefs API
No-code connectorFast setup, non-developers, standard reportsNoneConnector subscription
Google Apps ScriptFull control, custom logic, no add-on feesLight JSFree
Automation platformMulti-step workflows & multiple destinationsLow–mediumPlatform run/credit cost

Keep costs and errors under control

  • Pull only what you need. The API bills by rows — request specific metrics and date ranges, not everything.
  • Refresh sensibly. Daily or weekly is plenty for most reporting; hourly burns rows fast.
  • Cache history in the sheet and append new rows instead of re-pulling the full history each run.
  • Batch targets carefully and watch your plan’s included row allowance.
  • Handle failures — use muteHttpExceptions and check the response code so a bad call doesn’t corrupt your sheet.

Common pitfalls

  • Using the dead v2 API. The number-one cause of “why won’t this work” — old tutorials point at apiv2.ahrefs.com. Use v3.
  • Hard-coding the API key in the script instead of Script Properties — a security risk, especially in shared sheets.
  • Guessing response field names. They vary by endpoint; log the raw JSON once and map the exact keys from the v3 docs.
  • Assuming it’s free. The API subscription is the real cost; the connection method is the cheap part.

Getting the pull working is step one; turning that data into decisions is the real value. If you’re building an SEO reporting stack, the same discipline applies to your analytics — see tracking AI referral traffic in GA4 — and make sure you’re measuring outcomes, not vanity metrics, as we cover in common SEO mistakes businesses make. When you’d rather have reporting and SEO handled end-to-end, that’s our SEO and technical SEO teams’ work.

Frequently asked questions

Does the Ahrefs API v2 still work?

No. Ahrefs API v2 was fully discontinued on 1 November 2025, along with the legacy Integrations program. Any tutorial using apiv2.ahrefs.com or a token= URL parameter no longer works — use API v3 with an Authorization: Bearer header against api.ahrefs.com/v3/.

The tools can be free (Apps Script) or have trials (connectors), but the Ahrefs API itself needs a paid subscription that’s separate from a standard Ahrefs plan and priced by rows. Budget for the API regardless of method.

The data refreshes automatically on a schedule instead of manual CSV exports. Apps Script uses a time-driven trigger (e.g. daily at 6am); connectors use their built-in refresh schedule. Either way, the sheet updates itself.

A no-code connector (API Connector, Apipheny, Coupler.io, Supermetrics): authenticate, point it at an API v3 endpoint, map the response, and set a refresh schedule — no code. Apps Script gives more control but needs light JavaScript.

It bills by rows, so request only needed metrics and date ranges, refresh daily/weekly rather than hourly, limit targets per run, cache in the sheet, and monitor usage against your plan’s allowance.

Not for connectors — they’re point-and-click. For Apps Script you need only light JavaScript: paste the function, store your key in Script Properties, add a trigger. The example here is copy-paste ready once you set your endpoint and field names.

We build automated, client-ready SEO dashboards — Ahrefs, Search Console, GA4, and more — so your team spends time on strategy, not spreadsheets. Tell us what you need to track and we’ll wire it up.

Riya
Riya Bhardwaj
Lead Marketing Strategist

Leading content and growth initiatives with a focus on search visibility, audience engagement, and measurable business outcomes. Specialised in SEO, Generative Engine Optimization (GEO), AI search optimisation, and performance-driven content marketing. Passionate about transforming market insights into scalable content strategies that strengthen brand authority and drive sustainable digital growth.

Share this article f t in
Get weekly marketing insights — free

Join 8,000+ marketers who receive Nowoka Digital’s weekly digest: actionable strategies, algorithm updates, AI search insights, and growth tactics. Every Tuesday. No spam.

One email per week. 8,000+ subscribers. Unsubscribe anytime.