Search

Query the Alexa search engine to search the web for documents that match a query. This action returns XML containing the search results.

NameDescriptionRequired

Action

Set the Action parameter to Search to search the web for documents matching the terms in the Query.

Yes

Version

Pass in the current version number, 2007-03-15, to ensure that requests succeed even if the API changes in future versions.

Yes

ResponseGroup

A comma-separated list that selects what data is returned from a search.

  • Results - Search results
  • Context - Search results with context snippets
  • QueryCorrection - Suggest spelling corrections
  • QueryExpansion - Suggest related queries
  • TrafficRank - Return Alexa traffic rank

Yes

Query

A set of search terms. See the Query Syntax chapter for more details.

Yes

PageNumber

The page of results to show. Default value is 1. Maximum 5000. Note that you can retrieve a maximum of 5000 results total (The PageNumber * MaxNumberOfDocumentsPerPage must be <= 5000). If you need more than 5000 results see the Million Search Results Chapter.

No

MaxNumberOfDocumentsPerPage

Number of results (maximum) per page to return. Note that the response may contain fewer results than this maximum. Default value is 10. Maximum is 200.

No

MaxTime

Web Search will return as many results as possible within the specifed number of seconds. The default value is automatically adjusted based on the number of results and the complexity of the query. Maximum value is 180.

No

Unique

The Unique parameter allows you to choose how to filter duplicate pages from your search results. By default value only 2 results per site are returned. See Uniquing Results for more information.

No

The following example shows a typical Query-style request and response

The table below describes the main elements in the XML response:

Element NameDescription
SearchTermsThe terms from the Query string that are used to get context from the document
EstimatedNumberOfDocumentsAn estimate of the number of matching results
MaxTimeReachedIf this is true if means that the MaxTime has been reached and the search engine returned available results.
DocumentThis element wraps the result fields that describe a matching document.
UrlThe URL of the document. You should be able to navigate a browser to this URL (As long as it is still available on the web)
TitleThe title of the document
BytesThe size of the document in bytes
ChecksumA checksum of the document contents
TrafficRankThe Alexa Traffic Rank of the website hosting the document Url
QueryCorrectionSuggested alternate search query. Usually this is a spelling correction.
QueryExpansion/ExpansionRelated search query