-
The GET request for data should be sent in the following format:
http://%DB%.api.semrush.com/?action=report&type=%REPORT_TYPE%&%REQUEST_TYPE%=%REQUEST%&key=%API_KEY%&display_limit=%LIMIT%&display_offset=%OFFSET%&export=api&export_columns=%EXPORT_COLUMNS%&export_escape=%EXPORT_ESCAPE%
Where:- %DB% - requested database. Valid values: "us" - for Google.com, "uk" - for Google.co.uk, "ca" - for Google.ca, "ru" - for Google.ru, "de" for Google.de, "fr" for Google.fr, "es" for Google.es, "it" for Google.it, "br" for Google.com.br, "au" for Google.com.au & "us.bing" for Bing.com
- %REPORT_TYPE% - type of the report. Valid values: "domain_rank", "domain_organic", "domain_adwords", "domain_organic_organic", "domain_adwords_adwords", "domain_organic_adwords", "domain_adwords_organic", "phrase_this", "phrase_related" or "url_organic" (see examples below)
Note: Important! "Full Search" type of report is unavailable through API - %API_KEY% - user identification key - available through your profile on the site.
- %REQUEST_TYPE% - type of request. Valid values: "domain", "phrase" or "url" (see examples below)
- %REQUEST% - your request
- %LIMIT% - number of results returned
- %OFFSET% - instructs to skip a specified number of results before beginning to return results to you
- %EXPORT_ESCAPE% - if set to "1" columns values will be wrapped in double quotes
-
%EXPORT_COLUMNS% - list of column names, separated by a coma. You may list the specific column names you need, in any order you'd like.
List of default column names by request types (expand for detailed explanation):
-
Main report - Dn, Rk, Or, Ot, Oc, Ad, At, Ac
-
Organic Keywords report - Ph, Po, Pp, Nq, Cp, Ur, Tr, Tc, Co, Nr, Td
-
AdWords keywords report - Ph, Po, Pp, Nq, Cp, Vu, Tr, Tc, Co, Nr, Td
-
Competitors in organic search report - Dn, Np, Or, Ot, Oc, Ad
-
Competitors in AdWords search report - Dn, Np, Ad, At, Ac, Or
-
Potential ad/traffic buyers report - Dn, Np, Ad, At, Ac, Or
-
Potential ad/traffic sellers report - Dn, Np, Or, Ot, Oc, Ad
-
Main keyword report - Ph, Nq, Cp, Co, Nr
-
Related keyword report - Ph, Nq, Cp, Co, Nr, Td
-
Organic URL report - Ph, Po, Nq, Cp, Co, Tr, Tc, Nr, Td
-
AdWords URL report - Ph, Po, Nq, Cp, Co, Tr, Tc, Nr, Td
-
-
- seobook.com - Main report
http://fr.api.semrush.com/?action=report&type=domain_rank&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&export=api&export_columns=Dn,Rk,Or,Ot,Oc,Ad,At,Ac&domain=seobook.com - seobook.com+(by+organic) - Organic Keywords report
http://fr.api.semrush.com/?action=report&type=domain_organic&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&display_limit=10&export=api&export_columns=Ph,Po,Pp,Nq,Cp,Ur,Tr,Tc,Co,Nr,Td&domain=seobook.com - ebay.com+(by+adwords) - AdWords keywords report
http://fr.api.semrush.com/?action=report&type=domain_adwords&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&display_limit=10&export=api&export_columns=Ph,Po,Pp,Nq,Cp,Vu,Tr,Tc,Co,Nr,Td&domain=ebay.com - seobook.com+(by+organic_organic) - Competitors in organic search report
http://fr.api.semrush.com/?action=report&type=domain_organic_organic&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&display_limit=10&export=api&export_columns=Dn,Np,Or,Ot,Oc,Ad&domain=seobook.com - ebay.com+(by+adwords_adwords) - Competitors in AdWords search report
http://fr.api.semrush.com/?action=report&type=domain_adwords_adwords&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&display_limit=10&export=api&export_columns=Dn,Np,Ad,At,Ac,Or&domain=ebay.com - ebay.com+(by+organic_adwords) - Potential ad/traffic buyers report
http://fr.api.semrush.com/?action=report&type=domain_organic_adwords&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&display_limit=10&export=api&export_columns=Dn,Np,Ad,At,Ac,Or&domain=ebay.com - ebay.com+(by+adwords_organic) - Potential ad/traffic sellers report
http://fr.api.semrush.com/?action=report&type=domain_adwords_organic&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&display_limit=10&export=api&export_columns=Dn,Np,Or,Ot,Oc,Ad&domain=ebay.com - search+engine+optimization - Main keyword report
http://fr.api.semrush.com/?action=report&type=phrase_this&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&export=api&export_columns=Ph,Nq,Cp,Co,Nr&phrase=search+engine+optimization - search+engine+optimization+(related) - Related keyword report
http://fr.api.semrush.com/?action=report&type=phrase_related&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&display_limit=10&export=api&export_columns=Ph,Nq,Cp,Co,Nr,Td&phrase=search+engine+optimization - http://tools.seobook.com/ - Organic URL report
http://fr.api.semrush.com/?action=report&type=url_organic&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&display_limit=10&export=api&export_columns=Ph,Po,Nq,Cp,Co,Tr,Tc,Nr,Td&url=http://tools.seobook.com/ - http://www.amazon.com/ - AdWords URL report
http://fr.api.semrush.com/?action=report&type=url_adwords&key=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&display_limit=10&export=api&export_columns=Ph,Po,Nq,Cp,Co,Tr,Tc,Nr,Td&url=http://www.amazon.com/
- seobook.com - Main report
-
- ERROR 30 :: LIMIT EXCEEDED
- ERROR 50 :: NOTHING FOUND
- ERROR 70 :: API KEY HASH FAILURE
- ERROR 40 :: MANDATORY PARAMETER "action" NOT SET OR EMPTY
- ERROR 41 :: MANDATORY PARAMETER "type" NOT SET OR EMPTY
- ERROR 42 :: MANDATORY PARAMETER "domain" NOT SET OR EMPTY
- ERROR 43 :: MANDATORY PARAMETER "phrase" NOT SET OR EMPTY
- ERROR 44 :: MANDATORY PARAMETER "url" NOT SET OR EMPTY
- ERROR 45 :: MANDATORY PARAMETER "vs_domain" NOT SET OR EMPTY
- ERROR 120 :: WRONG KEY - ID PAIR
- ERROR 121 :: WRONG FORMAT OR EMPTY HASH
- ERROR 122 :: WRONG FORMAT OR EMPTY KEY
- ERROR 130 :: API DISABLED
- ERROR 131 :: LIMIT EXCEEDED
- ERROR 132 :: API UNITS BALANCE IS ZERO
- ERROR 133 :: DB ACCESS DENIED
- ERROR 134 :: TOTAL LIMIT EXCEEDED
- ERROR 135 :: API REPORT TYPE DISABLED
-
API format is similar to CSV semicolon export
-
- Column names never change
- Order of columns may be changed
- Number of columns may be increased
- Old columns may be removed only after notification
-
Below are three simple scripts showing you how you can integrate SEMrush API data into your web project. Examples are written in PERL, PHP and JavaScript (using YQL). All you have to do is:download the script you find suits you best, unzip it, set some parameters (explained in comments, in a script body) and upload it to your web server.
Attention!!! Use JavaScript example with caution as your API key in that script gets disclosed and can be viewed by anyone!!!
- PERL SEMRush API integration example script - perl_example.zip
- PHP SEMRush API integration example script - php_example.zip
- JavaScript SEMRush API integration example script - js_example.zip - Using this method your API key will be disclosed and can be viewed by anyone!!!
-
If you integrate SEMrush API in your own web service you should send X-Real-IP header with your requests! (In case a partner's user overloads the server, we'd like to have an opportunity to disconnect the specific user without blocking the partner's access to SEMRush's API. For this reason, it is necessary for us to know the IP of the end-consumer.)
Publication of data provided by the service is only possible with reference to the data source or proper branding on the site. Any other type of publication is strictly prohibited.
The use of information provided by this service for commercial and other third-party services in the form in which it was obtained directly from the service without the express written consent of SEMRush.com is strictly prohibited.
You may not perform more than 10 requests per second, nor more than 2 simultaneous requests.

