Energy Information Administration Total Energy API

Comprehensive energy summaries across all sources.

OpenAPI Specification

energy-information-administration-total-energy-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: U.S. Energy Information Administration Open Data CO2 Emissions Total Energy API
  description: The U.S. Energy Information Administration (EIA) Open Data API v2 provides free programmatic access to EIA's open energy data, including time-series datasets organized by energy category. The API uses a hierarchical route structure where each route corresponds to a category or dataset, and metadata about child routes, available facets, frequencies, and data columns is returned by querying any parent route. An API key, obtained via free registration at https://www.eia.gov/opendata/register.php, is required on every request and must be supplied as a URL query parameter.
  version: '2.1'
  contact:
    name: EIA Open Data
    url: https://www.eia.gov/opendata/
    email: EIA-OpenData@eia.gov
  license:
    name: EIA Copyrights and Reuse Policy
    url: https://www.eia.gov/about/copyrights_reuse.php
servers:
- url: https://api.eia.gov/v2
  description: EIA Open Data API v2 production server
security:
- apiKeyQuery: []
tags:
- name: Total Energy
  description: Comprehensive energy summaries across all sources.
paths:
  /total-energy/data:
    get:
      operationId: getTotalEnergy
      summary: Query total energy time series
      description: Returns aggregated total energy time-series data across all sources.
      tags:
      - Total Energy
      parameters:
      - $ref: '#/components/parameters/Frequency'
      - $ref: '#/components/parameters/DataArray'
      - $ref: '#/components/parameters/Start'
      - $ref: '#/components/parameters/End'
      - $ref: '#/components/parameters/Offset'
      - $ref: '#/components/parameters/Length'
      - $ref: '#/components/parameters/Out'
      responses:
        '200':
          description: Time-series response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeriesResponse'
components:
  parameters:
    Out:
      name: out
      in: query
      description: Output format.
      required: false
      schema:
        type: string
        enum:
        - json
        - xml
        default: json
    DataArray:
      name: data[]
      in: query
      description: Columns to include in the response (repeat for multiple columns).
      required: false
      schema:
        type: array
        items:
          type: string
      style: form
      explode: true
    End:
      name: end
      in: query
      description: Inclusive end of the date range (format depends on frequency, e.g. YYYY-MM-DD).
      required: false
      schema:
        type: string
    Length:
      name: length
      in: query
      description: Maximum number of rows to return (5,000 max for JSON, 300 max for XML).
      required: false
      schema:
        type: integer
        maximum: 5000
    Start:
      name: start
      in: query
      description: Inclusive start of the date range (format depends on frequency, e.g. YYYY-MM-DD).
      required: false
      schema:
        type: string
    Frequency:
      name: frequency
      in: query
      description: Periodicity of returned data (annual, monthly, quarterly, daily).
      required: false
      schema:
        type: string
        enum:
        - annual
        - quarterly
        - monthly
        - weekly
        - daily
        - hourly
    Offset:
      name: offset
      in: query
      description: Pagination offset (zero-based row index).
      required: false
      schema:
        type: integer
        minimum: 0
  schemas:
    SeriesResponse:
      type: object
      description: Time-series data response.
      properties:
        response:
          type: object
          properties:
            total:
              type: integer
              description: Total rows available for the query.
            dateFormat:
              type: string
            frequency:
              type: string
            data:
              type: array
              items:
                type: object
                additionalProperties: true
        request:
          type: object
        apiVersion:
          type: string
  securitySchemes:
    apiKeyQuery:
      type: apiKey
      in: query
      name: api_key
      description: Free API key obtained at https://www.eia.gov/opendata/register.php. Must be supplied on every request as the api_key URL parameter.