Skip to main content
Gary
Rank 1
Rank 1
March 9, 2017
Solved

Can we get access to the OVO energy online account API to download our smart meter usage data?

  • March 9, 2017
  • 227 replies
  • 36573 views

Hi Ovo,

I wondered whether the API that powers your live and historical usage page in the account menu is something you could look into opening up a bit so we can freely access our raw data and also perhaps it may stimulate some interesting community projects?

For instance (more sport related), Strava and Fitbit.

Best answer by g-de

Updated on 14/08/25 by Abby_OVO

 

Tim_OVO: “We love seeing the innovative ways our customers are using tech to help monitor and manage their energy usage. It’s inspiring us to think about ways to do energy differently. We know some customers have been using some of the application programming interface (APIs) behind our public facing services. While we’re OK with that, we do need to make you aware of a couple of things.

 

These APIs are designed to be used by OVO teams only, and aren't public facing. There are some downsides to using APIs that aren't for the public, and we wanted to let you know what these are. Behind the scenes, OVO uses APIs to share and update information between systems that power your bills and your online account. This is done in partnership with Kaluza, the tech company that’s part of the OVO family. They’ve built the billing platform designed to put our customers in the driving seat of their energy usage. 

 

These internal APIs are intended for use by Kaluza and its clients, who are energy retailers like OVO, rather than customers. Because of this, there’s no support for them being used anywhere else, which means they may be discontinued with no notice when we update our products and services. 

 

OVO Energy and Kaluza need to be able to monitor these APIs, and may block access if there's any problems in the future.

 

We know some customers may have put time and effort into developing solutions that use these API. So, now that you know the risks, we want to hear from you on how you’re using the APIs and the problems you’re solving with your DIY approach. 

 

Is there anything you’d like to see from OVO to help you monitor and manage your energy better? Leave a comment below to tell us.”

 

can you help me understand if the links above allow users to access raw data as if from an API?

I can certainly give it a go.

 

Firstly, big thanks to Timmo and other contributors for developing the library. All thanks go to them and links to buy them a coffee for their effort can be found on PyPi or GitHub:

https://pypi.org/project/ovoenergy/
https://github.com/timmo001/ovoenergy

 

I assume the way the library was developed this was to reverse engineer the My OVO website. That is, browse the website as normal and and monitor the traffic to see what OVO URLs and APIs it uses. Assuming this is the case, one of these URLs (get account IDs) already seems to be different but the library is still working for the moment. The APIs being used are not officially supported outside of the website, so first, a warning that any changes to the My OVO website may break the library.

 

For anyone using Python, you should be able to include the ovoenergy library and look at https://github.com/timmo001/ovoenergy/blob/master/ovoenergy/cli.py for how to use it.

 

For replicating this in other languages, the process seems to be as follows:

  1. Login by sending a POST request to https://my.ovoenergy.com/api/v2/auth/login with the following JSON in the body:
    {
    "username": "...",
    "password": "...",
    "rememberMe": true
    }

    From the response, save the cookies to use in all future requests.

  2. Next, send a GET request to https://smartpaym.ovoenergy.com/api/customer-and-account-ids . Be sure to save the items in the “accountIds” property (usually only one item).
  3. Finally, make a GET request to https://smartpaym.ovoenergy.com/api/energy-usage/daily/{accountId}?date={yyyy-MM} where {accountId} is the value from the previous request and {yyyy-MM} is the month in the format 2020-08.

You can also get monthly or half-hourly usage using the following URLs similar to step 3:

