# Shopify Brand Name Reseller Usage Audit (`practical_ai_lab_jp/pal-shopify-brand-name-reseller-usage-audit`) Actor

Finds how public Shopify stores use your brand name, flags vendor mismatches, unusual naming and unlisted product-line claims, and reports new suspicious listings on repeat runs.

- **URL**: https://apify.com/practical_ai_lab_jp/pal-shopify-brand-name-reseller-usage-audit.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, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 store audit completeds

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 Brand Name Reseller Usage Audit

Brand-protection and channel teams use this Actor to see **how a public Shopify store uses your brand name**: which listings mention it, whether the vendor is one you authorized, whether the naming looks unusual, and whether a title claims a product line you do not sell. It stores a baseline, so later runs report **new or changed suspicious listings** instead of making you search by hand again.

The output is an evidence-backed, severity-ranked **review queue** (dataset + CSV). It is a list of leads for a human reviewer. **It is not a legal, trademark or counterfeit determination.**

### Start with one URL

The only required input is `storeUrl`.

```json
{ "storeUrl": "https://www.example-store.com" }
```

1. Run the Actor with that one URL. It reads the store's public product feed and writes a **`BASELINE_CREATED`** status record plus the current review queue.
2. For a real review, add `brandTerms` (the names you protect). Without them, the Actor falls back to the store's most common vendor names, which is only a rough demonstration mode and says so in its output.
3. Optionally add `authorizedVendors` and `authorizedProductNames` to cut false positives and enable product-line checks.
4. **Schedule the same input** (see below). From the second run on, the Actor reports what is new or changed since the stored baseline.

#### Copyable sample input

Replace the placeholder URL and names with your own. `sample_input.json` in this repository contains the same data.

```json
{
  "storeUrl": "https://www.example-reseller-store.com",
  "brandTerms": ["Acme Outdoors", "Acme"],
  "authorizedVendors": ["Acme Outdoors", "Trailhead Partners"],
  "authorizedProductNames": ["Summit Pack", "Ridge Jacket", "Aero Series"],
  "maxProducts": 500,
  "minSeverity": "low"
}
```

### Scheduling later runs

The Actor does **not** monitor anything by itself and sends **no alerts**. Change detection happens only when the Actor runs again.

- Create an Apify **Schedule** (or a saved Task with a schedule) that runs the Actor with the same input, for example daily or weekly.
- Keep `stateStoreName` unchanged. The baseline lives in a **named key-value store** in your Apify account (default `pal-brand-name-audit-state`), because the default store of a run is not shared between runs.
- Changing `brandTerms`, `authorizedVendors` or `authorizedProductNames` starts a **new baseline** for that store (the first run after the change reports `BASELINE_CREATED` again). Use `resetBaseline` to restart on purpose.
- Use Apify integrations or webhooks on the run if you want notifications; they are not built in.

### What you get: four buyer outcomes in one queue

Every flagged product is one joined record with its vendor, evidence snippets, reason codes, a severity score, a rank and a suggested review step.

| Outcome | What it finds |
| --- | --- |
| `vendor_mismatch` | The brand term appears in the title, tags, handle or description, but the vendor is not on your authorized list (or is empty). |
| `naming_anomaly` | Look-alike spellings (one edit away from a single-word brand term), replica or imitation wording, spacing variants, and vendor names that embed your brand but are not authorized. |
| `product_line_claim` | Titles that use the brand but match none of your authorized product names, and unverified "official" or "authorized dealer" claims. |
| `new_listing` | Suspicious listings that were not flagged in the stored baseline (new products, or existing products that became suspicious). Available from the second run. |

#### Severity

Each finding has a base score; a product's score is its highest finding plus 25% of the others (max 100). `high` is 70 or more, `medium` is 40 or more, otherwise `low`. Compatibility wording ("compatible with", "fits") lowers the vendor-mismatch score because it often marks a legitimate accessory listing. Scores are heuristics for ordering your review, not probabilities.

### Output

- **Dataset**: for each store, one `run_summary` record followed by `review_item` records ordered by severity. Views "Review queue" and "Run status and summary" are defined in the dataset schema.
- **Key-value store `OUTPUT`**: all store summaries, buyer-outcome counts with top items, and the limitations list.
- **Key-value store `REVIEW_QUEUE_CSV`**: the same review items as CSV (spreadsheet formulas in text are neutralized).

Run statuses: `BASELINE_CREATED` (first run), `DELTA_REPORTED` or `NO_CHANGES` (repeat runs), and refusal or error statuses `BLOCKED_BY_ROBOTS`, `ROBOTS_UNAVAILABLE`, `REFUSED_UNSAFE_URL`, `NO_PUBLIC_FEED`, `NO_PRODUCTS`, `NO_BRAND_TERMS`, `FETCH_INCOMPLETE`, `STATE_UNAVAILABLE`, `BASELINE_NOT_SAVED`, `INTERNAL_ERROR`.

**First run**: all flagged listings are emitted with `changeStatus: "baseline"`.
**Repeat runs**: records with `changeStatus` of `new_listing`, `newly_flagged` or `changed`, plus up to `repeatRunSampleSize` (default 5) highest-severity unchanged listings marked `unchanged_sample`. Cleared or removed listings are counted in the summary.

Illustrative record shape (placeholder values, not real results):

```json
{
  "recordType": "review_item",
  "storeHost": "shop.example.com",
  "rank": 1,
  "severity": "high",
  "severityScore": 71,
  "changeStatus": "new_listing",
  "outcomes": ["naming_anomaly", "vendor_mismatch", "new_listing"],
  "reasonCodes": ["counterfeit_wording", "vendor_mismatch"],
  "title": "...",
  "vendor": "...",
  "evidence": [{ "code": "counterfeit_wording", "field": "title", "snippet": "...", "note": "..." }],
  "recommendedReview": "..."
}
```

