{
  "openapi": "3.0.1",
  "info": {
    "title": "Taiwan Broker Financials API (證券商財務・月計表)",
    "description": "Monthly balance sheet and income statement for every Taiwan securities firm since 2013, each firm's full 746-account trial balance and 312-account income statement, and the register of firms and branches with headcount. Official TWSE reports, cross-checked against each other.",
    "version": "0.1",
    "x-build-id": "dphyWxYIWgKO13JKS"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/chamarix~taiwan-broker-financials/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-chamarix-taiwan-broker-financials",
        "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-broker-financials/runs": {
      "post": {
        "operationId": "runs-sync-chamarix-taiwan-broker-financials",
        "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-broker-financials/run-sync": {
      "post": {
        "operationId": "run-sync-chamarix-taiwan-broker-financials",
        "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": {
          "recordTypes": {
            "title": "What to fetch",
            "type": "array",
            "description": "Five record types in one dataset, told apart by record_type. trial_balance is large — about 48,000 rows, 746 accounts for each of 65 firms — so it is off by default; use brokerCodes or accountCodes to cut it down.",
            "items": {
              "type": "string",
              "enum": [
                "monthly_financials",
                "income_statement",
                "trial_balance",
                "firm",
                "branch"
              ],
              "enumTitles": [
                "monthly_financials — condensed balance sheet + month and year-to-date P&L per firm (history from 2013-01)",
                "income_statement — every revenue and expense account per firm, month and year to date (latest month, ~20,000 rows)",
                "trial_balance — every account's debits, credits and balance per firm (latest month, ~48,000 rows)",
                "firm — register of securities firms: capital, licences, chairman, headcount (today)",
                "branch — every branch office with address, opening date and headcount (today)"
              ]
            },
            "default": [
              "monthly_financials"
            ]
          },
          "startMonth": {
            "title": "Start month (YYYY-MM)",
            "pattern": "^(|\\d{4}[-/]\\d{1,2})$",
            "type": "string",
            "description": "Leave both months empty for the latest published month. Fill them in for monthly_financials history, which starts in 2013-01. The other record types have no history at the source and are only included when the range reaches the last three months.",
            "default": ""
          },
          "endMonth": {
            "title": "End month (YYYY-MM)",
            "pattern": "^(|\\d{4}[-/]\\d{1,2})$",
            "type": "string",
            "description": "Last month to include. Defaults to the current month when a start month is given. A month's report appears on about the 20th trading day of the following month.",
            "default": ""
          },
          "brokerCodes": {
            "title": "Broker codes",
            "type": "array",
            "description": "Keep only these firm or branch codes, e.g. 9800 (Yuanta), 1020 (Taiwan Cooperative). Codes are four characters and may contain letters (9A00, 9B00). Leave empty for all.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "brokerCategories": {
            "title": "Firm categories (monthly_financials)",
            "type": "array",
            "description": "The exchange files firms in five categories. Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "integrated",
                "broker",
                "dealer",
                "futures_firm",
                "two_business"
              ],
              "enumTitles": [
                "integrated — 綜合證券商 (brokerage, dealing and underwriting)",
                "broker — 專業證券經紀商 (brokerage only)",
                "dealer — 專業證券自營商 (dealing only; reported from 2022-08)",
                "futures_firm — 期貨兼營證券商 (futures firms that also deal in securities)",
                "two_business — 經營二種業務證券商 (two of the three businesses; from 2017-07)"
              ]
            },
            "default": []
          },
          "accountCodes": {
            "title": "Account code prefixes (trial_balance, income_statement)",
            "type": "array",
            "description": "Keep only accounts whose six-digit code starts with one of these, e.g. 1 for assets, 401 for brokerage commission income, 902 for the profit lines. Leave empty for all.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "maxRequests": {
            "title": "Maximum requests",
            "minimum": 0,
            "type": "integer",
            "description": "A safety cap for long backfills. Each month is up to five spreadsheets plus one listing per year, so 2013 to today is about 670 requests. 0 lifts the cap.",
            "default": 250
          },
          "useApifyProxy": {
            "title": "Route requests through Apify Proxy",
            "type": "boolean",
            "description": "Turn this on for a full backfill. The exchange's CDN serves an anti-DDoS challenge to an address that downloads too quickly.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}