# TikTok Shop Profit Guard — Margin & Break-Even (`rikayushi/tiktok-shop-profit-guard-margin-break-even`) Actor

Calculate TikTok Shop profit after fees, affiliates, ads, shipping, fulfillment, and returns, including break-even limits and downside scenarios.

- **URL**: https://apify.com/rikayushi/tiktok-shop-profit-guard-margin-break-even.md
- **Developed by:** [Diego Andrés Macedo](https://apify.com/rikayushi) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 profit analyses

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

## TikTok Shop Profit Guard

Turn product rows into a decision: **GO, WAIT, PASS, or CHECK INPUT**. The Actor calculates profit per order after landed cost, platform fees, affiliate commission, ads, fulfillment, shipping, and expected return losses. It also shows how much you can safely spend on ads or affiliate commission before the target margin disappears.

### Designed to connect to other Actors

Use either:

- inline `products` for fast tests; or
- `datasetIds` from a TikTok Shop scraper, supplier scraper, spreadsheet workflow, or Cross-Store Product Radar.

Common fields such as `price`, `salePrice`, `productId`, `productUrl`, `landedCost`, `supplierPrice`, and `currencyCode` are mapped automatically. No TikTok login or private seller data is required.

When source rows omit their currency, set `defaultCurrency` explicitly (for example `USD` or `MXN`). The Actor never guesses it from the store location.

Product rows may override global assumptions with fields such as `affiliateCommissionPct`, `adCostPerOrder`, `returnRatePct`, or `fulfillmentCost`. This lets one batch compare products with different creator deals or logistics costs. US-dollar fields used by common opportunity datasets (for example `tiktokPriceUsd` and `supplierUnitCostUsd`) are also recognized.

### What each result explains

- Base, optimistic, and conservative profit scenarios.
- Net profit, net margin, and ROI on landed cost.
- Maximum ad cost per order before profit reaches zero.
- Maximum affiliate commission that preserves your target margin.
- Minimum selling price needed for the target margin.
- Risk flags for missing cost, thin margin, downside losses, and high percentage fees.

The score is only a sortable planning signal. It does not predict demand, policy approval, supplier quality, or future profit.

### Fee assumptions

TikTok Shop fees vary by market, category, program, and date. The defaults are an editable example, not a promise of current fees. Before a real decision, copy the rates from your Seller Center statement or current policy page. Affiliate commission is controlled separately because the seller chooses it, and ad cost is modeled per order.

### Example

```json
{
  "products": [
    { "id": "dog-brush", "title": "Self-cleaning dog brush", "price": 29.99, "landedCost": 8.5, "currency": "USD" }
  ],
  "platformFeePct": 6,
  "affiliateCommissionPct": 15,
  "adCostPerOrder": 5,
  "outboundShipping": 0,
  "fulfillmentCost": 1,
  "returnRatePct": 5,
  "targetMarginPct": 20
}
```

### Positioning and launch price

Recommended Store price: **$0.50 per 1,000 completed `profit-analysis` events**. `CHECK_INPUT` rows and the run summary have no event charge. Competing TikTok opportunity tools commonly charge about $5–$50 per 1,000 results because they bundle scraping. Profit Guard stays inexpensive by analyzing existing rows and making every formula inspectable.

The Actor stops delivering analysis rows when the customer's maximum charge is reached and reports `notDelivered` in the run summary.

### Limits

- Planning model, not accounting, tax, legal, or financial advice.
- Taxes, subsidies, category exceptions, coupons, and special campaign fees must be added through the closest editable assumption or reviewed separately.
- Missing landed cost produces `CHECK_INPUT`; the Actor does not invent cost or margin.
- Invalid negative costs or percentage overrides outside their safe ranges produce `CHECK_INPUT` instead of an optimistic calculation.
- Dataset access depends on Apify storage permissions.

### Local verification

```sh
npm install
npm test
```

# Changelog

This Actor's version history is a separate document: https://apify.com/rikayushi/tiktok-shop-profit-guard-margin-break-even/changelog.md

# Actor input Schema

## `products` (type: `array`):

Paste product objects. Each needs a price; cost can be supplied per product or through the global default below.

## `datasetIds` (type: `array`):

Analyze product rows from existing TikTok Shop scrapers or other product datasets.

## `defaultLandedCost` (type: `number`):

Product cost plus inbound freight and duties. A product-level landedCost overrides this.

## `defaultCurrency` (type: `string`):

Optional ISO currency code used only when a product row does not include one, for example USD or MXN.

## `platformFeePct` (type: `number`):

Enter the current rate shown in your Seller Center for your country and category.

## `paymentFeePct` (type: `number`):

Optional payment-processing or transaction fee charged as a percentage of selling price.

## `affiliateCommissionPct` (type: `number`):

Commission paid to a creator or affiliate for an attributed order.

## `adCostPerOrder` (type: `number`):

Average advertising spend required to generate one completed order.

## `outboundShipping` (type: `number`):

Shipping cost paid by the seller after any customer payment or platform subsidy.

## `fulfillmentCost` (type: `number`):

Pick, pack, packaging, and fulfillment cost for one order.

## `otherCostPerOrder` (type: `number`):

Any other fixed per-order cost not already included above.

## `returnRatePct` (type: `number`):

Expected percentage of completed orders that create the configured return loss.

## `returnLossPerReturn` (type: `number`):

Return shipping, damaged stock, and non-refundable costs. Zero uses landed cost + fulfillment + outbound shipping.

## `targetMarginPct` (type: `number`):

Desired profit after modeled costs, expressed as a percentage of selling price.

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

Hard ceiling across inline products and connected datasets for cost control.

## Actor input object example

```json
{
  "products": [
    {
      "id": "sample-1",
      "title": "Sample product",
      "price": 29.99,
      "landedCost": 8.5,
      "currency": "USD"
    }
  ],
  "datasetIds": [],
  "defaultLandedCost": 0,
  "defaultCurrency": "",
  "platformFeePct": 6,
  "paymentFeePct": 0,
  "affiliateCommissionPct": 15,
  "adCostPerOrder": 5,
  "outboundShipping": 0,
  "fulfillmentCost": 1,
  "otherCostPerOrder": 0,
  "returnRatePct": 5,
  "returnLossPerReturn": 0,
  "targetMarginPct": 20,
  "maxProducts": 500
}
```

# Actor output Schema

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

Per-product GO, WAIT, PASS, or CHECK_INPUT analyses plus the run summary.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("rikayushi/tiktok-shop-profit-guard-margin-break-even").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("rikayushi/tiktok-shop-profit-guard-margin-break-even").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 '{}' |
apify call rikayushi/tiktok-shop-profit-guard-margin-break-even --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rikayushi/tiktok-shop-profit-guard-margin-break-even"
        }
    }
}
```

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/4deXdyynZhNicbwSW/builds/QfHk0JF9HnmQ0xjAY/openapi.json