As mentioned above, if this is wanted for Home Assistant, the integration was added in version 0.114 (https://www.home-assistant.io/integrations/ovo_energy/).


Unfortunately the data only goes up to the end of the previous day as OVO no longer provide real-time data:

 

227 replies

Newcomer
February 4, 2023

@apolosisk You'll still need to authenticate first. See step 1 in the “beat answer" marked at the top of this thread. That should let you authenticate and store and auth cookie. Then include the cookie with the graphql request you're sending.

Just a note on your code, the content type header might need to be “application/json” and I expect it should just be”json=body” rather than wrapping in another document. I'm not sure on these though. Just something to try if you resolve the auth error and still encounter issues.

Newcomer
February 4, 2023

@apolosiskYou'll still need to authenticate first. See step 1 in the “beat answer" marked at the top of this thread. That should let you authenticate and store and auth cookie. Then include the cookie with the graphql request you're sending.

Just a note on your code, the content type header might need to be “application/json” and I expect it should just be”json=body” rather than wrapping in another document. I'm not sure on these though. Just something to try if you resolve the auth error and still encounter issues.



I have done that, but I am getting that error. I must be missing something in the latest POST:

#POST REQUEST TO LOGIN/AUTHENTICATE
url = 'https://my.ovoenergy.com/api/v2/auth/login'
myobj = {
"username": "ΧΧΧΧ@ΧΧΧΧ.com",
"password": "ΧΧΧΧ",
"rememberMe": True
}

x = requests.post(url, json = myobj)
#SAVE COOKIES
cookies = x.cookies

#GET ACCOUNT ID REQUEST
url = "https://smartpaym.ovoenergy.com/api/customer-and-account-ids"
y = requests.get(url, cookies=cookies)

#GET ACCOUNT ID BY MANIPULATING LISTS, JSON AND STRINGS
accountIds = list(y.json().values())[0][0]

#POST REQUEST TO GET BALANCE
url = "https://smartpaymapi.ovoenergy.com/bast/api/graphql"
#headers = {"Content-Type": "application/graphql"}

body = {
##The same as above. I removed it avoid making the thread long
}

response = requests.post(url, json={'query': body})

 

Newcomer
February 4, 2023

@apolosisk, see GraphQL.  I am surprised the OVO expose this to the client side APIs -- all sort of potential security vulnerabilities there, IMO.  However, what you are missing is easily obtained from the browser’s debug query log, and this is that the post expects a JSON encoded input:

{
  query: $QUERY,
  operationName: "LatestPeriod",
  variables: {id: $ACCOUNTNO }
}

where $ACCOUNTNO is yours and $QUERY is

query LatestPeriod($id: String!) {
  billingSummary(id: $id) {
    latestPeriod {
      data {
        payments {
          date
          description
          credit {
            pounds
          }
        }
        closingBalance {
          pounds
        }
      }
    }
  }
}

The GraphQL website gives the syntax of the QL, if you are interested.

Newcomer
February 6, 2023

@apolosisk, see GraphQL.  I am surprised the OVO expose this to the client side APIs -- all sort of potential security vulnerabilities there, IMO.  However, what you are missing is easily obtained from the browser’s debug query log, and this is that the post expects a JSON encoded input:

 

 

third_query = "query LatestPeriod($id: String!) { \n  billingSummary(id: $id) { \n    latestPeriod { \n      data { \n        payments { \n          date \n          description \n          credit { \n            pounds \n          } \n        } \n        closingBalance { \n          pounds \n        } \n      } \n    } \n  } \n} \n"

query = {
"query": third_query,
"operationName": "LatestPeriod",
"variables": {
"id": accountIds
}
}

response = requests.post(url,json=query)

I still do not understand what I am missing exactly. Is it in the headers? I have tried finding examples and playing around. I took the headers from the first POST (the login) and even made an update:

headers['Content-Type'] = "application/graphql"

I am not familiar with the authorisation and the examples online do not help

Newcomer
February 6, 2023

I am not familiar with the authorisation and the examples online do not help

You need to understand how session cookies work and walk through this using your browser debug console to walk through how the client-side JS code on an interactive myovo session builds up the necessary cookies and context.  The scripting syntax and the HTTP API are different for python and JS. It’s bit of tedious but fairly straight forward retro-engineering to work out what calls are needed.  I can only point the way, not do it all for you. 🙁

Tim_OVO
OVO Staff
OVO Forum Legend
April 2, 2024

We love seeing the innovative ways our customers are using tech to help monitor and manage their energy usage. It’s inspiring us to think about ways to do energy differently. We know some customers have been using some of the application programming interface (APIs) behind our public facing services. While we’re OK with that, we do need to make you aware of a couple of things.

 

These APIs are designed to be used by OVO teams only, and aren't public facing. There are some downsides to using APIs that aren't for the public, and we wanted to let you know what these are. Behind the scenes, OVO uses APIs to share and update information between systems that power your bills and your online account. This is done in partnership with Kaluza, the tech company that’s part of the OVO family. They’ve built the billing platform designed to put our customers in the driving seat of their energy usage. 

 

These internal APIs are intended for use by Kaluza and its clients, who are energy retailers like OVO, rather than customers. Because of this, there’s no support for them being used anywhere else, which means they may be discontinued with no notice when we update our products and services. 

 

OVO Energy and Kaluza need to be able to monitor these APIs, and may block access if there's any problems in the future.

 

We know some customers may have put time and effort into developing solutions that use these API. So, now that you know the risks, we want to hear from you on how you’re using the APIs and the problems you’re solving with your DIY approach. 

 

Is there anything you’d like to see from OVO to help you monitor and manage your energy better? Leave a comment below to tell us.

Carbon neutral - we need a community to get there! My green tech: Aclara SGM 1411-B smart meter, Chameleon IHD6
Newcomer
April 2, 2024

@Tim_OVO Primarily through Home Assistant to populate the energy dashboard: https://www.home-assistant.io/integrations/ovo_energy/

I found that this integration didn’t provide information reliably enough though (can’t remember what the issue was) so currently use a ShellyEM for energy monitoring. I currently only use the integration for energy/unit costs, however this still has limitations.

The ideal I think for home assistant would be to have separate gas and electricity usage available as quickly as possible (I realise a limitation on the smart meters is every 30 mins), along with the price per unit (for those using separate energy monitoring such as with a Shelly), and overall cost (i.e. how much have I used so far in £). Essentially, the information that is visible on the IHD.

This isn’t currently covered, but solar FIT rates and standing charges would also be very valuable and should be fairly static data. This would allow the energy dashboard to be fully populated in real time for those with something like a ShellyEM doing the monitoring, and accurate to ~30mins for those without.

Newcomer
April 2, 2024

https://shop.glowmarkt.com/products/display-and-cad-combined-for-smart-meter-customers

 

Works fine for getting me information into home assistant, and it's not likely to have the rug pulled from under you. 

Newcomer
April 2, 2024

@Fuzzysteve Good to know. I think I looked at their products at one point but wasn’t sure about compatibility. That might have changed now so I’ll take a look. The app provided me with closer to real-time usage for a while, but then the APIs to grab the data seemed to start having issues. Possibly DoS protection given I wasn’t paying for anything 🤷‍♂️

Tim_OVO
OVO Staff
OVO Forum Legend
April 4, 2024

Another bit of feedback from @blakedrayson who is happy for me to post here on their behalf:

I think that from an API perspective Octopus has been great. However I have continued to use the products of Hildebrand (their SMETS 2 IHD is brilliant and has been a good way to work around supplier areas that were lacking).

I have managed to write a lot of code that integrates with their systems and build my own home display and automation.

I think you could do a lot worse than taking a look at what is provided by Hildebrand 
https://glowmarkt.com/support/data and what Octopus provides as well https://developer.octopus.energy/docs/api/.

Carbon neutral - we need a community to get there! My green tech: Aclara SGM 1411-B smart meter, Chameleon IHD6