Vexaloom Labs

Use Amazon Autocomplete Keyword Expander with Python

Turn seed keywords into Amazon's own search-box autocomplete suggestions across 23 marketplaces. Expand past the usual per-query cap with A-Z/0-9/custom suffixes and recursive re-querying of newly found suggestions.

1. Choose the data you need

Review the published README for supported collection modes, examples, and limits. The recipe below uses the current published input definition.

2. Prepare a source-based input

This JSON contains published prefills and required-field defaults. Review every value for your task before running it; it is not a promise of successful collection.

{
  "customSuffixes": [],
  "dedupe": true,
  "departments": [
    "aps"
  ],
  "excludeTerms": [],
  "expandAlphabet": false,
  "expandBuyerModifiers": false,
  "expandComparisons": false,
  "expandNumbers": false,
  "expandPrefixAlphabet": false,
  "expandPrepositions": false,
  "expandQuestions": false,
  "includeSeed": false,
  "includeTerms": [],
  "includeWidgets": false,
  "keywords": [
    "wireless earbuds"
  ],
  "marketplace": "US",
  "marketplaces": [],
  "maxConcurrency": 1,
  "maxDepth": 0,
  "maxQueries": 3,
  "maxSuggestions": 3,
  "maxSuggestionsPerKeyword": 0,
  "minWordCount": 0,
  "mustContainSeed": false,
  "onlyLongTail": false,
  "onlyQuestions": false,
  "queryMode": "enhanced",
  "requestDelayMs": 0,
  "resultOrder": "source"
}

Download input.example.json and save your reviewed copy as input.json.

FieldTypeRequiredDescription
keywordsarrayrequiredOne or more seed keywords or phrases to expand into Amazon autocomplete suggestions.
marketplacestringoptionalSingle Amazon marketplace to query. Used when `marketplaces` is empty.
marketplacesarrayoptionalOptional multi-market sweep, e.g. ["US", "GB", "DE"]. Leave empty to use the single `marketplace` value. Codes are the same as the marketplace dropdown.
departmentsarrayoptionalAmazon department aliases to scope suggestions, e.g. ["aps", "kitchen"]. Leave empty for the all-departments default (`aps`). Common aliases: aps, electronics, computers, fashion, kitchen, stripbooks, beauty, hpc, pet-supplies, toys-and-games, home-improvement, automotive, grocery, office-products, watches, shoes, luggage, digital-text, audible, amazon-devices, instant-video, todays-deals.
expandAlphabetbooleanoptionalAppend each letter a-z to every query (e.g. `yoga mat a`) to surface more than the per-query cap.
expandPrefixAlphabetbooleanoptionalPrepend each letter a-z to every query (e.g. `a yoga mat`). Returns a different suggestion set from suffix expansion.
expandNumbersbooleanoptionalAppend each digit 0-9 to every query, useful for sizes, models and quantities.
expandQuestionsbooleanoptionalQuery locale-aware question stems such as `how to`, `what is` and `where to buy` in front of each seed.
expandComparisonsbooleanoptionalQuery comparison tokens such as `vs`, `or`, `versus` and `and` after each seed.
expandPrepositionsbooleanoptionalQuery preposition tokens such as `for`, `with`, `without`, `under` and `over` after each seed.
expandBuyerModifiersbooleanoptionalQuery locale-aware buyer-intent modifiers such as `best`, `cheap`, `for men`, `for women` and `waterproof`.
customSuffixesarrayoptionalAdditional suffixes to append to every query, e.g. ["for men", "waterproof", "iphone 15"].
maxDepthintegeroptionalRecursively re-query newly discovered suggestions as fresh seeds, up to this depth (0 = original seeds only; 3 = three hops).
queryModestringoptional`enhanced` returns thumbnails, widgets and predictive text when Amazon provides them; `organic` is the plain keyword response; `both` requests both and unions the results.
includeWidgetsbooleanoptionalEmit Amazon's optional widget suggestions (carousels, refinements, entity cards) when the enhanced endpoint returns them.
includeSeedbooleanoptionalEmit one `SEED` record per seed keyword in addition to Amazon's suggestions.
dedupebooleanoptionalMerge repeated suggestions into one record per seed, marketplace and department, with a relative volume proxy and provenance. Turn off to emit every occurrence.
resultOrderstringoptionalOrder within each seed, marketplace and department group. `volume` sorts by the relative query-count score (requires dedupe).
mustContainSeedbooleanoptionalDrop suggestions that do not contain the original seed keyword.
includeTermsarrayoptionalKeep only suggestions containing at least one of these terms. Leave empty to keep all.
excludeTermsarrayoptionalDrop suggestions containing any of these terms.
onlyQuestionsbooleanoptionalKeep only question-shaped suggestions (question word or trailing question mark).
onlyLongTailbooleanoptionalKeep only suggestions with three or more words.
minWordCountintegeroptionalDrop suggestions with fewer words than this value.
maxSuggestionsintegeroptionalHard cap on total records emitted in this run.
maxSuggestionsPerKeywordintegeroptionalCap emitted records per seed, marketplace and department. 0 means no per-seed cap.
maxQueriesintegeroptionalHard cap on HTTP requests across the whole run. The run status message says when this cap stopped it.
maxConcurrencyintegeroptionalParallel requests. Values above 8 give little extra speed and are more likely to be rate-limited.
requestDelayMsintegeroptionalPause per worker between requests. 0 is fastest; 100-250 is gentler.

3. Start an Actor run

Set APIFY_TOKEN in your environment. Python 3.10 or newer is sufficient; this recipe uses no third-party packages.

Execution may incur charges. Review current pricing on Apify. The request asks for a 120-second timeout and a charge limit; these settings are subject to Apify’s pricing and do not guarantee an all-inclusive spending cap.

import json
import os
import urllib.request

# Save the schema-derived example as input.json; review and edit it first.
with open("input.json", encoding="utf-8") as stream:
    actor_input = json.load(stream)

token = os.environ["APIFY_TOKEN"]
request = urllib.request.Request(
    "https://api.apify.com/v2/acts/zgFNSzKiYNCzNrdL9/runs?timeout=120&maxTotalChargeUsd=0.50",
    data=json.dumps(actor_input).encode("utf-8"),
    headers={"Authorization": "Bearer " + token, "Content-Type": "application/json"},
    method="POST",
)
# This starts a potentially billable run. Do not automatically retry this POST.
with urllib.request.urlopen(request, timeout=40) as response:
    run = json.load(response)["data"]
print("Run ID:", run["id"])
print("Status:", run["status"])
# Inspect and download results in Apify Console once the run succeeds.

4. Inspect the actual results

Open the run in Apify Console and wait for a successful completion. Use the published output schema to locate results and the dataset schema to understand declared views. Missing or optional record fields must not be treated as guaranteed values.

Amazon search-autocomplete keyword suggestions with marketplace, department, expansion lineage, relative volume proxy, search URLs, optional thumbnails and widget metadata.

Questions before you run

Which inputs are required?

The published required fields are keywords

What does this guide verify?

The fields, prefills, and schema links are rendered from the published build. This is a usage recipe, not a paid live extraction test. Source availability and collection results can vary.

What if the run request times out?

Check Apify Console before retrying. The first request may already have created a run. Do not automatically repeat a run-creation POST.

Generated from source build Lh0Nho79lKMarONeP and its README and schemas. Source changes regenerate this guide; no third-party editorial claims are inferred.