{
  "openapi": "3.0.1",
  "info": {
    "title": "MarginDiff | Supplier Feed Auditor + Margin Risk",
    "description": "Audit supplier product feeds for pricing errors, negative margins, duplicate SKUs, missing product data, inventory drops, and catalog changes. Compare current and previous CSV or JSON feeds and receive actionable reports in HTML, CSV, and JSON formats.",
    "version": "0.1",
    "x-build-id": "LXBJBR6JLA7fRe7T6"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/001hp~margindiff-supplier-feed-auditor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-001hp-margindiff-supplier-feed-auditor",
        "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/001hp~margindiff-supplier-feed-auditor/runs": {
      "post": {
        "operationId": "runs-sync-001hp-margindiff-supplier-feed-auditor",
        "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/001hp~margindiff-supplier-feed-auditor/run-sync": {
      "post": {
        "operationId": "run-sync-001hp-margindiff-supplier-feed-auditor",
        "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": {
          "currentFeedUrl": {
            "title": "Current feed URL (HTTPS)",
            "type": "string",
            "description": "Public, unauthenticated HTTPS URL to a CSV, TSV or JSON feed. Provide EITHER this URL OR pasted text. No redirects or private addresses."
          },
          "currentFeedText": {
            "title": "Current feed CSV/JSON text",
            "type": "string",
            "description": "Paste CSV/TSV with headers or JSON array. Leave blank if using a URL."
          },
          "previousFeedUrl": {
            "title": "Previous feed URL (optional)",
            "type": "string",
            "description": "Optional public HTTPS URL to a previous snapshot for change detection."
          },
          "previousFeedText": {
            "title": "Previous feed CSV/JSON (optional)",
            "type": "string",
            "description": "Optional baseline for added/removed SKUs, price changes and stock drops."
          },
          "minMarginPercent": {
            "title": "Low gross margin threshold (%)",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Flag products with (price - unit cost) / price below this percentage. This ignores shipping and fees.",
            "default": 20
          },
          "priceChangeAlertPercent": {
            "title": "Large price change threshold (%)",
            "minimum": 1,
            "maximum": 1000,
            "type": "number",
            "description": "Compared to the previous feed.",
            "default": 25
          },
          "stockDropAlertPercent": {
            "title": "Stock decrease alert (%)",
            "minimum": 1,
            "maximum": 100,
            "type": "number",
            "description": "Flag products when their reported stock drops by this percentage or more relative to the previous feed.",
            "default": 50
          },
          "expectedCurrency": {
            "title": "Expected currency (optional)",
            "type": "string",
            "description": "Example: USD. Leave blank to skip this check."
          },
          "requireImage": {
            "title": "Flag empty image fields",
            "type": "boolean",
            "description": "If enabled, flag products with no image URL or an empty image field.",
            "default": true
          },
          "maxRows": {
            "title": "Maximum rows to audit",
            "minimum": 1,
            "maximum": 20000,
            "type": "integer",
            "description": "Hard maximum is 20,000 per feed. Raise only if your feeds require it.",
            "default": 10000
          },
          "skuColumn": {
            "title": "Override SKU header (optional)",
            "type": "string",
            "description": "Optional exact name of the SKU column when automatic header detection does not find it."
          },
          "titleColumn": {
            "title": "Override title header (optional)",
            "type": "string",
            "description": "Optional exact name of the product title column when automatic header detection does not find it."
          },
          "priceColumn": {
            "title": "Override price header (optional)",
            "type": "string",
            "description": "Optional exact name of the retail selling price column when automatic header detection does not find it."
          },
          "costColumn": {
            "title": "Override cost header (optional)",
            "type": "string",
            "description": "Optional exact name of the supplier unit cost column when automatic header detection does not find it."
          },
          "stockColumn": {
            "title": "Override stock header (optional)",
            "type": "string",
            "description": "Optional exact name of the stock quantity column when automatic header detection does not find it."
          },
          "currencyColumn": {
            "title": "Override currency header (optional)",
            "type": "string",
            "description": "Optional exact name of the currency column when automatic header detection does not find it."
          },
          "imageColumn": {
            "title": "Override image URL header (optional)",
            "type": "string",
            "description": "Optional exact name of the image URL column when automatic header detection does not find it."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}