# Amazon Storage Fee Exposure Audit (Offline CSV) (`practical_ai_lab_jp/pal-amazon-storage-fee-exposure-audit`) Actor

Audit your own inventory-age and storage-fee exports against a fee schedule you supply. Flags SKU-level aged-stock exposure, missing measurements and changes since a prior snapshot.

- **URL**: https://apify.com/practical_ai_lab_jp/pal-amazon-storage-fee-exposure-audit.md
- **Developed by:** [Practical AI Lab](https://apify.com/practical_ai_lab_jp) (community)
- **Categories:** E-commerce, Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 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.

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 Storage Fee Exposure Audit (Offline CSV)

Audit inventory-age and storage-fee exports that you already have permission to use. You supply the monthly fee schedule; the Actor calculates SKU-level storage cost, isolates the aged-stock surcharge, and highlights what needs attention.

This Actor **does not access Amazon or any other website**. It only analyzes the text you paste into the input. It requires no login, proxy or external API.

### What it does

1. **Aged-stock fee exposure per SKU** – base monthly fee plus the aged surcharge tier that applies to each SKU's age.
2. **Early warning** – SKUs entering a higher aged tier within a configurable window, with the projected surcharge at that tier.
3. **Missing data detection** – flags rows with missing or unusable dimensions, units, age, or an unknown size tier, and does not guess values.
4. **Prior snapshot comparison** – new SKUs, SKUs removed since the earlier export, and fee changes (with a significance threshold).

### Input

| Field | Purpose |
| --- | --- |
| `inventoryCsv` | Current export as CSV text (comma, tab or semicolon). Requires `sku`. Recognized: `asin`, `units`/`quantity`, `age_days`, `size_tier`, `length`/`width`/`height` or `unit_volume_cuft`. |
| `priorSnapshotCsv` | Optional earlier export in the same format. |
| `feeSchedule` | Your rates: `monthlyRatePerCuFt` per size tier, and `agedSurchargePerCuFt` thresholds. **No default rates are built in.** |
| `currency`, `dimensionUnit` | Report label and `in`/`cm`. |
| `agedFeeThreshold`, `approachingWindowDays`, `changeThresholdPct` | Flagging thresholds. |
| `maxRows` | Row safety limit (default 5000, max 20000). |

Sample input (the rates are placeholders, not official values; replace them with the ones from your own fee documentation):

```json
{
  "inventoryCsv": "sku,asin,units,age_days,size_tier,length,width,height\nMUG-001,B000000001,120,95,standard,5,4,4\nLAMP-220,B000000002,40,200,oversize,30,12,10\nCASE-9,B000000004,15,60,standard,,,",
  "priorSnapshotCsv": "sku,units,age_days,size_tier,length,width,height\nLAMP-220,40,170,oversize,30,12,10",
  "feeSchedule": {
    "monthlyRatePerCuFt": { "standard": 0.8, "oversize": 0.6 },
    "agedSurchargePerCuFt": [
      { "minAgeDays": 181, "ratePerCuFt": 0.5 },
      { "minAgeDays": 365, "ratePerCuFt": 6.0 }
    ]
  },
  "currency": "USD"
}
```

### Output

- **Dataset**: one item per SKU, sorted by aged surcharge, with fields such as `totalVolumeCuFt`, `baseMonthlyFee`, `agedSurcharge`, `totalMonthlyFee`, `daysToNextAgedTier`, `changeStatus`, `feeDelta`, `severity`, `flags`.
- **Key-value store `SUMMARY`**: totals, flag counts, top exposures, SKUs removed since the prior snapshot, warnings and caveats.

Flags: `high_aged_exposure`, `aged_surcharge_applies`, `approaching_aged_tier`, `missing_measurements`, `missing_units`, `missing_age`, `unknown_size_tier`, `duplicate_sku`, `fee_increase_vs_prior`, `new_since_prior`.

### Pricing

The code emits one `audit-completed` event after a successful audit. Failed runs (invalid input, no usable rows) are not charged. No payable plan is configured in this repository.

### Limitations

- Results are estimates from your supplied schedule, not Amazon invoices; real charges may differ because of rounding, measurement rules, unit weights, fee changes, removals or other factors this tool does not model.
- Only per-cubic-foot volume pricing is modeled. Other fee types (for example low-inventory or removal fees) are out of scope.
- Accuracy depends on your export. Rows with missing data are flagged and left unpriced instead of estimated.
- Prior-snapshot fees are recalculated with the current schedule, so changes reflect inventory shifts rather than rate changes.
- Duplicate SKUs are flagged, not merged, in the current file.
- With few SKUs (under 30) percentages and rankings are indicative only. The tool does not forecast sales or sell-through.
- Input is limited to 2 million characters per CSV and the configured row limit.

### Local tests

`python -m unittest discover tests` (offline, standard library only apart from the Actor runtime).

Use only data you are permitted to process.

# Actor input Schema

## `inventoryCsv` (type: `string`):

Paste CSV text exported from your own seller account. Needs a sku column; recognized columns include asin, units, age_days, size_tier, length, width, height (or unit_volume_cuft). Comma, tab or semicolon delimited.

## `priorSnapshotCsv` (type: `string`):

An earlier export in the same format. Used to detect new SKUs, removed SKUs and fee changes.

## `feeSchedule` (type: `object`):

Rates you take from your own current fee documentation. No default rates are assumed. monthlyRatePerCuFt maps size tiers to a monthly rate per cubic foot; agedSurchargePerCuFt lists age thresholds with an extra rate per cubic foot. The sample values are placeholders, not official rates.

## `currency` (type: `string`):

Label used in reports. No conversion is performed.

## `dimensionUnit` (type: `string`):

Unit of length, width and height columns.

## `defaultSizeTier` (type: `string`):

Tier used when a row has no size_tier value. Must exist in your fee schedule.

## `agedFeeThreshold` (type: `number`):

SKUs whose monthly aged surcharge reaches this amount are flagged high. Use 0 to flag any surcharge.

## `approachingWindowDays` (type: `integer`):

Flag SKUs that will enter a higher aged-surcharge tier within this many days.

## `changeThresholdPct` (type: `number`):

Increase versus the prior snapshot, in percent, that counts as significant.

## `maxRows` (type: `integer`):

Safety limit for rows analyzed in each CSV.

## Actor input object example

```json
{
  "inventoryCsv": "sku,asin,units,age_days,size_tier,length,width,height\nMUG-001,B000000001,120,95,standard,5,4,4\nLAMP-220,B000000002,40,200,oversize,30,12,10\nPAD-77,B000000003,300,370,standard,10,8,1\nCASE-9,B000000004,15,60,standard,,,\nTENT-5,B000000005,8,185,oversize,40,20,6",
  "priorSnapshotCsv": "sku,asin,units,age_days,size_tier,length,width,height\nMUG-001,B000000001,120,65,standard,5,4,4\nLAMP-220,B000000002,40,170,oversize,30,12,10\nPAD-77,B000000003,300,340,standard,10,8,1\nOLD-1,B000000009,10,100,standard,6,6,6",
  "feeSchedule": {
    "monthlyRatePerCuFt": {
      "standard": 0.8,
      "oversize": 0.6
    },
    "agedSurchargePerCuFt": [
      {
        "minAgeDays": 181,
        "ratePerCuFt": 0.5
      },
      {
        "minAgeDays": 271,
        "ratePerCuFt": 1.5
      },
      {
        "minAgeDays": 365,
        "ratePerCuFt": 6
      }
    ]
  },
  "currency": "USD",
  "dimensionUnit": "in",
  "defaultSizeTier": "standard",
  "agedFeeThreshold": 25,
  "approachingWindowDays": 30,
  "changeThresholdPct": 20,
  "maxRows": 5000
}
```

# 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 = {
    "inventoryCsv": `sku,asin,units,age_days,size_tier,length,width,height
MUG-001,B000000001,120,95,standard,5,4,4
LAMP-220,B000000002,40,200,oversize,30,12,10
PAD-77,B000000003,300,370,standard,10,8,1
CASE-9,B000000004,15,60,standard,,,
TENT-5,B000000005,8,185,oversize,40,20,6`,
    "priorSnapshotCsv": `sku,asin,units,age_days,size_tier,length,width,height
MUG-001,B000000001,120,65,standard,5,4,4
LAMP-220,B000000002,40,170,oversize,30,12,10
PAD-77,B000000003,300,340,standard,10,8,1
OLD-1,B000000009,10,100,standard,6,6,6`,
    "feeSchedule": {
        "monthlyRatePerCuFt": {
            "standard": 0.8,
            "oversize": 0.6
        },
        "agedSurchargePerCuFt": [
            {
                "minAgeDays": 181,
                "ratePerCuFt": 0.5
            },
            {
                "minAgeDays": 271,
                "ratePerCuFt": 1.5
            },
            {
                "minAgeDays": 365,
                "ratePerCuFt": 6
            }
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("practical_ai_lab_jp/pal-amazon-storage-fee-exposure-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 = {
    "inventoryCsv": """sku,asin,units,age_days,size_tier,length,width,height
MUG-001,B000000001,120,95,standard,5,4,4
LAMP-220,B000000002,40,200,oversize,30,12,10
PAD-77,B000000003,300,370,standard,10,8,1
CASE-9,B000000004,15,60,standard,,,
TENT-5,B000000005,8,185,oversize,40,20,6""",
    "priorSnapshotCsv": """sku,asin,units,age_days,size_tier,length,width,height
MUG-001,B000000001,120,65,standard,5,4,4
LAMP-220,B000000002,40,170,oversize,30,12,10
PAD-77,B000000003,300,340,standard,10,8,1
OLD-1,B000000009,10,100,standard,6,6,6""",
    "feeSchedule": {
        "monthlyRatePerCuFt": {
            "standard": 0.8,
            "oversize": 0.6,
        },
        "agedSurchargePerCuFt": [
            {
                "minAgeDays": 181,
                "ratePerCuFt": 0.5,
            },
            {
                "minAgeDays": 271,
                "ratePerCuFt": 1.5,
            },
            {
                "minAgeDays": 365,
                "ratePerCuFt": 6,
            },
        ],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("practical_ai_lab_jp/pal-amazon-storage-fee-exposure-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 '{
  "inventoryCsv": "sku,asin,units,age_days,size_tier,length,width,height\\nMUG-001,B000000001,120,95,standard,5,4,4\\nLAMP-220,B000000002,40,200,oversize,30,12,10\\nPAD-77,B000000003,300,370,standard,10,8,1\\nCASE-9,B000000004,15,60,standard,,,\\nTENT-5,B000000005,8,185,oversize,40,20,6",
  "priorSnapshotCsv": "sku,asin,units,age_days,size_tier,length,width,height\\nMUG-001,B000000001,120,65,standard,5,4,4\\nLAMP-220,B000000002,40,170,oversize,30,12,10\\nPAD-77,B000000003,300,340,standard,10,8,1\\nOLD-1,B000000009,10,100,standard,6,6,6",
  "feeSchedule": {
    "monthlyRatePerCuFt": {
      "standard": 0.8,
      "oversize": 0.6
    },
    "agedSurchargePerCuFt": [
      {
        "minAgeDays": 181,
        "ratePerCuFt": 0.5
      },
      {
        "minAgeDays": 271,
        "ratePerCuFt": 1.5
      },
      {
        "minAgeDays": 365,
        "ratePerCuFt": 6
      }
    ]
  }
}' |
apify call practical_ai_lab_jp/pal-amazon-storage-fee-exposure-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-amazon-storage-fee-exposure-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/HSy8TXDEHhZpCiTdy/builds/lNm8NodOz71K632ie/openapi.json
