{
  "openapi": "3.0.1",
  "info": {
    "title": "StockX Trading Cards Flip-Margin Tracker — Pokemon TCG",
    "description": "Track per-size bid, ask, and last-sale prices on StockX for trading-card sealed products (Pokemon TCG boxes, bundles) over time, with flip-margin signals (lastSale minus lowestAsk minus fees). Same time-series engine as our sneaker actor, retargeted at trading cards.",
    "version": "0.1",
    "x-build-id": "fSpvLLhTTy5rw7aPY"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/bovi~stockx-trading-cards-flip-tracker/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-bovi-stockx-trading-cards-flip-tracker",
        "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/bovi~stockx-trading-cards-flip-tracker/runs": {
      "post": {
        "operationId": "runs-sync-bovi-stockx-trading-cards-flip-tracker",
        "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/bovi~stockx-trading-cards-flip-tracker/run-sync": {
      "post": {
        "operationId": "run-sync-bovi-stockx-trading-cards-flip-tracker",
        "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",
        "required": [
          "slugs"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "stealth",
              "api"
            ],
            "type": "string",
            "description": "stealth = Playwright + Apify residential proxy (default; no StockX account needed). api = buyer-supplied StockX API key via official GetVariantMarketData endpoint (zero access friction, 25k req/24h; recommended if you have API access).",
            "default": "stealth"
          },
          "slugs": {
            "title": "Product slugs / URLs",
            "type": "array",
            "description": "StockX product slugs or full URLs to track. Example: 'nike-air-jordan-1-retro-high-og-chicago-2015' or 'https://stockx.com/nike-air-jordan-1-retro-high-og-chicago-2015'. Each slug is tracked for every size found on the product page.",
            "items": {
              "type": "string"
            }
          },
          "stockxApiKey": {
            "title": "StockX API key (api mode only)",
            "type": "string",
            "description": "Your personal StockX API key for mode='api'. Obtained from StockX developer portal (https://developer.stockx.com). Gives access to GetVariantMarketData with zero access friction. Never stored by this actor — used only for the duration of the run."
          },
          "stockxApiToken": {
            "title": "StockX Bearer token (api mode only)",
            "type": "string",
            "description": "StockX OAuth2 Bearer JWT token for mode='api'. Required alongside the API key. Obtain via StockX developer portal OAuth flow."
          },
          "alertAskDropPct": {
            "title": "Alert: lowest ask dropped by (%)",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Flag a result as 'ask_drop_alert' if the lowest ask for any size fell by this percentage or more since the last run. 0 = disabled. Example: 5 means alert if ask dropped 5% or more.",
            "default": 5
          },
          "alertNewLowAsk": {
            "title": "Alert: new all-time low ask",
            "type": "boolean",
            "description": "Flag a result as 'new_low_alert' if the current lowest ask is the lowest ever seen for that slug+size combination across all runs stored in the KV state.",
            "default": true
          },
          "alertFlipMarginMin": {
            "title": "Alert: minimum flip margin (USD)",
            "minimum": 0,
            "type": "number",
            "description": "Flag a result as 'margin_alert' when the computed flip margin (lastSale − lowestAsk − estimated fees) exceeds this threshold in USD. 0 = disabled.",
            "default": 0
          },
          "feesPct": {
            "title": "Transaction fees (%)",
            "minimum": 0,
            "maximum": 50,
            "type": "number",
            "description": "Total fees to subtract when computing flip margin. Default 12.5 covers the typical StockX seller fee (9.5%) + payment processing (~3%). Adjust to match your actual fee tier.",
            "default": 12.5
          },
          "kvStoreName": {
            "title": "KV store name (state)",
            "type": "string",
            "description": "Name of the Apify key-value store used to persist historical data across scheduled runs. Using the same name across scheduled runs lets the actor accumulate change-detection history. Change to isolate a fresh run.",
            "default": "stockx-trading-cards-flip-state"
          },
          "maxRetries": {
            "title": "Max browser mint retries (stealth mode)",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "How many times to retry the Playwright mint step on a 403 / PX challenge. Each retry uses a fresh residential IP. Higher values increase robustness at the cost of more compute units consumed on failures.",
            "default": 3
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "REQUIRED for stealth mode on Apify cloud — StockX is not reliable from datacenter IPs. Use Apify RESIDENTIAL. Ignored in api mode.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          },
          "headless": {
            "title": "Headless browser (stealth mode)",
            "type": "boolean",
            "description": "Run Playwright in headless mode. Always true on Apify cloud. Set false only for local debugging to watch the browser.",
            "default": true
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}