{
  "openapi": "3.0.1",
  "info": {
    "title": "EIA State Electricity Generation & Consumption API",
    "description": "Search US EIA state-level electricity generation (66K records) and consumption (27K records) for 1990-2025 across 54 states, 6 producer types, 14 energy sources. Renewable transition, fossil fuel share, year-over-year change. Public domain (17 U.S.C. § 105).",
    "version": "0.1",
    "x-build-id": "476FJtI7Sg8ZHzXyZ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/devone-studio~eia-state-electricity-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-devone-studio-eia-state-electricity-api",
        "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/devone-studio~eia-state-electricity-api/runs": {
      "post": {
        "operationId": "runs-sync-devone-studio-eia-state-electricity-api",
        "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/devone-studio~eia-state-electricity-api/run-sync": {
      "post": {
        "operationId": "run-sync-devone-studio-eia-state-electricity-api",
        "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": [
          "resource"
        ],
        "properties": {
          "resource": {
            "title": "Resource",
            "enum": [
              "generation",
              "consumption"
            ],
            "type": "string",
            "description": "Which EIA dataset to query.",
            "default": "generation"
          },
          "year": {
            "title": "Year (single)",
            "type": "integer",
            "description": "Specific year (1990-2025). Leave at 0 to use year_min/year_max.",
            "default": 0
          },
          "year_min": {
            "title": "Year Min",
            "type": "integer",
            "description": "Earliest year (1990-2025). Used when year=0.",
            "default": 1990
          },
          "year_max": {
            "title": "Year Max",
            "type": "integer",
            "description": "Latest year (1990-2025). Used when year=0.",
            "default": 2025
          },
          "state": {
            "title": "State",
            "type": "string",
            "description": "US state or territory 2-letter code (e.g. CA, TX, AK, DC, PR).",
            "default": ""
          },
          "state_name_search": {
            "title": "State Name Contains",
            "type": "string",
            "description": "Substring filter on state name (e.g. 'Texas').",
            "default": ""
          },
          "producer_type": {
            "title": "Producer Type",
            "enum": [
              "Total Electric Power Industry",
              "Electric Generators, Electric Utilities",
              "Electric Generators, Independent Power Producers",
              "Combined Heat and Power, Commercial Power",
              "Combined Heat and Power, Electric Power",
              "Combined Heat and Power, Industrial Power"
            ],
            "type": "string",
            "description": "EIA producer type filter.",
            "default": "Total Electric Power Industry"
          },
          "energy_source": {
            "title": "Energy Source",
            "enum": [
              "Total",
              "Coal",
              "Natural Gas",
              "Nuclear",
              "Petroleum",
              "Hydroelectric Conventional",
              "Wind",
              "Solar Thermal and Photovoltaic",
              "Geothermal",
              "Wood and Wood Derived Fuels",
              "Other Biomass",
              "Other Gases",
              "Other",
              "Pumped Storage"
            ],
            "type": "string",
            "description": "EIA energy source filter.",
            "default": "Total"
          },
          "min_generation_mwh": {
            "title": "Min Value (MWh or unit)",
            "type": "integer",
            "description": "Minimum generation (MWh) or consumption (raw units).",
            "default": 0
          },
          "max_generation_mwh": {
            "title": "Max Value (MWh or unit)",
            "type": "integer",
            "description": "Maximum generation (MWh) or consumption (raw units).",
            "default": 0
          },
          "is_renewable_only": {
            "title": "Renewable Only",
            "type": "boolean",
            "description": "Keep only renewable sources (Hydro / Wind / Solar / Geothermal / Wood / Other Biomass).",
            "default": false
          },
          "is_fossil_only": {
            "title": "Fossil Only",
            "type": "boolean",
            "description": "Keep only fossil sources (Coal / Natural Gas / Petroleum / Other Gases).",
            "default": false
          },
          "is_zero_emission_only": {
            "title": "Zero-Emission Only",
            "type": "boolean",
            "description": "Keep only zero-emission sources (Hydro / Wind / Solar / Geothermal / Wood / Nuclear).",
            "default": false
          },
          "recent_only": {
            "title": "Recent Only (last 3 years)",
            "type": "boolean",
            "description": "Restrict to 2023-2025.",
            "default": false
          },
          "sort_by": {
            "title": "Sort By",
            "enum": [
              "generation_desc",
              "generation_asc",
              "year_desc",
              "year_asc",
              "state_asc",
              "state_desc",
              "yoy_change_desc",
              "decade_change_desc"
            ],
            "type": "string",
            "description": "Sort field and direction.",
            "default": "generation_desc"
          },
          "max_results": {
            "title": "Max Results",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Maximum records to return (1-500).",
            "default": 50
          },
          "include_derived": {
            "title": "Include Derived Fields",
            "type": "boolean",
            "description": "Add per-state renewable share, fossil share, YoY change, decade change, etc.",
            "default": true
          },
          "include_metadata": {
            "title": "Include Metadata",
            "type": "boolean",
            "description": "Add a 'metadata' record with fetch info (rows scanned, fetched_at, source_url).",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}