Quickstart
In this quickstart, you perform your first search on the AlsoAsked sandbox API, read the results, and get the search again by its ID. The quickstart takes about 5 minutes. Any AlsoAsked account can use the sandbox API, so you don't need a Pro plan, and the search doesn't use the credits of your plan.
Before you start
- You need an AlsoAsked account. Any plan works for the sandbox API.
- You need a terminal with the
curlcommand-line tool, to send the requests in this quickstart.
The sandbox API returns test results, not real results from Google. A search on the sandbox API uses sandbox credits, which are separate from the credits of your plan. For details, see Sandbox API.
1. Create a sandbox API key
The sandbox API accepts only a sandbox API key. A sandbox API key starts with aa-sandbox-. To create a sandbox API key
on the AlsoAsked website, do the following steps:
- Sign in to AlsoAsked, and go to the API keys page.
- Select Create API key.
- In the Name field, enter a name for the API key. The name is for your reference only.
- In the Environment field, choose Sandbox.
- Select Create key.
- Copy the API key, and store it in a safe place. AlsoAsked shows the API key only once.
Keep your sandbox API key secret. Don't put an API key in code that runs in a web browser or in a mobile app, and don't commit an API key to a code repository. For details, see Authenticate requests.
2. Perform a synchronous search on the sandbox API
To perform a search, send a POST request to https://sandbox.alsoaskedapi.com/v1.1/search. Put your
sandbox API key in the X-Api-Key header, and put the terms in the terms field of the JSON request body.
-
Copy the following request. The request performs a synchronous search on the sandbox API for 1 term,
how to brew coffee, in English, for the United States, with a depth of2:curl --request POST 'https://sandbox.alsoaskedapi.com/v1.1/search' \--header 'Content-Type: application/json' \--header 'X-Api-Key: YOUR_SANDBOX_API_KEY' \--data '{"terms": ["how to brew coffee"],"language": "en","region": "us","depth": 2}' -
Replace
YOUR_SANDBOX_API_KEYwith your sandbox API key, which starts withaa-sandbox-. -
Run the request in your terminal.
The fields in the POST /v1.1/search request body do these things:
- The
termsfield contains the terms to search for. A search has 1 to 1,000 terms. - The
languagefield contains the language code of the search. The default language code isen. - The
regionfield contains the region code of the search. The default region code isus. - The
depthfield sets the number of levels of results:1,2, or3. The default depth is2.
The request body has no async field. The default value of the async field is false, so the search is a
synchronous search. In a synchronous search, the API waits until the search is complete before it returns the
response. On the sandbox API, a synchronous search is complete after 3 to 9 seconds. On the live API, the API waits a
maximum of 90 seconds.
This search has 1 term and a depth of 2, so the search costs 1 sandbox credit. For details, see
Credits.
3. Read the results of the search
If the AlsoAsked API accepts the search, the API returns the status code 200 OK. The response body contains the
search. These are the important fields of the search in the POST /v1.1/search response body:
- The
idfield contains the ID of the search: 32 letters and digits. Use the ID to get the search again. - The
statusfield contains the status of the search. A search is complete when its status issuccess,no_results, orerror. - The
queriesfield contains one query for each unique term in the search. Thequeriesfield isnulluntil the search is complete.
Each query in the queries field has these fields:
- The
termfield contains the term of the query. - The
statusfield contains the status of the term:success,no_results, orerror. - The
resultsfield contains the top-level results for the term, if the status of the term issuccess.
Each result in the results field of a query has these fields:
- The
questionfield contains the question that Google shows for the term. - The
answer_excerptfield contains an excerpt of the answer. - The
positionfield contains the place of the result, as an array of numbers. A top-level result has 1 number, for example[1]. A child result has 1 number for each level, for example[1, 2]for the second child result of the first top-level result. - The
resultsfield contains the child results of the result. A child result has the same fields as a top-level result.
The following JSON is an example response body for a search with 1 term and a depth of 2. The example is
shortened to 1 top-level result and 1 child result, and its questions and answers are example text in English. Your
response from the sandbox API has the same fields, but it has 4 top-level results, each with 6 to 10 child results, and
the questions and the answers are placeholder text in Latin. On the live API, the results are the questions and the
answers that Google shows.
{
"id": "gzu106FjVblnPu99fbVOgUgCoBO6Pesm",
"language": "en",
"region": "us",
"latitude": null,
"longitude": null,
"status": "success",
"deleted": false,
"depth": 2,
"cached": false,
"created_at": "2026-01-31T12:00:00+00:00",
"updated_at": "2026-01-31T12:00:06+00:00",
"cached_at": null,
"queries": [
{
"term": "how to brew coffee",
"status": "success",
"language_fallback": false,
"region_fallback": false,
"results": [
{
"question": "How do you brew coffee at home?",
"position": [1],
"answer_excerpt": "Example answer excerpt for the first top-level result.",
"answer_href": "https://example.com/brew-coffee-at-home",
"answer_page_title": "Example page title",
"ai_overview": false,
"ai_overview_hrefs": null,
"ai_overview_page_titles": null,
"results": [
{
"question": "How much coffee do you use for one cup?",
"position": [1, 1],
"answer_excerpt": "Example answer excerpt for the first child result.",
"answer_href": "https://example.com/coffee-for-one-cup",
"answer_page_title": "Example page title",
"ai_overview": false,
"ai_overview_hrefs": null,
"ai_overview_page_titles": null,
"results": []
}
]
}
]
}
]
}
If the search isn't complete, the queries field is null. To get the results later, send a GET request to
https://sandbox.alsoaskedapi.com/v1.1/search/{searchId} with the id field. See
Get the search again.
For all the fields of the search, the query, and the result, see Search results.
4. Get the search again
To get the search again, send a GET request to https://sandbox.alsoaskedapi.com/v1.1/search/{searchId}.
Use the id field from the POST /v1.1/search response body as the searchId path parameter.
-
Copy the following request:
curl --request GET 'https://sandbox.alsoaskedapi.com/v1.1/search/YOUR_SEARCH_ID' \--header 'X-Api-Key: YOUR_SANDBOX_API_KEY' -
Replace
YOUR_SEARCH_IDwith theidfield from thePOST /v1.1/searchresponse body. -
Replace
YOUR_SANDBOX_API_KEYwith your sandbox API key. -
Run the request in your terminal.
The GET /v1.1/search/{searchId} endpoint returns the same search object as the POST /v1.1/search endpoint, with
the same fields. If the search wasn't complete before, read the status field again. When the status is success,
no_results, or error, the search is complete, and the queries field contains the queries.
Next steps
- Move to the live API. The live API gets real results from Google and uses the credits of your plan. To use the
live API, your account needs a Pro plan and a live API key, which starts with
aa-live-. The base URL of the live API ishttps://alsoaskedapi.com/v1.1. To move your integration, change the base URL and the API key. See AlsoAsked API overview and Authenticate requests. - Perform an asynchronous search. Set the
asyncfield totrueto get the response immediately, before the search is complete. See Synchronous and asynchronous searches. - Choose more fields for a search. Set a more exact location, get fresh results, or perform a search with more terms. See Perform a search.
- Receive webhook events. AlsoAsked can send webhook events to your webhook endpoints when the status of a search changes. See Webhooks.
- Handle errors. Learn the error types that the AlsoAsked API returns and what to do for each error type. See Errors.
- Test more cases on the sandbox API. Add a test term such as
[error]or[no_results]to thetermsfield, so that a term fails or has no results. See Sandbox API. - Search many terms. Learn how to search thousands of terms and collect every result. See Search many terms.