Your first 5 minutes with the Majestic API

This page is designed for the standard API authorisation available on Platinum (Legacy) and API plans. If you wish to write an OpenApps application, we suggest you start with this guide, and then progress to the OpenApps specific documentation.

For in depth technical detail about the API, please visit the API reference page.

The API

The Majestic API is available on two endpoints – a Developer API with an older, limited version of our index intended for development, and an Enterprise API which uses the resources on your subscription to query our live data sets.

Our website accesses our Fresh and Historic Indexes in a very similar manner to the public API. We therefore suggest familiarising yourself with the website to assist development and help support personnel to deal with any of your queries.

How are requests made?

Our API is based on HTTP. An HTTP GET or POST request is sent from your application to one of the two endpoints discussed above. This endpoint returns a response synchronously. For some commands, you may be required to make further HTTP requests to download the data requested.

What does a response looks like?

Following your HTTP GET or POST request, our server will return a response in either XML or JSON. Our JSON format is more humanly readable, but comes at the cost of bandwidth. We therefore advise users to maximise performance by using XML.

Example XML and JSON responses to the GetIndexItemInfo call, which is the fastest way to get statistics on one or more domains, are shown below.

https://api.majestic.com/api/xml?app_api_key=API_KEY&cmd=GetIndexItemInfo&items=1&item0=http://www.majestic.com&datasource=fresh

This query in the Fresh Index produces the following XML:


<Result Code="OK" ErrorMessage="" FullError=""><GlobalVars FirstBackLinkDate="2017-07-13" IndexBuildDate="2017-10-15 16:23:38" IndexType="1" MostRecentBackLinkDate="2017-10-14" QueriedRootDomains="0" QueriedSubDomains="0" QueriedURLs="1" QueriedURLsMayExist="0" ServerBuild="2017-10-13 13:57:22" ServerName="QUACKYO" ServerVersion="1.0.6495.23321" UniqueIndexID="20171015162338-FRESH"/><DataTables Count="1"><DataTable Name="Results" RowsCount="1" Headers="ItemNum|Item|ResultCode|Status|ExtBackLinks|RefDomains|AnalysisResUnitsCost|ACRank|ItemType|IndexedURLs|GetTopBackLinksAnalysisResUnitsCost|DownloadBacklinksAnalysisResUnitsCost|DownloadRefDomainBacklinksAnalysisResUnitsCost|RefIPs|RefSubNets|RefDomainsEDU|ExtBackLinksEDU|RefDomainsGOV|ExtBackLinksGOV|RefDomainsEDU_Exact|ExtBackLinksEDU_Exact|RefDomainsGOV_Exact|ExtBackLinksGOV_Exact|CrawledFlag|LastCrawlDate|LastCrawlResult|RedirectFlag|FinalRedirectResult|OutDomainsExternal|OutLinksExternal|OutLinksInternal|OutLinksPages|LastSeen|Title|RedirectTo|Language|LanguageDesc|LanguageConfidence|LanguagePageRatios|LanguageTotalPages|RefLanguage|RefLanguageDesc|RefLanguageConfidence|RefLanguagePageRatios|RefLanguageTotalPages|CrawledURLs|RootDomainIPAddress|TotalNonUniqueLinks|NonUniqueLinkTypeHomepages|NonUniqueLinkTypeIndirect|NonUniqueLinkTypeDeleted|NonUniqueLinkTypeNoFollow|NonUniqueLinkTypeProtocolHTTPS|NonUniqueLinkTypeFrame|NonUniqueLinkTypeImageLink|NonUniqueLinkTypeRedirect|NonUniqueLinkTypeTextLink|RefDomainTypeLive|RefDomainTypeFollow|RefDomainTypeHomepageLink|RefDomainTypeDirect|RefDomainTypeProtocolHTTPS|CitationFlow|TrustFlow|TrustMetric|TopicalTrustFlow_Topic_0|TopicalTrustFlow_Value_0|TopicalTrustFlow_Topic_1|TopicalTrustFlow_Value_1|TopicalTrustFlow_Topic_2|TopicalTrustFlow_Value_2" MaxTopicsRootDomain="30" MaxTopicsSubDomain="20" MaxTopicsURL="10" TopicsCount="3"><Row>0|http://www.majestic.com/|OK|Found|390371|681|390371|6|3|1|5000|390372|63620|358|323|3|11|0|0|1|1|0|0|True|2017-10-14|HTTP_301_PermanentRedirect|True|DownloadedSuccessfully|0|0|1|1| |Majestic®: Marketing Search Engine and SEO Backlink Checker|https://majestic.com/| | | | |0| | | | |0|1| |390448|24|0|2421|388515|68837|0|388424|7|2017|662|595|19|681|0|43|32|32|Computers/Internet/Web Design and Development|29|Computers/Internet|28|Business/E-Commerce|25</Row></DataTable></DataTables></Result>
	
https://api.majestic.com/api/json?app_api_key=API_KEY&cmd=GetIndexItemInfo&items=1&item0=http://www.majestic.com&datasource=fresh

This query in the Fresh Index produces the following JSON:


