# Amazon Scraper (`logical_variety/amazon`) Actor

Get Amazon product search results and product pages as structured JSON.

- **URL**: https://apify.com/logical_variety/amazon.md
- **Developed by:** [Logical Variety](https://apify.com/logical_variety) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Amazon Scraper

Get Amazon product search results and product pages as structured JSON.

Pick an **action** and fill in its fields — the Actor fetches the data once and
stores the answer in the dataset as one item.

### Input

`action` is required and selects what to fetch.

Each action uses only its own fields: fields of other actions are ignored and
not sent. A key that is not a field of this Actor (e.g. a typo) fails the run.
Required fields are checked before any request; an empty or whitespace-only
string counts as a missing value.

| Action | What it returns | Required | Optional |
|--------|-----------------|----------|----------|
| `search` | Search products | `query` | `page` |
| `item` | Product page | `asin` | — |

| Field | Type | Description |
|-------|------|-------------|
| `query` | string | Search query, e.g. wireless headphones. |
| `page` | integer, >= 1 | Results page number, starting from 1. |
| `asin` | string | Amazon product ASIN, e.g. B0BDHWDR12. |

Example:

```json
{"action":"search","query":"wireless headphones"}
```

### Output

- Success: the JSON object of the answer as one dataset item, as is.
- A rejected value (e.g. a query the source does not accept) or an item the source
  reports as missing is stored as one item
  `{ "success": false, "response": 2, "response_type": "invalid request", "message": "..." }`
  (`"response": 10`, `"page not found"` when the source reports 404) and the run
  still succeeds. Only error items have the `success` field.
- The run fails without storing data when the input is invalid (checked before
  any request), the data source is unavailable or returns an unexpected answer,
  or it does not answer within 60 seconds.

### Pricing

This Actor uses **pay-per-event** pricing: you pay for the Actor start and for
each result, platform usage (compute) is included. The prices are on the
Actor's page in Apify Store.

- A result is the dataset item with data: one per run.
- Only the Actor start is charged for an error item and for a run that fails.

### Run via API

```bash
curl -X POST \
  "https://api.apify.com/v2/acts/logical_variety~amazon/run-sync-get-dataset-items?token=<APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"action":"search","query":"wireless headphones"}'
```

# Actor input Schema

## `action` (type: `string`):

What to fetch. Only the fields of the selected action are sent; fields of other actions are ignored.

## `query` (type: `string`):

Search query, e.g. wireless headphones. Actions: search (required).

## `page` (type: `integer`):

Results page number, starting from 1. Actions: search.

## `asin` (type: `string`):

Amazon product ASIN, e.g. B0BDHWDR12. Actions: item (required).

## Actor input object example

```json
{
  "action": "search",
  "query": "wireless headphones"
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset items: the answer of the selected action as one item. Errors: one item { success: false, ... }.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "action": "search",
    "query": "wireless headphones"
};

// Run the Actor and wait for it to finish
const run = await client.actor("logical_variety/amazon").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "action": "search",
    "query": "wireless headphones",
}

# Run the Actor and wait for it to finish
run = client.actor("logical_variety/amazon").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "action": "search",
  "query": "wireless headphones"
}' |
apify call logical_variety/amazon --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,logical_variety/amazon"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Px42DCBfNormNqBGo/builds/dOmYfEUuzrEQ5mj5U/openapi.json
