About ahrefs API
Use Our Database
API makes it possible to use data from our index in your applications.
API developing will still be in process in accordance with your suggestions.
If you feel that API lacks some functions needed for reaching your goal - contact us through support@ahrefs.com,
describing your need, and if only this is possible, we are sure to add such features to our API.
You are not allowed to white label our data without our agreement.
You are not allowed to white label our rating. If you show our rating to the third-party, you cannot change its name.
Your users should know that backlinks info is provided by ahrefs.com
If you want to show our data to the third-party, don't start integration without conditioning the rules of usage with us.
API Units
Each API function has its price, it is estimated in API Units and depends on the average limits of computer powers for this command processing. Subscription plans, apart from other features, contain additional API Units, which will be enough for personal usage.
API units can be accumulated - if you hadn't used something during the previous month, you will able to use remaining units next month.
Near each function we've indicated the amount of API Units it requires.
In future prices for API Units may be changed.
Ask Anytime
If you need large volumes, say thousands or even millions of requests per day - you may buy API Units in necessary amounts.
For this contact us through support@ahrefs.com.
ChangeLog
Short description of API additions.
Version 1.0 on 22 Dec '2011 ›
What you can do now:
Access API with your personal AhrefsKey
— it's available only for registered users.
Parameters used in API functions:
target=aim of our request, this may be domain, directory or URL;
e.g.: http://ahrefs.com, ahrefs.com, http://ahrefs.com/api/, ahrefs.com/api/ , api.ahrefs.com.mode=can acquire the following meanings:exact, domain, subdomains and prefix.
By parameterstargetandmodewe determine our analysis aim.
How these parameters are interpreted you may see in a table below:
URL exact domain subdomains prefix ahrefs.com/api/ ahrefs.com/api/ ahrefs.com/* *ahrefs.com/* ahrefs.com/api/* api.ahrefs.com api.ahrefs.com/ api.ahrefs.com/* *api.ahrefs.com/* api.ahrefs.com/* -
count=how many results should be returned -
offset=starting from what position results should be returned.
Value ofoffsetparameter cannot be more than 100'000 output=format of returning results. Available variants:xml, json, php.date=from which date results should be returned.
API enables you:
- to get total count of backlinks for a domain, directory or URL
- to get total count of backlinks with types details for a domain, directory or URL
- to get total count of referring domains, IPs, class C subnets, .gov and .edu domains for a domain, directory or URL
- to get referring pages (backlinks) for the indicated domain, directory or URL
- to get crawled pages for a domain or in a directory
- to get the list of referring domains for a domain, directory or URL
- to get the list of anchors for a domain, directory or URL
- to get the number of backlinks with specified anchor on URL
- to get the number of API Units left
1. To get total count of backlinks for a domain, directory or URL
Per request cost: 0.1 API units
Query example:
http://api.ahrefs.com/get_backlinks_count.php?target=ahrefs.com&mode=domain&output=json&AhrefsKey={Your Ahrefs Key}
Mandatory parameters: AhrefsKey, target, mode, output
2. To get total count of backlinks with types details for a domain, directory or URL
Per request cost: 0.2 API units
Query example:
http://api.ahrefs.com/get_backlinks_count_ext.php?target=ahrefs.com&mode=domain&output=json&AhrefsKey={Your Ahrefs Key}
Mandatory parameters: AhrefsKey, target, mode, output
Example of an answer ›
3. To get total count of referring domains, IPs, class C subnets, .gov and .edu domains for a domain, directory or URL
Per request cost: 1 API units
Query example:
http://api.ahrefs.com/get_ref_domains_ips_count.php?target=ahrefs.com&mode=domain&output=json&AhrefsKey={Your Ahrefs Key}
Mandatory parameters: AhrefsKey, target, mode, output
4. To get referring pages (backlinks) for the indicated domain, directory or URL
Per item cost: 0.01 API units
The total request cost is: per item cost * number of items but not less then 1 API Unit.
Query example:
http://api.ahrefs.com/get_backlinks.php?target=ahrefs.com&count=4&mode=domain&output=json&AhrefsKey={Your Ahrefs Key}
Mandatory parameters: AhrefsKey, target, mode, output, count
Optional parameter: offset
Example of an answer ›
5. To get crawled pages for a domain or in a directory
Per item cost: 0.01 API units
The total request cost is: per item cost * number of items but not less then 1 API Unit.
Query example:
http://api.ahrefs.com/get_pages.php?target=ahrefs.com&count=4&mode=domain&output=json&AhrefsKey={Your Ahrefs Key}
Mandatory parameters: AhrefsKey, target, mode, output, count
Optional parameter: offset
Example of an answer ›
6. To get the list of referring domains for a domain, directory or URL
Per item cost: 0.05 API units
The total request cost is: per item cost * number of items but not less then 1 API Unit.
Query example:
http://api.ahrefs.com/get_ref_domains.php?target=ahrefs.com&count=4&mode=domain&output=json&AhrefsKey={Your Ahrefs Key}
Mandatory parameters: AhrefsKey, target, mode, output, count
Optional parameter: offset
Example of an answer ›
7. To get the list of anchors for a domain, directory or URL
Per item cost: 0.1 API units
The total request cost is: per item cost * number of items but not less then 5 API Units.
Query example:
http://api.ahrefs.com/get_anchors_of_backlinks.php?target=ahrefs.com&count=4&mode=domain&output=json&AhrefsKey={Your Ahrefs Key}
Mandatory parameters: AhrefsKey, target, mode, output, count
Optional parameter: offset
Example of an answer ›
8. To get the number of backlinks with specified anchor on domain, directory or URL
Per request cost: 0.5 API units
Query example:
http://api.ahrefs.com/get_backlinks_count_with_anchor.php?target=ahrefs.com&output=json&mode=domain&anchor=ahrefs&AhrefsKey={Your Ahrefs Key}
Mandatory parameters: AhrefsKey, target, mode, output, count, anchor
Example of an answer ›
9. To get the number of API Units left
Per request cost: 0.01 API units
Query example:
http://api.ahrefs.com/get_units_left.php?output=json&AhrefsKey={Your Ahrefs Key}
Mandatory parameters: AhrefsKey, output
Example of an answer ›


SEO Digest