{
  "openapi": "3.0.1",
  "info": {
    "title": "TikTok Shop Profit Guard — Margin & Break-Even",
    "description": "Calculate TikTok Shop profit after fees, affiliates, ads, shipping, fulfillment, and returns, including break-even limits and downside scenarios.",
    "version": "0.0",
    "x-build-id": "QfHk0JF9HnmQ0xjAY"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/rikayushi~tiktok-shop-profit-guard-margin-break-even/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-rikayushi-tiktok-shop-profit-guard-margin-break-even",
        "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/rikayushi~tiktok-shop-profit-guard-margin-break-even/runs": {
      "post": {
        "operationId": "runs-sync-rikayushi-tiktok-shop-profit-guard-margin-break-even",
        "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/rikayushi~tiktok-shop-profit-guard-margin-break-even/run-sync": {
      "post": {
        "operationId": "run-sync-rikayushi-tiktok-shop-profit-guard-margin-break-even",
        "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",
        "properties": {
          "products": {
            "title": "Products",
            "type": "array",
            "description": "Paste product objects. Each needs a price; cost can be supplied per product or through the global default below.",
            "items": {
              "type": "object"
            },
            "default": [
              {
                "id": "sample-1",
                "title": "Sample product",
                "price": 29.99,
                "landedCost": 8.5,
                "currency": "USD"
              }
            ]
          },
          "datasetIds": {
            "title": "Apify dataset IDs (optional)",
            "type": "array",
            "description": "Analyze product rows from existing TikTok Shop scrapers or other product datasets.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "defaultLandedCost": {
            "title": "Default landed cost per unit",
            "minimum": 0,
            "type": "number",
            "description": "Product cost plus inbound freight and duties. A product-level landedCost overrides this.",
            "default": 0
          },
          "defaultCurrency": {
            "title": "Default currency code",
            "maxLength": 3,
            "type": "string",
            "description": "Optional ISO currency code used only when a product row does not include one, for example USD or MXN.",
            "default": ""
          },
          "platformFeePct": {
            "title": "TikTok Shop platform/referral fee (%)",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Enter the current rate shown in your Seller Center for your country and category.",
            "default": 6
          },
          "paymentFeePct": {
            "title": "Payment or transaction fee (%)",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Optional payment-processing or transaction fee charged as a percentage of selling price.",
            "default": 0
          },
          "affiliateCommissionPct": {
            "title": "Affiliate commission (%)",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Commission paid to a creator or affiliate for an attributed order.",
            "default": 15
          },
          "adCostPerOrder": {
            "title": "Advertising cost per order",
            "minimum": 0,
            "type": "number",
            "description": "Average advertising spend required to generate one completed order.",
            "default": 5
          },
          "outboundShipping": {
            "title": "Seller-paid shipping per order",
            "minimum": 0,
            "type": "number",
            "description": "Shipping cost paid by the seller after any customer payment or platform subsidy.",
            "default": 0
          },
          "fulfillmentCost": {
            "title": "Fulfillment and packaging per order",
            "minimum": 0,
            "type": "number",
            "description": "Pick, pack, packaging, and fulfillment cost for one order.",
            "default": 1
          },
          "otherCostPerOrder": {
            "title": "Other fixed cost per order",
            "minimum": 0,
            "type": "number",
            "description": "Any other fixed per-order cost not already included above.",
            "default": 0
          },
          "returnRatePct": {
            "title": "Expected return/refund rate (%)",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Expected percentage of completed orders that create the configured return loss.",
            "default": 5
          },
          "returnLossPerReturn": {
            "title": "Loss per returned order",
            "minimum": 0,
            "type": "number",
            "description": "Return shipping, damaged stock, and non-refundable costs. Zero uses landed cost + fulfillment + outbound shipping.",
            "default": 0
          },
          "targetMarginPct": {
            "title": "Target net margin (%)",
            "minimum": 0,
            "maximum": 95,
            "type": "number",
            "description": "Desired profit after modeled costs, expressed as a percentage of selling price.",
            "default": 20
          },
          "maxProducts": {
            "title": "Maximum products",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Hard ceiling across inline products and connected datasets for cost control.",
            "default": 500
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}