This document outlines how to connect to the watttime.org API in order to retrieve ISO Emissions data. You will find a list of cURL examples that can be reused with minimal changes required.
Authentication
The following cURL command is needed to retrieve a token which can be used in all of the API calls via WattTime. The Login endpoint uses basic authentication. You will need to create an account and use those credentials when calling the Login endpoint.
cURL
curl "https://api2.watttime.org/v2/login" \
-u 'username:password'
Response
{
"token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6ImJhc2ljIiwiaWF0IjoxNjc2NDc2NjA5LCJleHAiOjE2NzY0Nzg0MDksImlzcyI6IldhdHRUaW1lIiwic3ViIjoiYnBrcml2ZXIifQ.KxwryfgomcYZ-bV6m6T9v1EK4TNMoKfZGJ-AAADqyCrJppQS31CTIcs7t9W8sfohV9SDaSaDRFdsJzFPYVWNKP0a8tL4CabAhfgg393sLOBAY6rbIZp8rzigLk67bT4CbsmSj76wBEA-FiNZe-H03aWyghMW4oa3jPEddh7VFnsPmnB5Zkx4kJOTFCttWKw3m-7lPT8VxWHDJ6LUfumioP17PNsPd7Tog4L3PhWYV91jkJiLtC8BC_sWxyswbnfd01Rbj1Z-_1o399uhTcLGft-tuu7d1ew27zaHcQ4eC8mqIn6oLCMS0c6I1oBakasdfadsfasdfkj"
}
Connect to Real-Time Emissions Index by ISO Region API
The Real-Time Emissions Index API provides a real-time signal indicating the marginal carbon intensity for the local grid for the current time (updated every 5 minutes). This endpoint can return an index value, a MOER value, or both. This section will outline how to retrieve data from this API.
cURL
curl "https://api2.watttime.org/v2/index?ba=CAISO_NORTH&style=all" \
-H 'Authorization: Bearer [token]'
Response
{
"ba": "CAISO_NORTH",
"freq": "300",
"percent": "21",
"moer": "966",
"point_time": "2023-02-15T15:55:00Z"
}
Parameters
ba: Balancing Authority (see docs for options)
style: Units in which to provide realtime marginal emissions. Choices are 'percent', 'moer' or 'all'.