### Safety and access rules

- One public HTTPS storefront URL (plus up to four optional extra stores). Only the domain is used.
- Only the public `/products.json` feed is read, 100 products per request, at most `maxProducts` (default 500, max 3000) products and a fixed request cap per store.
- `robots.txt` is checked **before every storefront request** with the Actor's own user agent. Wildcards, `Allow`/`Disallow` precedence and `Crawl-delay` are honored. If robots access is forbidden, unreadable or unknown (HTTP 401/403, 5xx, network error), access is **refused**. A missing robots.txt (404/410) means no restrictions. The Actor never bypasses a block.
- SSRF protection: HTTPS only, port 443 only, no credentials in URLs, no IP-address, localhost or internal host names, every resolved address must be public, and the connection is pinned to the validated address. Redirects are limited to three, must stay on HTTPS, and each new host gets its own robots and address checks.
- Requests are paced (default 1 second apart), time-limited, size-limited and sequential. No login, no proxies, no contact or personal-data collection.

### Pricing event

The code defines one pay-per-event identifier, `store-audit-completed`, charged at most once per store when the catalog was fetched without errors, analyzed, and the baseline was saved. Errors, robots refusals, unsafe hosts, missing feeds, empty catalogs and state failures are **not** charged. **No payable plan is configured in this repository**; the event name only prepares for one.

### Limitations and sample-size caveats

- Results are heuristic review leads: keyword and spelling matching causes false positives (legitimate resellers, accessories, reviews, comparisons) and misses (images, non-English wording, brand terms written in unusual ways).
- Only the public feed is covered. Hidden, unpublished or password-protected products, and products beyond `maxProducts`, are not analyzed. If the cap cuts the catalog off, the summary says so.
- A small catalog or a single run is weak evidence of any pattern. Counts are anecdotal, not statistics.
- Look-alike detection covers single-word brand terms of five or more letters in titles, tags and vendor names. Wording checks are English-only. Descriptions are truncated to 3,000 characters.
- Vendor comparison normalizes case, punctuation and suffixes such as Inc, LLC and Store. Other differences are flagged for human review.
- With no `brandTerms`, the fallback treats common vendors as brands, so a multi-brand retailer will be flagged for carrying several brands.
- Baselines are keyed by store domain and brand configuration. Two runs at the same time for the same store may overwrite each other's baseline.
- Some stores disable the public feed or restrict it in robots.txt; those are reported as refused or unavailable.

### Local checks

The unit tests run offline with mocked HTTP, DNS and storage (no network, no Apify platform):

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

Run the Actor with the Apify CLI (`apify run`) or on the Apify platform using `.actor/input_schema.json`. Requirements: Python 3.10+ and the Apify Python SDK 3.x (`requirements.txt`).

# Actor input Schema

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

One public HTTPS storefront URL, for example https://www.example-store.com. Only the domain is used. The store's robots.txt is checked before every request.

## `brandTerms` (type: `array`):

Brand names to look for in titles, tags, descriptions and handles. If empty, the store's most common vendor names are used instead, which is only a rough demonstration mode.

## `authorizedVendors` (type: `array`):

Vendor names that may legitimately use the brand terms. The brand terms themselves are always treated as authorized vendors.

## `authorizedProductNames` (type: `array`):

Product names or product-line names from your catalog. Titles that use a brand term but match none of them are flagged as possible unlisted product lines. Leave empty to skip this check.

## `additionalStoreUrls` (type: `array`):

Up to 4 more public HTTPS storefront URLs, audited one after another with their own baselines.

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

Upper bound on products read from each public feed (100 per request).

## `minSeverity` (type: `string`):

Findings below this level are still tracked in the baseline but are not listed.

## `maxReviewItems` (type: `integer`):

Upper bound on review items written per store and run.

## `repeatRunSampleSize` (type: `integer`):

On repeat runs, the highest-severity unchanged listings to include as a sample next to the changed ones.

## `requestDelayMilliseconds` (type: `integer`):

Minimum pause between requests to one host. A longer robots.txt crawl-delay is honored.

## `resetBaseline` (type: `boolean`):

Ignore the stored baseline and create a new one from this run.

## `stateStoreName` (type: `string`):

Named key-value store in your account that keeps baselines between runs. Keep it unchanged for scheduled runs.

## Actor input object example

```json
{
  "storeUrl": "https://www.allbirds.com",
  "brandTerms": [
    "Allbirds"
  ],
  "maxProducts": 500,
  "minSeverity": "low",
  "maxReviewItems": 200,
  "repeatRunSampleSize": 5,
  "requestDelayMilliseconds": 1000,
  "resetBaseline": false,
  "stateStoreName": "pal-brand-name-audit-state"
}
```

# 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 = {
    "storeUrl": "https://www.allbirds.com",
    "brandTerms": [
        "Allbirds"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("practical_ai_lab_jp/pal-shopify-brand-name-reseller-usage-audit").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 = {
    "storeUrl": "https://www.allbirds.com",
    "brandTerms": ["Allbirds"],
}

# Run the Actor and wait for it to finish
run = client.actor("practical_ai_lab_jp/pal-shopify-brand-name-reseller-usage-audit").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 '{
  "storeUrl": "https://www.allbirds.com",
  "brandTerms": [
    "Allbirds"
  ]
}' |
apify call practical_ai_lab_jp/pal-shopify-brand-name-reseller-usage-audit --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-brand-name-reseller-usage-audit"
        }
    }
}
```

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/3Aer6ECXtuw9KSe0N/builds/jybUD77XFBQZguwcf/openapi.json
