Country Energy Statistics API

Long annual energy series by country and year: population, GDP, primary energy and electricity generation, shares of electricity from renewables, solar, wind, coal, gas and nuclear, carbon intensity and energy per person.

$0.50 per 1,000 records

You pay only for the records you get. Zero records cost zero. 10,000 free records of this API to start (5,000 at the base price of $1 per 1,000), no card.

Try it
Ready-made, maintained by usRecords, 15 fieldsv1.0

Data from github.com/owid/energy-data

Get this data

Try it here with a few records, download the sample, fill a Google Sheet, or call it from your own code.

Try it

Countriesoptional
Country or region names in English, such as Canada or India. Leave empty for every country. One per line, or separated by commas.
Example: Canada, India
Start yearoptional
First year to return.
Example: 2015
Metricsoptional
Measures to keep, from: population, gdp, primary_energy_consumption, electricity_generation, renewables_share_elec, solar_share_elec, wind_share_elec, coal_share_elec, gas_share_elec, nuclear_share_elec, carbon_intensity_elec, energy_per_capita. The others come back empty. Leave empty for all. One per line, or separated by commas.
Example: renewables_share_elec, primary_energy_consumption

Run it on this page, or call it from your code with the endpoint in the developer section. A free key covers 10,000 records of this API, no card. Create a free key

For developers: the API and MCPThe endpoint, code in curl, JavaScript and Python, every input, and files for your tools
Endpoint
POSThttps://pullrow.dev/v1/apis/country-energy-statistics/run
  • Small runs answer in the same request; longer ones answer 202 with a run to poll.
  • fields returns only the fields you name. The examples send the ones picked on this page.
  • Idempotency-Key is optional. A retry with it is never charged twice.
  • You pay for records returned. Zero records cost zero.

Every run option, explained

Calling it needs a key
10,000 free records of this API to start. No card.
curl
curl -X POST "https://pullrow.dev/v1/apis/country-energy-statistics/run" \
  -H "Authorization: Bearer $PULLROW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":{"countries":["Canada","India"]},"max_items":50}'

Inputs

Send them as input in the request body. Leave one out to use its default.

countrieslist
Country or region names in English, such as Canada or India. Leave empty for every country.
example: Canada, India
start_yearnumber
First year to return.
example: 2015
metricslist
Measures to keep, from: population, gdp, primary_energy_consumption, electricity_generation, renewables_share_elec, solar_share_elec, wind_share_elec, coal_share_elec, gas_share_elec, nuclear_share_elec, carbon_intensity_elec, energy_per_capita. The others come back empty. Leave empty for all.
example: renewables_share_elec, primary_energy_consumption

What's in each record

15 fields.

Basics

  • ISO code

    ISO 3166 alpha-3 country code; empty for regions and groups.

    Example CAN

  • Population

    Example 35,962,236

  • Gdp

    Gross domestic product in international dollars.

    Example 1,568,025,782,105

  • Primary energy consumption

    Primary energy consumption in terawatt-hours.

    Example 4,021.453

  • Electricity generation

    Electricity generation in terawatt-hours.

    Example 661.08

  • Renewables share elec

    Share of electricity from renewables, in percent.

    Example 63.841%

  • Solar share elec

    Share of electricity from solar, in percent.

    Example 0.437%

  • Wind share elec

    Share of electricity from wind, in percent.

    Example 4.08%

  • Coal share elec

    Share of electricity from coal, in percent.

    Example 9.826%

  • Gas share elec

    Share of electricity from gas, in percent.

    Example 10.283%

  • Nuclear share elec

    Share of electricity from nuclear, in percent.

    Example 15.293%

  • Carbon intensity elec

    Grams of CO2 emitted per kilowatt-hour of electricity.

    Example 184.37

  • Energy per capita

    Primary energy use per person in kilowatt-hours.

    Example 111,824.336

Location

  • Country

    Country, region or group name.

    Example Canada

Dates

  • Calendar year

    Example 2015

Technical detailsField names and types for developers

Field names and types

The names your code reads in each record. "Filled" counts how many of the 3 sample records carry the field.

Field nameTypeShown on this page asFilled
countrytextCountry3 of 3
yearnumberCalendar year3 of 3
iso_codetextISO code3 of 3
populationnumberPopulation3 of 3
gdpnumberGdp3 of 3
primary_energy_consumptionnumberPrimary energy consumption3 of 3
electricity_generationnumberElectricity generation3 of 3
renewables_share_elecnumberRenewables share elec3 of 3
solar_share_elecnumberSolar share elec3 of 3
wind_share_elecnumberWind share elec3 of 3
coal_share_elecnumberCoal share elec3 of 3
gas_share_elecnumberGas share elec3 of 3
nuclear_share_elecnumberNuclear share elec3 of 3
carbon_intensity_elecnumberCarbon intensity elec3 of 3
energy_per_capitanumberEnergy per capita3 of 3

How it reads the site

Runs on a reader we built and maintain by hand for this site.

Sample records

Sample records
RecordISO codePopulationGdpPrimary energy consumptionElectricity generationRenewables share elecSolar share elecWind share elecCoal share elecGas share elecNuclear share elecCarbon intensity elecEnergy per capitaCountryCalendar year
1CAN35,962,2361,568,025,782,1054,021.453661.0863.841%0.437%4.08%9.826%10.283%15.293%184.37111,824.336Canada2015
2CAN36,353,3451,583,727,974,0223,973.037667.1364.565%0.451%4.636%9.746%9.866%15.098%180.88109,289.445Canada2016
3CAN36,808,4981,631,871,440,1854,026.635669.3565.819%0.495%4.708%9.384%9.182%15.03%172.06109,394.164Canada2017

Sample records from the example output this API publishes. Email addresses and phone numbers in them are masked. Hover over a column name to see the field name your code reads.

Reliability

Counted from real runs. Our own health checks are left out. A run succeeded when it finished and the site neither blocked it nor broke it.

Incidents and repairs

How it is kept working What a repair can't do

A ready-made API, maintained by us. It is not part of the daily check or the automatic rebuild yet.

  • You pay only for records returned. A run that returns none costs nothing.
Known limits
  • One row per country and year, from the 1800s or 1900s (it depends on the country) up to the latest year Our World in Data has published, usually one to two years ago.
  • Many values are empty for early years and smaller countries, and the latest year is often incomplete.
  • Besides countries the dataset has regions and groups such as World, Europe, Africa and income groups. Name them exactly as the dataset does.
  • Country names are matched in English, ignoring capitals. Energy values are in terawatt-hours, shares in percent, carbon intensity in grams of CO2 per kilowatt-hour, energy per capita in kilowatt-hours; GDP is in international dollars.
  • A run returns at most 20,000 rows. Our World in Data refreshes the dataset a few times a year, built from the Energy Institute, Ember and other sources.
  • Source: Our World in Data energy dataset, licensed CC BY 4.0: credit Our World in Data and its underlying sources when you publish.

Version history

A run uses the live version unless the request names another one with version.