# Ahrefs

> Ahrefs SEO data via API v3 - backlinks, keywords, rankings, SERPs, and site audits.

Lets an agent pull Ahrefs SEO data - backlinks and referring domains, organic
keywords and top pages, keyword research, SERPs, rank tracking, and site audits.

## What it can do

| Method | What it does |
| --- | --- |
| `ahrefs_limits_and_usage` | Check API subscription limits and remaining units (free). |
| `ahrefs_metrics` | Get Site Explorer metrics (traffic, value, keywords, backlinks) for a target. |
| `ahrefs_metrics_history` | Get historical Site Explorer metrics over a date range. |
| `ahrefs_backlinks_stats` | Get aggregate backlinks stats (refdomains, dofollow, etc.) for a target. |
| `ahrefs_all_backlinks` | List all backlinks pointing to a target. |
| `ahrefs_broken_backlinks` | List broken backlinks (links to dead pages) for a target. |
| `ahrefs_refdomains` | List referring domains linking to a target. |
| `ahrefs_anchors` | List anchor texts used in backlinks to a target. |
| `ahrefs_linked_domains` | List external domains a target links out to. |
| `ahrefs_organic_keywords` | List organic keywords a target ranks for. |
| `ahrefs_organic_competitors` | List organic search competitors of a target. |
| `ahrefs_top_pages` | List a target's top pages by organic traffic. |
| `ahrefs_paid_pages` | List a target's paid (PPC) landing pages. |
| `ahrefs_keywords_history` | Get a target's historical organic keyword counts. |
| `ahrefs_crawled_pages` | List pages Ahrefs crawled for a target. |
| `ahrefs_keywords_overview` | Get keyword metrics (volume, difficulty, CPC, clicks) for keywords. |
| `ahrefs_keyword_volume_history` | Get monthly search-volume history for a single keyword. |
| `ahrefs_keyword_volume_by_country` | Get a keyword's search volume broken down by country. |
| `ahrefs_keyword_matching_terms` | Find keyword ideas that match or contain a seed. |
| `ahrefs_keyword_related_terms` | Find keywords related to a seed (also-rank-for ideas). |
| `ahrefs_keyword_search_suggestions` | Get autocomplete search suggestions for a seed. |
| `ahrefs_serp_overview` | Get the SERP (top results with metrics) for a keyword (free). |
| `ahrefs_rank_tracker_overview` | Get Rank Tracker positions for a project (free). |
| `ahrefs_rank_tracker_competitors` | Get Rank Tracker competitors overview for a project (free). |
| `ahrefs_site_audit_projects` | List Site Audit projects with their health scores (free). |
| `ahrefs_site_audit_issues` | List Site Audit issues for a project. |
| `ahrefs_domain_rating` | Get Domain Rating (DR) for a target on a date. |
| `ahrefs_domain_rating_history` | Get Domain Rating (DR) history over a date range. |
| `ahrefs_url_rating_history` | Get URL Rating (UR) history over a date range. |
| `ahrefs_refdomains_history` | Get referring-domains count history over a date range. |
| `ahrefs_pages_history` | Get indexed/ranking pages count history over a date range. |
| `ahrefs_total_search_volume_history` | Get total organic search-volume history over a date range. |
| `ahrefs_outlinks_stats` | Get aggregate outgoing-links (external link) stats for a target. |
| `ahrefs_metrics_by_country` | Get organic/paid metrics broken down by country for a target. |
| `ahrefs_pages_by_traffic` | Get distribution of a target's pages by organic traffic. |
| `ahrefs_pages_by_backlinks` | List a target's pages ranked by number of backlinks. |
| `ahrefs_pages_by_internal_links` | List a target's pages ranked by number of internal links. |
| `ahrefs_linked_anchors_external` | List external anchor texts a target links out with. |
| `ahrefs_linked_anchors_internal` | List internal anchor texts a target uses for internal links. |
| `ahrefs_batch_analysis` | Get bulk metrics for up to 100 targets in one request. |
| `ahrefs_create_project` | Create a new Rank Tracker project (write). |
| `ahrefs_update_project` | Update a Rank Tracker project's access setting (write). |
| `ahrefs_add_project_keywords` | Add tracked keywords to a Rank Tracker project (write). |
| `ahrefs_delete_project_keywords` | Remove tracked keywords from a Rank Tracker project (write). |
| `ahrefs_add_project_competitors` | Add competitors to a Rank Tracker project (write). |
| `ahrefs_delete_project_competitors` | Remove competitors from a Rank Tracker project (write). |
| `ahrefs_add_keyword_list_keywords` | Add keywords to a Keywords Explorer list (write). |
| `ahrefs_delete_keyword_list_keywords` | Remove keywords from a Keywords Explorer list (write). |

## How to get credentials

1. Open [app.ahrefs.com/api/profile](https://app.ahrefs.com/api/profile).
2. Make sure your plan includes API access (API units are part of your
   subscription).
3. Create an API key and copy the token.
4. Paste it into FlyMyAI as `AHREFS_API_KEY`.

The token is sent as `Authorization: Bearer <token>`. Subscription, SERP,
Rank Tracker, and Site Audit project endpoints are free; most other reads
consume API units (minimum 50 per request), so use `ahrefs_limits_and_usage`
to watch your balance.

## Fields to fill in FlyMyAI

| FlyMyAI field | Where it comes from |
| --- | --- |
| `AHREFS_API_KEY` | API profile → create key ([app.ahrefs.com/api/profile](https://app.ahrefs.com/api/profile)) |

## Links

- [Create an API key](https://app.ahrefs.com/api/profile)
- [API reference](https://docs.ahrefs.com/en/api/docs/introduction)
