{
  "openapi": "3.0.1",
  "info": {
    "title": "Amazon FBA Profit Analyzer: Margin, ROI & Break-even",
    "description": "Works with the output of any Amazon scraper: FBA profit per unit, margin, ROI, break-even price and ROAS, opportunity score and price history, with the fees you enter or your own SP-API fee estimates. Never requests an Amazon web page.",
    "version": "0.1",
    "x-build-id": "ZxZrJdAlZakVhsBxn"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/badr_xba~amazon-fba-profit-analyzer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-badr_xba-amazon-fba-profit-analyzer",
        "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/badr_xba~amazon-fba-profit-analyzer/runs": {
      "post": {
        "operationId": "runs-sync-badr_xba-amazon-fba-profit-analyzer",
        "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/badr_xba~amazon-fba-profit-analyzer/run-sync": {
      "post": {
        "operationId": "run-sync-badr_xba-amazon-fba-profit-analyzer",
        "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": {
          "datasetIds": {
            "title": "Apify dataset ids",
            "type": "array",
            "description": "Pick (or paste the ID of) one or more datasets: the output of ANY Amazon scraper on Apify. The formats of <code>badr_xba/amazon-product-scraper</code> and <code>badr_xba/amazon-bestsellers-profit</code> are mapped field by field, plus generic asin / title / price / currency / rating / reviewsCount / bsr / category / brand / url / image fields. Read only."
          },
          "fileUrls": {
            "title": "File URLs (JSON / JSONL / CSV)",
            "type": "array",
            "description": "http(s) URLs of your own Amazon product data: a JSON array (or an object with <code>items</code> / <code>data</code> / <code>products</code>), JSON Lines, or CSV with a header row. Amazon web pages are refused: give the data a scraper produced, not the Amazon page.",
            "items": {
              "type": "string"
            }
          },
          "marketplace": {
            "title": "Marketplace (when your data does not show it)",
            "enum": [
              "US",
              "CA",
              "MX",
              "BR",
              "UK",
              "DE",
              "FR",
              "IT",
              "ES",
              "NL",
              "BE",
              "SE",
              "PL",
              "IE",
              "TR",
              "AE",
              "SA",
              "EG",
              "IN",
              "ZA",
              "JP",
              "AU",
              "SG"
            ],
            "type": "string",
            "description": "Used only for rows without a marketplace (country code, Amazon domain or URL). Needed for the SP-API and to read an ambiguous \"$\" price."
          },
          "referralFeePercent": {
            "title": "Referral fee (% of the price)",
            "minimum": 0,
            "maximum": 99.99,
            "type": "number",
            "description": "Amazon's referral fee for your category, in % of the selling price, as shown in <b>your</b> Seller Central fee schedule. <b>Required</b> to compute the profit, unless your own SP-API keys are given. Never invented by this Actor."
          },
          "fbaFeePerUnit": {
            "title": "FBA fulfilment fee per unit",
            "minimum": 0,
            "type": "number",
            "description": "Amazon's FBA fulfilment fee for this size / weight tier. <b>Required</b> to compute the profit, unless your own SP-API keys are given."
          },
          "storageFeePerUnit": {
            "title": "Storage fee per unit",
            "minimum": 0,
            "type": "number",
            "description": "Monthly storage fee per unit (your estimate for the months the unit stays in stock). Added on top of SP-API estimates too."
          },
          "inboundPlacementFeePerUnit": {
            "title": "Inbound placement fee per unit",
            "minimum": 0,
            "type": "number",
            "description": "Amazon's inbound placement service fee per unit, if any. Added on top of SP-API estimates too."
          },
          "closingFeePerUnit": {
            "title": "Closing fee per unit",
            "minimum": 0,
            "type": "number",
            "description": "Variable closing fee (media categories). Not used when SP-API estimates are received (Amazon includes it)."
          },
          "unitCost": {
            "title": "Unit cost (purchase price)",
            "minimum": 0,
            "type": "number",
            "description": "What you pay per unit to your supplier. <b>Required</b> to compute the profit (or give it per ASIN in the costs file)."
          },
          "shippingToAmazonPerUnit": {
            "title": "Shipping to Amazon per unit",
            "minimum": 0,
            "type": "number",
            "description": "Freight from your supplier / warehouse to the Amazon fulfilment centre."
          },
          "prepPerUnit": {
            "title": "Prep per unit",
            "minimum": 0,
            "type": "number",
            "description": "Labelling, poly-bagging, prep service."
          },
          "packagingPerUnit": {
            "title": "Packaging per unit",
            "minimum": 0,
            "type": "number",
            "description": "Boxes, inserts, branded packaging."
          },
          "importPerUnit": {
            "title": "Import duties per unit",
            "minimum": 0,
            "type": "number",
            "description": "Customs duties, import taxes, broker fees per unit."
          },
          "adCostPerUnit": {
            "title": "Ad cost per unit",
            "minimum": 0,
            "type": "number",
            "description": "Average advertising (PPC) spend per unit sold. Excluded from the landed cost and from the break-even ROAS."
          },
          "otherPerUnit": {
            "title": "Other costs per unit",
            "minimum": 0,
            "type": "number",
            "description": "Anything else per unit (returns allowance, software, etc.)."
          },
          "costsFileUrl": {
            "title": "Per-ASIN costs file URL (optional)",
            "type": "string",
            "description": "A CSV / JSON / JSONL file with one row per ASIN: <code>asin</code> plus any of the cost fields above (e.g. <code>asin,unitCost,fbaFeePerUnit,referralFeePercent</code>). A value in the file replaces the run-wide value for that ASIN only."
          },
          "costCurrency": {
            "title": "Currency of your fees and costs",
            "enum": [
              "USD",
              "CAD",
              "MXN",
              "BRL",
              "EUR",
              "GBP",
              "SEK",
              "PLN",
              "TRY",
              "AED",
              "SAR",
              "EGP",
              "INR",
              "ZAR",
              "JPY",
              "AUD",
              "SGD"
            ],
            "type": "string",
            "description": "When set, products priced in another currency get no profit (it would mix currencies) and say so in <code>missing</code>. Empty: your amounts are read in each product's own currency."
          },
          "lwaClientId": {
            "title": "LWA client id (your SP-API app)",
            "type": "string",
            "description": "Optional. With your <b>own</b> Selling Partner API credentials, the fees come from Amazon's Product Fees API (getMyFeesEstimateForASIN, 1 request per second at most). <b>Implemented from Amazon's documentation, not yet verified with a live seller account.</b> Stored encrypted by Apify, never shown in logs or outputs."
          },
          "lwaClientSecret": {
            "title": "LWA client secret",
            "type": "string",
            "description": "Secret of your SP-API app (Login with Amazon). Never shown in logs or outputs."
          },
          "refreshToken": {
            "title": "Refresh token",
            "type": "string",
            "description": "Refresh token from authorising your own seller account (it starts with Atzr|). Never shown in logs or outputs."
          },
          "onlyComputed": {
            "title": "Only products with a computed profit",
            "type": "boolean",
            "description": "By default, products whose profit cannot be computed (missing fee or cost) are still delivered, free, with <code>missing</code> explaining why. Switch on to leave them out.",
            "default": false
          },
          "minProfitPerUnit": {
            "title": "Minimum profit per unit",
            "type": "number",
            "description": "Keep only products with at least this profit per unit (unknown profit is left out when set)."
          },
          "minMarginPercent": {
            "title": "Minimum margin %",
            "type": "number",
            "description": "Keep only products with at least this margin (profit / price)."
          },
          "minRoiPercent": {
            "title": "Minimum ROI %",
            "type": "number",
            "description": "Keep only products with at least this ROI (profit / landed cost)."
          },
          "minOpportunityScore": {
            "title": "Minimum opportunity score",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "0-100. Keep only products with at least this score."
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "opportunityScore",
              "profitPerUnit",
              "marginPercent",
              "roiPercent",
              "inputOrder"
            ],
            "type": "string",
            "description": "Order of the saved products. Missing values go last.",
            "default": "opportunityScore"
          },
          "maxItems": {
            "title": "Maximum products to save",
            "minimum": 0,
            "type": "integer",
            "description": "Saved after filters and sorting (also the maximum number of SP-API requests). <code>0</code> = no limit.",
            "default": 100
          },
          "useHistory": {
            "title": "Track price changes between runs",
            "type": "boolean",
            "description": "Keeps a snapshot of each product (price, profit) in a named key-value store, so the next run shows price changes.",
            "default": true
          },
          "historyStoreName": {
            "title": "History store name",
            "pattern": "^$|^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$",
            "type": "string",
            "description": "Named key-value store for the snapshots (letters, digits and dashes).",
            "default": "amazon-fba-profit-history"
          },
          "requestTimeoutSecs": {
            "title": "Request timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Per request, for your file URLs and the SP-API.",
            "default": 30
          },
          "failRunOnError": {
            "title": "Mark the run as failed on input errors",
            "type": "boolean",
            "description": "By default, a run where no input can be used (unknown dataset, unreadable file, no Amazon-like record) ends <i>Succeeded</i> with the reason in the status message and nothing charged. Switch on if your schedules or webhooks must see such runs as <i>Failed</i>.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}