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 firstname.lastname@example.org for more details.
Ahrefs API mainly provides information relating to Backlinks and not search related information on keywords. Thus metrics like CPC, Search Volume, Total Clicks can't be pulled from our API.
We've made some progress on this front though, as our API now also gives an estimation of total monthly search traffic, number of keywords, and cost of the target URL - https://ahrefs.com/api/documentation/positions-metrics.
If you would like more of KE available via API in future, do upvote this feature request on https://ahrefs.canny.io/api/p/allow-api-for-keywords-and-search-volume and the team will consider it at an opportune time.