{
	"Code": "OK",
	"ErrorMessage": "",
	"FullError": "",
	"FirstBackLinkDate": "2017-07-13",
	"IndexBuildDate": "2017-10-15 16:23:38",
	"IndexType": 1,
	"MostRecentBackLinkDate": "2017-10-14",
	"QueriedRootDomains": 0,
	"QueriedSubDomains": 0,
	"QueriedURLs": 1,
	"QueriedURLsMayExist": 0,
	"ServerBuild": "2017-10-13 13:57:22",
	"ServerName": "QUACKYO",
	"ServerVersion": "1.0.6495.23321",
	"UniqueIndexID": "20171015162338-FRESH",
	"DataTables": {
		"Results": {
			"Headers": {
				"MaxTopicsRootDomain": 30,
				"MaxTopicsSubDomain": 20,
				"MaxTopicsURL": 10,
				"TopicsCount": 3
			},
			"Data": [
				{
					"ItemNum": 0,
					"Item": "http://www.majestic.com/",
					"ResultCode": "OK",
					"Status": "Found",
					"ExtBackLinks": 390371,
					"RefDomains": 681,
					"AnalysisResUnitsCost": 390371,
					"ACRank": 6,
					"ItemType": 3,
					"IndexedURLs": 1,
					"GetTopBackLinksAnalysisResUnitsCost": 5000,
					"DownloadBacklinksAnalysisResUnitsCost": 390372,
					"DownloadRefDomainBacklinksAnalysisResUnitsCost": 63620,
					"RefIPs": 358,
					"RefSubNets": 323,
					"RefDomainsEDU": 3,
					"ExtBackLinksEDU": 11,
					"RefDomainsGOV": 0,
					"ExtBackLinksGOV": 0,
					"RefDomainsEDU_Exact": 1,
					"ExtBackLinksEDU_Exact": 1,
					"RefDomainsGOV_Exact": 0,
					"ExtBackLinksGOV_Exact": 0,
					"CrawledFlag": "True",
					"LastCrawlDate": "2017-10-14",
					"LastCrawlResult": "HTTP_301_PermanentRedirect",
					"RedirectFlag": "True",
					"FinalRedirectResult": "DownloadedSuccessfully",
					"OutDomainsExternal": "0",
					"OutLinksExternal": "0",
					"OutLinksInternal": "1",
					"OutLinksPages": "1",
					"LastSeen": "",
					"Title": "Majestic®: Marketing Search Engine and SEO Backlink Checker",
					"RedirectTo": "https://majestic.com/",
					"Language": "",
					"LanguageDesc": "",
					"LanguageConfidence": "",
					"LanguagePageRatios": "",
					"LanguageTotalPages": 0,
					"RefLanguage": "",
					"RefLanguageDesc": "",
					"RefLanguageConfidence": "",
					"RefLanguagePageRatios": "",
					"RefLanguageTotalPages": 0,
					"CrawledURLs": 1,
					"RootDomainIPAddress": "",
					"TotalNonUniqueLinks": "390448",
					"NonUniqueLinkTypeHomepages": "24",
					"NonUniqueLinkTypeIndirect": "0",
					"NonUniqueLinkTypeDeleted": "2421",
					"NonUniqueLinkTypeNoFollow": "388515",
					"NonUniqueLinkTypeProtocolHTTPS": "68837",
					"NonUniqueLinkTypeFrame": "0",
					"NonUniqueLinkTypeImageLink": "388424",
					"NonUniqueLinkTypeRedirect": "7",
					"NonUniqueLinkTypeTextLink": "2017",
					"RefDomainTypeLive": "662",
					"RefDomainTypeFollow": "595",
					"RefDomainTypeHomepageLink": "19",
					"RefDomainTypeDirect": "681",
					"RefDomainTypeProtocolHTTPS": "0",
					"CitationFlow": 43,
					"TrustFlow": 32,
					"TrustMetric": 32,
					"TopicalTrustFlow_Topic_0": "Computers/Internet/Web Design and Development",
					"TopicalTrustFlow_Value_0": 29,
					"TopicalTrustFlow_Topic_1": "Computers/Internet",
					"TopicalTrustFlow_Value_1": 28,
					"TopicalTrustFlow_Topic_2": "Business/E-Commerce",
					"TopicalTrustFlow_Value_2": 25
				}
			]
		}
	}
}
	

Enabling your API

To use the API, you will need to have an account with a Platinum (Legacy) or API plan and generate an API key.

  1. Sign into your Majestic account.

    Majestic log in page
  2. Select My Account > API Keys.

    Majestic dialogue
  3. Select Create a New Key.

    Creating a new API key.

Making your first request in the web browser

Add your API key to the form below and click on the URLs to test the developer endpoint for GetIndexItemInfo. We would encourage you to add other domains to the http request (such as &item1=google.com&item2=bing.com&item3=twitter.com), and look at the GetIndexItemInfo documentation to see what other parameters are available.

Where next?

Want to get to know the API a little better? Check out the API reference page.

For a list of all available commands, with examples, descriptions and parameters, look at the commands section.

We also provide API connectors in a number of different languages, which can be downloaded through our GitHub account to help you get started.