{
  "openapi": "3.0.1",
  "info": {
    "title": "Shopee Affiliate Products Finder",
    "description": "Discover viral Shopee products with commission rates and generate trackable short links (subIds) via the official Shopee Affiliate Open API (GraphQL + HMAC-SHA256).",
    "version": "4.0",
    "x-build-id": "H3Da67Vpshzwdsk5F"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/viralanalyzer~shopee-affiliate-products/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-viralanalyzer-shopee-affiliate-products",
        "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/viralanalyzer~shopee-affiliate-products/runs": {
      "post": {
        "operationId": "runs-sync-viralanalyzer-shopee-affiliate-products",
        "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/viralanalyzer~shopee-affiliate-products/run-sync": {
      "post": {
        "operationId": "run-sync-viralanalyzer-shopee-affiliate-products",
        "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": [
          "appId",
          "appSecret",
          "mode"
        ],
        "properties": {
          "appId": {
            "title": "Shopee Open API — App ID",
            "minLength": 5,
            "type": "string",
            "description": "Numeric ID from Shopee Affiliate Open Platform (Open API section in your affiliate dashboard at affiliate.shopee.com.br)."
          },
          "appSecret": {
            "title": "Shopee Open API — App Secret",
            "type": "string",
            "description": "Secret key from Shopee Affiliate Open Platform. Stored encrypted by Apify."
          },
          "mode": {
            "title": "Operation Mode",
            "enum": [
              "products",
              "shops",
              "campaigns",
              "conversions",
              "feeds"
            ],
            "type": "string",
            "description": "products = productOfferV2 | shops = shopOfferV2 | campaigns = shopeeOfferV2 | conversions = conversionReport | feeds = listItemFeeds + getItemFeedData",
            "default": "products"
          },
          "keywords": {
            "title": "Search Keywords (mode=products | shops)",
            "minItems": 0,
            "maxItems": 20,
            "type": "array",
            "description": "Product/shop search terms. Ignored for mode=campaigns | conversions | feeds. Each keyword runs a separate query; results deduplicated by entity ID.",
            "items": {
              "type": "string"
            }
          },
          "maxResults": {
            "title": "Max Results per Run (or per keyword for products/shops)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Open API page limit is 500. We paginate until reaching this total. Each entity = 1 PPE event.",
            "default": 50
          },
          "sortType": {
            "title": "Sort Order (mode=products | shops | campaigns)",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "Open API enum: 1=Relevance, 2=Sales, 3=High Price (Desc), 4=Low Price (Asc), 5=Commission High→Low (recommended for affiliates).",
            "default": 5
          },
          "minSales": {
            "title": "Minimum Sales (client-side filter)",
            "minimum": 0,
            "type": "integer",
            "description": "Drop products with fewer historical sales. Use 0 for no filter. mode=products only.",
            "default": 0
          },
          "minRating": {
            "title": "Minimum Rating (client-side filter)",
            "minimum": 0,
            "maximum": 5,
            "type": "number",
            "description": "Drop products with average rating below this (0-5). mode=products only.",
            "default": 0
          },
          "minCommissionRate": {
            "title": "Minimum Commission Rate %",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Drop products/shops with affiliate commission below this %. Use 0 for no filter. mode=products | shops.",
            "default": 0
          },
          "subIdsTemplate": {
            "title": "Sub-IDs Template (shortlink attribution)",
            "maxItems": 5,
            "type": "array",
            "description": "Optional. If non-empty, calls generateBatchShortLink for each discovered product. Max 5 subIds. Supported tokens: {{date}}, {{shopId}}, {{itemId}}, {{keyword}}. Empty array = skip shortlinks. Each generated shortlink = 1 additional PPE 'short-link-generated' event.",
            "items": {
              "type": "string"
            }
          },
          "conversionTimeRangeDays": {
            "title": "Conversion Time Window (days, mode=conversions only)",
            "minimum": 1,
            "maximum": 90,
            "type": "integer",
            "description": "Look back N days for conversionReport. purchaseTimeStart = now - N days.",
            "default": 30
          },
          "feedMode": {
            "title": "Feed Mode (mode=feeds only)",
            "type": "string",
            "description": "Specific feedMode enum value for listItemFeeds. Leave empty to list available feeds first.",
            "default": ""
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration (advanced, usually unnecessary)",
            "type": "object",
            "description": "Shopee Open API doesn't require proxy. Only enable if Apify IP gets rate-limited (error code 10030).",
            "default": {
              "useApifyProxy": 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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}