Generate an API token from your Ahrefs account under API settings; the token carries the permissions of the account that generated it
Send GET requests to the Ahrefs API v3 base URL with the Authorization: Bearer <API_KEY> header and query parameters specifying the target (select, target, mode) and date range
To retrieve backlink data, call the backlinks endpoint with target set to the domain or URL, and use the mode parameter to specify domain, prefix, exact, or subdomains scope
To retrieve keyword data (keyword rankings for a domain), call the organic-keywords or paid-keywords endpoints, specifying the country and desired output columns
Track API unit consumption in the response headers or account dashboard; each endpoint has a documented unit cost and accounts have a monthly unit limit
Known gotchas
Ahrefs API access requires a paid subscription tier that includes API access; not all subscription plans include the API, and unit limits vary significantly between tiers
The 'mode' parameter controls URL matching scope; using 'exact' on a homepage URL returns only links to that exact URL, not the domain — choose 'domain' to aggregate across all pages
Ahrefs data reflects their own crawl index, not Google's; backlinks that exist in Ahrefs may not be discovered by Google and vice versa — use it as directional intelligence, not a precise count
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp