Accessing your token

To use the endpoint, POST a valid username and password, e.g.,
{'username': 'myname', 'password': 'secret'}.
This will return a JSON response like
{'token': '0123abcdef4567abcdef0123abcdef4567abcdef'}.
POSTing to this endpoint does not modify the state of your token.

Possible errors

POST request

problem

response code

response content

/api/v1/obtain-token-auth/

missing username and password

400

{'username': ['This field is required.'], 'password': ['This field is required.']}

{'detail': 'Request was throttled. Expected available in 86400.0 seconds.'}

Authorization: Token badtoken

invalid token

401

{'detail': 'Invalid token'}

Authorization: Token

missing token

401

{'detail': 'Invalid token header. No credentials provided.'}

Find the balancing authority for a location

In order to get data about power grid operations at a particular point,
you need to know the name of the grid operator (technically the balancing authority).
For instance, the balancing authority for Berkeley, California is CAISO.

If you know the latitude and longitude for your location, you can find the balancing authority by querying the /api/v1/balancing_authorities/ endpoint.
This endpoint is accessible from Visitor, Open, and Pro accounts.

Use the loc query parameter. This accepts GeoJSON-formatted points,
like {"type":"Point","coordinates":[LON,LAT]}.

For instance, Berkeley is at latitude 37.871667, longitude -122.272778. So, a GET request to https://api.watttime.org/api/v1/balancing_authorities/?loc={"type":"Point","coordinates":[-122.272778,37.871667]} will return a JSON response like: