{
  "openapi": "3.0.1",
  "info": {
    "title": "Power Flow Analyzer: MATPOWER, PSS/E RAW, CGMES Load Flow",
    "description": "Run AC/DC power flow, N-1 contingency, short-circuit and hosting capacity studies on power grids: MATPOWER, PSS/E RAW, CGMES, UCTE, pandapower or JSON tables. Get voltage and loading violations, losses, OPF prices, tables, Excel and grid diagrams. For engineers and AI agents.",
    "version": "0.1",
    "x-build-id": "0HpjtsIsoeypx1XeW"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/jumblemog~power-flow-analyzer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-jumblemog-power-flow-analyzer",
        "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/jumblemog~power-flow-analyzer/runs": {
      "post": {
        "operationId": "runs-sync-jumblemog-power-flow-analyzer",
        "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/jumblemog~power-flow-analyzer/run-sync": {
      "post": {
        "operationId": "run-sync-jumblemog-power-flow-analyzer",
        "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": {
          "networks": {
            "title": "Networks: links or built-in grids",
            "type": "array",
            "description": "Links to network files: MATPOWER .m or .mat, PSS/E RAW (v32, v33, v35) or RAWX, CGMES (a ZIP of the XML profiles), UCTE-DEF, IEEE common data format, PowerFactory DGS, PowSyBl IIDM, pandapower JSON or JSON tables. The format is found from the content; gzip and ZIP work, and #text on a ZIP link takes only matching files. Web servers, buckets, GitHub, GitLab, Google Drive and Dropbox work. Or a built-in grid's name: example, case9, case14, case39, case118, case300, case2869pegase, cigremv, gb ...",
            "items": {
              "type": "string"
            }
          },
          "upload": {
            "title": "Or upload a network file",
            "type": "string",
            "description": "A network file (or a ZIP of them) from your computer, studied together with any links."
          },
          "networkText": {
            "title": "Or paste a network file",
            "type": "string",
            "description": "The text of a network file: a MATPOWER case (function mpc = ...), a PSS/E RAW file, UCTE-DEF, IEEE common data format, or JSON."
          },
          "network": {
            "title": "Or a network as JSON tables",
            "type": "object",
            "description": "Tables of pandapower elements with pandapower's parameter names; buses are named and referred to by name. Lines and transformers take a standard type or their own parameters. Example: {\"bus\": [{\"name\": \"A\", \"vn_kv\": 20}, {\"name\": \"B\", \"vn_kv\": 20}], \"ext_grid\": [{\"bus\": \"A\"}], \"line\": [{\"from_bus\": \"A\", \"to_bus\": \"B\", \"length_km\": 3, \"std_type\": \"NA2XS2Y 1x95 RM/25 12/20 kV\"}], \"load\": [{\"bus\": \"B\", \"p_mw\": 2, \"q_mvar\": 0.5}]}"
          },
          "analyses": {
            "title": "Studies",
            "type": "array",
            "description": "What to work out for each network. The power flow always runs; the other studies start from it.",
            "items": {
              "type": "string",
              "enum": [
                "powerflow",
                "contingency",
                "shortcircuit",
                "hosting",
                "opf"
              ],
              "enumTitles": [
                "Power flow: voltages, branch loading, losses and limit checks (always runs)",
                "N-1 contingencies: every line and transformer out in turn",
                "Short circuit (IEC 60909): fault currents at every bus",
                "Hosting capacity: new generation or load each bus takes before a limit is passed",
                "Optimal power flow: the lowest-cost dispatch and the price at each bus (needs costs)"
              ]
            },
            "default": [
              "powerflow",
              "contingency",
              "shortcircuit"
            ]
          },
          "method": {
            "title": "Power flow",
            "enum": [
              "ac",
              "dc"
            ],
            "type": "string",
            "description": "AC unless the network is huge or only active power flows matter. When the AC power flow finds no solution after four tries, the DC one gives the flows and the findings say so.",
            "default": "ac"
          },
          "enforceReactiveLimits": {
            "title": "Keep generators within their reactive limits",
            "type": "boolean",
            "description": "A generator that would pass its reactive power limit holds that limit and gives up its voltage set point (PV to PQ), as a real machine does. Off, generators hold their voltage whatever it takes, as MATPOWER's runpf does by default.",
            "default": false
          },
          "loadScalingPercent": {
            "title": "Load (% of the network's)",
            "minimum": 0,
            "maximum": 1000,
            "type": "number",
            "description": "Every load scaled by this much: 120 is a 20% heavier day.",
            "default": 100
          },
          "generationScalingPercent": {
            "title": "Generation (% of the network's)",
            "minimum": 0,
            "maximum": 1000,
            "type": "number",
            "description": "Every generator's active power scaled by this much (machines and static generators such as solar and wind); the slack makes up the difference. Scale load and generation together to keep the slack's share.",
            "default": 100
          },
          "minVoltagePu": {
            "title": "Lowest allowed voltage (pu)",
            "minimum": 0.5,
            "maximum": 1,
            "type": "number",
            "description": "The voltage band's floor for every bus. Empty: the network's own limits per bus, else 0.95 pu."
          },
          "maxVoltagePu": {
            "title": "Highest allowed voltage (pu)",
            "minimum": 1,
            "maximum": 1.5,
            "type": "number",
            "description": "The voltage band's ceiling for every bus. Empty: the network's own limits per bus, else 1.05 pu."
          },
          "maxLoadingPercent": {
            "title": "Branch loading limit (% of rating)",
            "minimum": 1,
            "maximum": 1000,
            "type": "number",
            "description": "A line or transformer above this share of its rating is overloaded. Empty: each branch's own limit where the network gives one, else 100%."
          },
          "contingencyElements": {
            "title": "Outages to study",
            "type": "array",
            "description": "What the N-1 study takes out, one at a time. Parts the outage splits off keep running on their own generators where they have any.",
            "items": {
              "type": "string",
              "enum": [
                "line",
                "trafo",
                "trafo3w",
                "gen"
              ],
              "enumTitles": [
                "Lines",
                "Transformers",
                "Three-winding transformers",
                "Generators (not the slack)"
              ]
            },
            "default": [
              "line",
              "trafo",
              "trafo3w"
            ]
          },
          "maxContingencies": {
            "title": "Most outages to study",
            "minimum": 1,
            "maximum": 1000000,
            "type": "integer",
            "description": "Only the most loaded branches' outages, up to this many. Empty: every one, as far as the time limit allows (the most loaded first)."
          },
          "faultType": {
            "title": "Fault",
            "enum": [
              "3ph",
              "2ph"
            ],
            "type": "string",
            "description": "The fault type for the IEC 60909 short-circuit study.",
            "default": "3ph"
          },
          "shortCircuitCase": {
            "title": "Case",
            "enum": [
              "max",
              "min"
            ],
            "type": "string",
            "description": "IEC 60909's maximum case (voltage factor c = 1.1 above 1 kV) sizes breakers and busbars; the minimum case (c = 1.0 above 1 kV, the grid's smaller in-feed) checks that protection still sees a fault.",
            "default": "max"
          },
          "faultBuses": {
            "title": "Buses to fault",
            "type": "array",
            "description": "Bus names or numbers. Empty: every bus up to 2,000 buses, else the 500 best-connected buses at the highest voltages. Naming buses runs the study even when it isn't picked above.",
            "items": {
              "type": "string"
            }
          },
          "gridShortCircuitMva": {
            "title": "External grid short-circuit power (MVA)",
            "minimum": 0.1,
            "maximum": 1000000,
            "type": "number",
            "description": "The upstream grid's short-circuit power, for external grids that don't state it. Empty: typical values by voltage (500 MVA at 20 kV, 5,000 MVA at 110 kV ...), named in the notes."
          },
          "hostingKind": {
            "title": "Hosting capacity for",
            "enum": [
              "generation",
              "load"
            ],
            "type": "string",
            "description": "What is added at each bus, one bus at a time, until a voltage or loading limit is passed.",
            "default": "generation"
          },
          "hostingBuses": {
            "title": "Buses to study",
            "type": "array",
            "description": "Bus names or numbers. Empty: the buses with load (the lowest-voltage ones first, up to the most below). Naming buses runs the study even when it isn't picked above.",
            "items": {
              "type": "string"
            }
          },
          "hostingMaxBuses": {
            "title": "Most buses to study",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Each bus takes 10 to 30 power flows.",
            "default": 200
          },
          "outputs": {
            "title": "Files to make",
            "type": "array",
            "description": "Files for each network, saved in the run's key-value store. The dataset always gets a row per network with the numbers, the findings and links to the files.",
            "items": {
              "type": "string",
              "enum": [
                "tables",
                "excel",
                "pictures",
                "network",
                "matpower"
              ],
              "enumTitles": [
                "CSV tables: buses, branches, generators, loads and each study's results",
                "results.xlsx: a summary, the findings and every table in one workbook",
                "Pictures: the grid by loading, the voltage profile, the worst outages, hosting capacity",
                "The network as pandapower JSON (network.json)",
                "The network as a MATPOWER case (network.m)"
              ]
            },
            "default": [
              "tables",
              "excel",
              "pictures",
              "network"
            ]
          },
          "frequencyHz": {
            "title": "Frequency (Hz)",
            "minimum": 10,
            "maximum": 1000,
            "type": "number",
            "description": "The system frequency, for files that don't state it (MATPOWER and PSS/E don't): line charging and short-circuit currents depend on it. 60 for North America.",
            "default": 50
          },
          "timeLimitSeconds": {
            "title": "Time limit (seconds)",
            "minimum": 10,
            "maximum": 3300,
            "type": "integer",
            "description": "Downloading and studying stop after this long; what was done is kept. Long N-1 and hosting capacity studies stop early and say how far they got. Each network is billed for its own time.",
            "default": 300
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}