# Shopify Ecommerce Acquisition Diligence Pack (`practical_ai_lab_jp/pal-shopify-ecommerce-acquisition-diligence-pack`) Actor

Paste one Shopify store URL and get a severity-ranked catalog diligence pack: concentration, price architecture, availability depth and churn, with seller questions and source URLs.

- **URL**: https://apify.com/practical_ai_lab_jp/pal-shopify-ecommerce-acquisition-diligence-pack.md
- **Developed by:** [Practical AI Lab](https://apify.com/practical_ai_lab_jp) (community)
- **Categories:** E-commerce, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 80.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.10 / 1,000 diligence pack delivereds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Shopify Ecommerce Acquisition Diligence Pack

Paste **one Shopify store URL** and get a severity-ranked catalog diligence pack as JSON and CSV: how concentrated the assortment is, how the store leans on markdowns, how deep availability really is, and how much the catalog moves between runs. Every finding carries source URLs and a question to put to the seller.

It is built for ecommerce acquirers, search-fund analysts and brokers who need a fast, repeatable first look at a target's public catalog before an offer, instead of rebuilding the same spreadsheet from the storefront on every deal.

> **What this is not.** The public product feed contains listings only. It has no orders, revenue, traffic, margins, stock quantities or customer data. The scores describe the *catalog*, not the business. Treat the output as a screening aid and a list of questions, not as valuation or financial advice.

### Safe built-in example

The prefilled Store input has `demoMode: true` and `storeUrl: https://shop.example.com`. It executes the actual catalog-analysis logic on **clearly identified synthetic sample data**, without contacting a real store, saving a baseline, or charging any delivery event. The dataset marks every example row as `demoMode: true`; it is **not evidence about any real merchant**. For a live audit, **uncheck demoMode** and supply a real Shopify storefront with publicly accessible `/products.json` that permits the request in `robots.txt`.

### Start in one step

1. Uncheck `demoMode` and enter the actual Shopify store URL in `storeUrl`.
2. Run it. That is the whole onboarding. No CSV upload, no second snapshot, no account on the target store.

The first run reads the store's public catalog feed, builds the pack and stores a dated **baseline** snapshot for that domain. The output says `snapshot_status = BASELINE_CREATED`. Churn on a first run is only a single-snapshot proxy; measured changes start with the next run.

#### Repeat runs and scheduling

Run the Actor again with the same `storeUrl` (same Apify account) and it compares the store with the stored baseline, sets `snapshot_status = COMPARED_TO_BASELINE`, emits `changed_product` rows (repriced, newly out of stock or back in stock, new or ended markdowns, added, removed) and rolls the baseline forward.

The Actor does not run itself and does not send alerts. To monitor a target during a deal, create an **Apify Schedule** (Console > Schedules) that starts this Actor with your input, for example weekly (`0 6 * * 1`). Any notification, such as an email or webhook when a run finishes, is something you configure yourself in Apify; this Actor only produces the data.

Baselines are stored in a named key-value store in *your* account (default name `pal-shopify-diligence-baselines`), one record per store domain, with a bounded history of the last 12 run scores. Set `updateBaseline` to `false` for a one-off look that must not move the baseline.

### Input

| Field | Required | Default | Notes |
| --- | --- | --- | --- |
| `demoMode` | no | false (Store UI prefilled true) | Synthetic example; never charged or used as a live audit. |
| `storeUrl` | yes | none | For demo only, `https://shop.example.com`; for live mode, one genuine HTTPS Shopify storefront. |
| `maxProducts` | no | 2000 | 50-5000. Larger catalogs are read partially and flagged as a partial sample. |
| `maxChangedRecords` | no | 100 | 0-500. Most severe changed products emitted on repeat runs. |
| `requestTimeoutSecs` | no | 20 | 5-60. |
| `updateBaseline` | no | true | Save this run as the next comparison baseline. |
| `baselineStoreName` | no | `pal-shopify-diligence-baselines` | Use a different name to keep separate deal workspaces. |

Copy-ready input:

```json
{
  "demoMode": false,
  "storeUrl": "https://your-shop-domain.com",
  "maxProducts": 2000,
  "maxChangedRecords": 100,
  "updateBaseline": true
}
```

### What you get

**Dataset** (one flat table, also exported as CSV from the Apify dataset):

- Row `rank = 0`, `record_type = summary`: verdict, overall risk score (0-100), confidence, per-dimension scores, snapshot status, limitations, a few sample products and all feed URLs read.
- Every other row is ranked from most to least severe (`critical`, `high`, `medium`, `low`, `info`):
  - `buyer_outcome` - four separate decisions: *concentration and supplier dependency*, *discount dependence and margin quality*, *inventory and working capital*, *catalog momentum and data-room consistency*. Each has a status (`ACTION`, `WATCH`, `OK`, `NO_DATA`), a recommended buyer action and the top seller questions.
  - `finding` - one measured observation with `metric_name`/`metric_value`, `seller_question`, `source_url` and `source_urls` (feed page plus example product pages).
  - `changed_product` - repeat runs only; linked to the related finding through `finding_id`.

**Key-value store (run default store):** `DILIGENCE_PACK` (JSON with summary and rows), `DILIGENCE_PACK_CSV` (the same table as CSV; text that could be read as a spreadsheet formula is prefixed with an apostrophe) and `OUTPUT` (summary row).

Verdicts: `PAUSE_AND_VERIFY`, `CONDITIONS_REQUIRED`, `NO_MAJOR_CATALOG_FLAGS`, `INSUFFICIENT_SAMPLE`. `NO_MAJOR_CATALOG_FLAGS` means nothing alarming in the public catalog, not that the business is clean.

### How scoring works

Scores are risk scores from 0 (no concern) to 100 (severe). The overall score is a weighted mean of the dimensions that could be measured (concentration 30%, price 25%, availability 25%, churn 20%). Thresholds are heuristic screening rules, listed in `src/analysis.py`.

| Dimension | Measured from | Examples of findings |
| --- | --- | --- |
| Assortment concentration | Share of listed products by vendor and product type, top-3 share, vendor HHI | One product type or vendor dominates; many products have no type |
| Price architecture | Lowest variant price per product: median, percentiles, tiers; compare-at markdowns | Share of products on markdown, deep markdowns of 40% or more, zero prices, wide dispersion |
| Availability depth | Variant `available` flags | Share out of stock, broken variant runs, one category in stockout, entire catalog unavailable |
| Catalog churn | First run: published/updated dates. Repeat runs: added, removed, repriced, restocked, new markdowns | High listing turnover, mass repricing, promotion started between runs |

Catalog share is **not** sales share. Single-vendor (own-brand) stores are not penalised for vendor concentration.

### Safety and fair access

- Reads only the public `/products.json` feed of the single store you enter, paged at 250 products, and only if that store's `robots.txt` allows it for this Actor's user agent.
- `robots.txt` is fetched and evaluated before every host's first request, with wildcard and longest-match rules. A forbidden (401/403), unreadable, rate-limited or server-error `robots.txt` stops the run. A missing file (404/410) means no published restrictions.
- HTTPS only, default port only, no credentials in URLs, no IP-address or internal host names. Every resolved address must be publicly routable; the connection is pinned to the checked address, so a host cannot swap in a private address afterwards.
- Redirects are followed only within the same site and are robots-checked again. Responses are size-limited, uncompressed and time-limited, with a fixed request budget and a short delay between requests.
- No login, no proxies, no contact or personal-data collection. Product data only.

If any check refuses the run, the dataset gets one `run_status` row explaining why, the run ends as failed, no baseline is written and nothing is charged.

### Pricing

The Actor code defines one pay-per-event name, `diligence-pack-delivered`, charged once after a pack has been delivered. Refusals, validation errors, robots denials and missing data are never charged. No payable plan or price is configured in this project; set one only after commercial review.

### Limitations

- **Catalog only.** No revenue, orders, margins, traffic, stock quantities or customer data. Seller questions exist precisely because these gaps must be filled from the data room.
- **Sample size.** Fewer than 30 readable products: severities are capped at medium and confidence is `low`. A partial read (limit reached or a later page failing) lowers confidence one level and disables addition/removal counts.
- **Currency.** The feed does not state it; prices are shown as published and assumed to be in one currency.
- **Compare-at prices** are seller-set and may not reflect prices actually charged.
- **Availability** is a yes/no flag; backorder rules and quantities are invisible. Products with no flag are reported as unknown, not as out of stock.
- **Dates.** `updated_at` can be touched by apps and inventory syncs, so staleness is a proxy.
- **Repeat-run noise.** Short windows or small catalogs make change rates noisy; same-day reruns are labelled.
- **Not every store qualifies.** Stores that disable or password-protect the product feed, or disallow it in `robots.txt`, are refused rather than worked around.
- Only the lowest variant price is used for price statistics; products with variants priced 3x or more apart are reported.

### Format illustration

The block below only shows the shape of the output. All values are made-up placeholders, not results for a real store.

```json
{
  "rank": 2,
  "record_type": "finding",
  "severity": "high",
  "dimension": "price",
  "outcome_id": "discount_margin_quality_check",
  "finding_id": "PRICE_DISCOUNT_DEPENDENCE",
  "headline": "<share> of products are listed below a compare-at price",
  "metric_name": "on_sale_share",
  "metric_value": "<number between 0 and 1>",
  "seller_question": "Provide monthly net revenue, units and gross margin split between full-price and discounted sales ...",
  "source_url": "https://<store-domain>/products.json?limit=250&page=1",
  "snapshot_status": "COMPARED_TO_BASELINE",
  "store_domain": "<store-domain>",
  "run_date": "<YYYY-MM-DD>"
}
```

### Development

Tests are fully offline (fake transport, fake DNS, fake key-value store, fake Apify module):

```
python -m unittest discover -s tests -t .
```

Source layout: `src/main.py` (Actor I/O), `src/pipeline.py` (read, compare, assemble), `src/fetcher.py` and `src/safety.py` (robots, SSRF, limits), `src/analysis.py` (scoring), `src/state.py` (baseline persistence), `src/report.py` (rows and CSV).

# Actor input Schema

## `demoMode` (type: `boolean`):

Only the reserved https://shop.example.com hostname runs a synthetic free demo, even if this checkbox is omitted by API or automated QA. For a real Shopify store URL, leave unchecked.

## `storeUrl` (type: `string`):

One HTTPS storefront URL of the Shopify store under review. Only its public /products.json feed is read, and only if robots.txt allows it. Replace the sample with the real target.

## `maxProducts` (type: `integer`):

Upper bound on products analysed (250 per feed page). Larger catalogs are analysed partially and flagged as a partial sample.

## `maxChangedRecords` (type: `integer`):

On repeat runs, the most severe changed products (price, availability, markdown, added, removed) are emitted up to this limit. Use 0 to emit none.

## `requestTimeoutSecs` (type: `integer`):

Timeout for each HTTPS request to the store.

## `updateBaseline` (type: `boolean`):

Save this run as the new comparison baseline for the store. Turn off for a one-off look that must not move the baseline.

## `baselineStoreName` (type: `string`):

Named key-value store in your Apify account that holds one baseline per store domain. Keep the default unless you want separate deal workspaces.

## Actor input object example

```json
{
  "demoMode": false,
  "storeUrl": "https://shop.example.com",
  "maxProducts": 2000,
  "maxChangedRecords": 100,
  "requestTimeoutSecs": 20,
  "updateBaseline": true,
  "baselineStoreName": "pal-shopify-diligence-baselines"
}
```

# Actor output Schema

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

Download rows from the latest run in JSON/CSV.

# 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 = {
    "demoMode": false,
    "storeUrl": "https://shop.example.com"
};

// Run the Actor and wait for it to finish
const run = await client.actor("practical_ai_lab_jp/pal-shopify-ecommerce-acquisition-diligence-pack").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 = {
    "demoMode": False,
    "storeUrl": "https://shop.example.com",
}

# Run the Actor and wait for it to finish
run = client.actor("practical_ai_lab_jp/pal-shopify-ecommerce-acquisition-diligence-pack").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 '{
  "demoMode": false,
  "storeUrl": "https://shop.example.com"
}' |
apify call practical_ai_lab_jp/pal-shopify-ecommerce-acquisition-diligence-pack --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,practical_ai_lab_jp/pal-shopify-ecommerce-acquisition-diligence-pack"
        }
    }
}
```

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/ew5j0jfmrOlw7fV34/builds/V1SI7j3UO5OYQdVtI/openapi.json
