{
  "openapi": "3.0.1",
  "info": {
    "title": "Taiwan Director Shareholdings & Pledge Ratio — 董監持股質押",
    "description": "Monthly shareholding balances for every director, supervisor, officer and 10% holder of a Taiwan-listed company, with the share-pledge ratio that flags a stake financed by debt. Shares at election vs held now, related-party holdings, TWSE, TPEx and Emerging boards, back to 1999.",
    "version": "0.1",
    "x-build-id": "Gvb5FfV21cchc2O7K"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/chamarix~taiwan-director-shareholdings/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-chamarix-taiwan-director-shareholdings",
        "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/chamarix~taiwan-director-shareholdings/runs": {
      "post": {
        "operationId": "runs-sync-chamarix-taiwan-director-shareholdings",
        "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/chamarix~taiwan-director-shareholdings/run-sync": {
      "post": {
        "operationId": "run-sync-chamarix-taiwan-director-shareholdings",
        "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": {
          "startMonth": {
            "title": "Start month (資料年月)",
            "pattern": "^(|\\d{4}-\\d{1,2})$",
            "type": "string",
            "description": "Month of the shareholding balance in YYYY-MM format. Leave empty for the latest published month, which is what the open-data feed carries — that is the fast path and covers every listed company in one request per board. MOPS holds this report from 1999-01 onwards.",
            "default": ""
          },
          "endMonth": {
            "title": "End month",
            "pattern": "^(|\\d{4}-\\d{1,2})$",
            "type": "string",
            "description": "Last month to cover, inclusive. Leave empty to fetch only the start month. Any month the open-data feed does not carry is read off MOPS one company at a time, so a historical range is far slower — set stockCodes to keep it sane.",
            "default": ""
          },
          "markets": {
            "title": "Boards",
            "type": "array",
            "description": "Which boards to cover. Leave empty for all three. 公開發行 (registered but untraded) companies are not covered.",
            "items": {
              "type": "string",
              "enum": [
                "TWSE",
                "TPEX",
                "EMERGING"
              ],
              "enumTitles": [
                "TWSE — listed (上市)",
                "TPEx — OTC (上櫃)",
                "Emerging — pre-IPO (興櫃)"
              ]
            },
            "default": []
          },
          "stockCodes": {
            "title": "Security codes filter",
            "type": "array",
            "description": "Optional list of security codes (e.g., ['2330', '2454']). On the latest month this just filters the feed. On a historical month it is what makes the run affordable — MOPS serves one company-month per request, so listing 10 codes over 12 months is 120 requests.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "roleCategories": {
            "title": "Office filter",
            "type": "array",
            "description": "Keep only insiders holding one of these offices. Derived from the 職稱 string MOPS publishes, longest match first, so 獨立董事 is never read as 董事. Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "DIRECTOR",
                "INDEPENDENT_DIRECTOR",
                "SUPERVISOR",
                "INDEPENDENT_SUPERVISOR",
                "MANAGER",
                "MAJOR_SHAREHOLDER",
                "OTHER"
              ],
              "enumTitles": [
                "Director (董事長/副董事長/常務董事/董事)",
                "Independent director (獨立董事)",
                "Supervisor (監察人)",
                "Independent supervisor (獨立監察人)",
                "Manager / officer (總經理/副總/協理/財會主管)",
                "10% shareholder (大股東)",
                "Other (其他)"
              ]
            },
            "default": []
          },
          "pledgedOnly": {
            "title": "Only insiders with pledged shares",
            "type": "boolean",
            "description": "Drop every row whose 設質股數 is zero. Pledging is how an insider raises cash against a stake without selling it, so this narrows the board straight to the leveraged holders.",
            "default": false
          },
          "minPledgeRatio": {
            "title": "Minimum pledge ratio (%)",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "Keep only rows whose published 設質股數佔持股比例 is at least this. A high ratio on a controlling holder is the classic Taiwanese warning sign — the stake is collateral, and a falling price can force it to be sold. Leave at 0 for everything.",
            "default": 0
          },
          "minShares": {
            "title": "Minimum shares held",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only rows where 目前持股 is at least this many shares. Useful for cutting the long tail of officers holding nothing. Leave at 0 for everything.",
            "default": 0
          },
          "maxCompaniesPerMonth": {
            "title": "Company cap per board-month (historical months only)",
            "minimum": 0,
            "type": "integer",
            "description": "Safety valve for a historical month requested without stockCodes: MOPS would otherwise be asked for every one of the ~1,080 listed companies, one request each. 0 means no cap. Whatever is dropped is named in the log — nothing is silently truncated.",
            "default": 100
          },
          "crossCheck": {
            "title": "Cross-check the feed against MOPS",
            "type": "boolean",
            "description": "For a month taken from the open-data feed, read the first three companies back off MOPS' own report — an entirely separate query path — and log whether every value reproduces. Costs three extra requests per board and never changes the output.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}