This article references the legacy version of our API (v2). Our newest API version (v3) was released on Sep. 7, 2022 and is available for Enterprise users.

Please feel free to contact support@ahrefs.com for more details.

In order not to get confused by different stats reported, make sure you are using the same parameters, modes and targets for your queries:

API:

https://apiv2.ahrefs.com/?token=XXX&target=ahrefs.com&limit=1000&output=json&from=metrics_extended&mode=subdomains 

Site Explorer:

https://app.ahrefs.com/site-explorer/overview/v2/subdomains/live?target=ahrefs.com

In above examples I analysed target ahrefs.com in 'subdomains' mode and got the same numbers for both requests.

Moreover, it is worth mentioning that API data is currently available for Live index only, so consider that when comparing results as well.

Did this answer your question?