# VTEX Price Monitor — BR Stores (`geodetic_marigold/vtex-price-monitor`) Actor

Monitor de preços para lojas VTEX brasileiras (Americanas, Submarino, Shoptime). Compara o preço atual com a execução anterior via API de catálogo e devolve preço atual, anterior, delta e variação %. Ideal para repricing e monitoramento de concorrência. Cobra só quando o preço muda.

- **URL**: https://apify.com/geodetic\_marigold/vtex-price-monitor.md
- **Developed by:** [Antonio Fernando Rincon de Mendonça](https://apify.com/geodetic_marigold) (community)
- **Categories:** E-commerce, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$10.00 / 1,000 mudança de preço detectadas

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## VTEX Price Monitor — BR Stores

> Monitora preços de produtos em lojas brasileiras feitas em **VTEX**
> (Americanas, Submarino, Shoptime e qualquer loja VTEX) e detecta **mudanças
> de preço entre execuções** via a **API pública de catálogo**. Sem browser,
> sem API key, sem proxy.

### Por que usar

Consome a API REST de catálogo da VTEX
(`/api/catalog_system/pub/products/search`), então o resultado é **estável,
tipado e rápido** — nada de seletores HTML que quebram. O Actor é **stateful**:
guarda um snapshot dos preços no Key-Value Store e, a cada execução, compara com
a anterior. Perfeito para **repricing**, **monitoramento de concorrência** e
**revendedores** que precisam saber quando um preço mexe.

### Como funciona

1. Carrega o snapshot da última execução (vazio na primeira run).
2. Busca os preços atuais da loja (por palavra-chave ou por lista de URLs).
3. Compara produto a produto e marca `priceChanged` quando o valor difere.
4. Empilha **todos** os produtos no Dataset (com preço atual, anterior, delta e %).
5. Grava o snapshot novo para a próxima execução.

> **Primeira execução:** ainda não há histórico, então `previousPrice` é `null`
> e `priceChanged` é `false` para todos os produtos. A partir da 2ª run o
> Actor já detecta variações.

### Como rodar

1. Preencha `storeDomain` (ex.: `www.americanas.com.br`) e `searchQuery`
   (ex.: `notebook`) e clique em **Start**.
2. Acompanhe o run — os produtos aparecem no Dataset em tempo real.
3. **Agende execuções recorrentes** no **Scheduler** da Apify (ex.: a cada 6h)
   para monitoramento contínuo de preços.
4. Exporte em **JSON / CSV / Excel** ou consuma via **API** e **MCP**.

### Input

| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
| `storeDomain` | string | sim | Domínio da loja VTEX (sem `https://`). Ex.: `www.americanas.com.br`. |
| `searchQuery` | string | — | Palavra-chave a monitorar. Use isto **OU** `productUrls`. |
| `productUrls` | array | — | Lista de URLs de produtos VTEX específicos. Use isto **OU** `searchQuery`. |
| `maxItems` | integer | — | Máximo de produtos por execução (1–3000). Padrão 100. |
| `sort` | string | — | Ordenação VTEX (`OrderByPriceASC`, `OrderByPriceDESC`, etc.) ou vazio. |

#### Exemplo de input

```json
{
  "storeDomain": "www.americanas.com.br",
  "searchQuery": "notebook",
  "maxItems": 20
}
````

### Output

Cada item no Dataset:

```json
{
  "productId": "123456789",
  "name": "Notebook Acer Aspire 5",
  "brand": "Acer",
  "url": "https://www.americanas.com.br/produto/123456789/p",
  "currentPrice": 2799.0,
  "previousPrice": 2999.0,
  "priceChanged": true,
  "delta": -200.0,
  "deltaPercent": -6.67,
  "available": true,
  "currency": "BRL",
  "storeDomain": "www.americanas.com.br",
  "checkedAt": "2026-06-29T00:00:00.000Z"
}
```

### Preço — Pay Per Event

| Evento | Preço |
|---|---|
| `price-change-detected` | $0.01 por produto cujo preço **mudou** vs. a execução anterior |

Você paga **apenas pelo sinal de valor**: a primeira execução e produtos com
preço estável custam **zero**. Só há cobrança quando um preço efetivamente muda.

### Use com agentes de IA (MCP)

Este Actor é **compatível com o [Apify MCP Server](https://docs.apify.com/platform/integrations/mcp)** —
agentes de IA (Claude, ChatGPT, Cursor) podem chamá-lo diretamente: conecte o
MCP Server, o agente descobre o Actor pelo nome `vtex-price-monitor`, lê o
`input_schema` e chama com o input desejado. O `dataset_schema` garante output
tipado e estável.

### FAQ

- **Preciso de API key ou login?** Não — a API de catálogo da VTEX é pública.
- **Funciona com qual loja?** Qualquer loja feita em VTEX (Americanas,
  Submarino, Shoptime e milhares de e-commerces BR).
- **Como detecto mudanças?** Rode em agendamento recorrente — o Actor mantém o
  histórico de preços entre execuções automaticamente.
- **Em quais formatos exporto?** JSON, CSV, Excel, HTML table, ou via API/MCP.
- **O formato do output muda entre execuções?** Não — o `dataset_schema`
  mantém os campos estáveis.

### Changelog

- **0.1** — primeira versão: monitor de preços VTEX com diff entre execuções via Key-Value Store.

# Actor input Schema

## `storeDomain` (type: `string`):

Domínio da loja (sem https://). Ex.: "www.americanas.com.br", "www.submarino.com.br", "www.shoptime.com.br" ou qualquer loja feita em VTEX.

## `searchQuery` (type: `string`):

O que monitorar na loja. Ex.: "notebook", "geladeira", "iphone". Use isto OU productUrls.

## `productUrls` (type: `array`):

Lista de URLs de produtos VTEX específicos para monitorar. Use isto OU searchQuery. Ex.: https://www.americanas.com.br/produto/slug/p

## `maxItems` (type: `integer`):

Limite superior de produtos a monitorar por execução. A API VTEX entrega ~50 por página.

## `sort` (type: `string`):

Como ordenar os resultados da busca. Em branco = relevância padrão da VTEX.

## Actor input object example

```json
{
  "storeDomain": "www.americanas.com.br",
  "searchQuery": "notebook",
  "maxItems": 100,
  "sort": ""
}
```

# 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 = {
    "storeDomain": "www.americanas.com.br",
    "searchQuery": "notebook"
};

// Run the Actor and wait for it to finish
const run = await client.actor("geodetic_marigold/vtex-price-monitor").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 = {
    "storeDomain": "www.americanas.com.br",
    "searchQuery": "notebook",
}

# Run the Actor and wait for it to finish
run = client.actor("geodetic_marigold/vtex-price-monitor").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "storeDomain": "www.americanas.com.br",
  "searchQuery": "notebook"
}' |
apify call geodetic_marigold/vtex-price-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=geodetic_marigold/vtex-price-monitor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "VTEX Price Monitor — BR Stores",
        "description": "Monitor de preços para lojas VTEX brasileiras (Americanas, Submarino, Shoptime). Compara o preço atual com a execução anterior via API de catálogo e devolve preço atual, anterior, delta e variação %. Ideal para repricing e monitoramento de concorrência. Cobra só quando o preço muda.",
        "version": "0.1",
        "x-build-id": "ZBUsXmldcJ2OhxgDy"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/geodetic_marigold~vtex-price-monitor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-geodetic_marigold-vtex-price-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/geodetic_marigold~vtex-price-monitor/runs": {
            "post": {
                "operationId": "runs-sync-geodetic_marigold-vtex-price-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/geodetic_marigold~vtex-price-monitor/run-sync": {
            "post": {
                "operationId": "run-sync-geodetic_marigold-vtex-price-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "storeDomain"
                ],
                "properties": {
                    "storeDomain": {
                        "title": "Domínio da loja VTEX",
                        "minLength": 3,
                        "maxLength": 200,
                        "type": "string",
                        "description": "Domínio da loja (sem https://). Ex.: \"www.americanas.com.br\", \"www.submarino.com.br\", \"www.shoptime.com.br\" ou qualquer loja feita em VTEX."
                    },
                    "searchQuery": {
                        "title": "Palavra-chave de busca",
                        "maxLength": 200,
                        "type": "string",
                        "description": "O que monitorar na loja. Ex.: \"notebook\", \"geladeira\", \"iphone\". Use isto OU productUrls."
                    },
                    "productUrls": {
                        "title": "URLs de produtos (alternativa à busca)",
                        "uniqueItems": true,
                        "type": "array",
                        "description": "Lista de URLs de produtos VTEX específicos para monitorar. Use isto OU searchQuery. Ex.: https://www.americanas.com.br/produto/slug/p",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxItems": {
                        "title": "Máximo de produtos",
                        "minimum": 1,
                        "maximum": 3000,
                        "type": "integer",
                        "description": "Limite superior de produtos a monitorar por execução. A API VTEX entrega ~50 por página.",
                        "default": 100
                    },
                    "sort": {
                        "title": "Ordenação",
                        "enum": [
                            "",
                            "OrderByPriceASC",
                            "OrderByPriceDESC",
                            "OrderByTopSaleDESC",
                            "OrderByReleaseDateDESC",
                            "OrderByBestDiscountDESC"
                        ],
                        "type": "string",
                        "description": "Como ordenar os resultados da busca. Em branco = relevância padrão da VTEX.",
                        "default": ""
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
