Wallbox : Get The Most Of It (with API)


Two month ago, I got myself a PHEV (Plug In Hybrid Electric Vehicle) and of course, thinking at the future, I also installed a class-2 charger at home. The obvious choice to me was the Wallbox Pulsar Plus charger. Small form factor, easy to set up, affordable and reliable. Wallbox software offering is great : centralized statistics on their website, mobile app, ... everything. But, is there any API available ? ;)

Of course there is!

Since the charger is connected to my network, I tried to directly connect to it. Only port 22 and 53 are opened. Yes, weird, port 53... In short, there is nothing you can do locally, you need to access the Wallbox portal to start playing with APIs.

I must admit that I was disappointed : no public documentation exists. Some people tried to integrate the home charger with some home automation platform like Jeedom, Homey or Home Assistant, but this is very light in terms of interactions and only provides elaborated code in either Python or JavaScript, I'm looking for the source APIs to create my own scripts.

What I was looking for was : getting charger details, current status, current configuration, lock/unlock remotely, get the statistics and play with it.... and anything else I could find on the way. Nothing available on the wallbox website, nothing available in the wallbox academy portal, .... very frustrating. 

Then, I started to do some reverse engineering on the plugins mentioned above and I've found some endpoints. Furthermore, using Chrome browser, you have the ability to sniff the API sent from the Wallbox official portal. Very interesting ;)

Wallbox APIs works in two stages : 

1) Get an authentication token;
2) Use the token to retrieve data for your charger(s)

The Token

The token is a 856 characters string which stays valid for 15 days. So, you need to manage that parameter and think at renewing it from time to time. Why not renewing it at each call you do ? I don't know what is the best practice at this point.

Here is the function to get the token : 

function wbGetToken($auth)

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    "Authorization: Basic ".base64_encode($auth["username"].":".$auth["password"]),
        'Accept: application/json, text/plain, */*',
        'Content-Type: application/json;charset=utf-8'
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_URL, "https://".$API."/auth/token/user");
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $result = curl_exec($curl);

    return json_decode($result)->jwt;

$auth is an array containing your credentials for accessing the wallbox portal.

Here is a sample : 

    "username" => "your_email_address",
    "password" => "your_pass"

When successfully executed, the token is returned this way : 

string(856) "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Im[...]Qk1BqrVqaZZgVJ49wVuhI8GcrRGC_RwLw604FsMcYScMUZZmdVwBV2Vq_ioBhIFh9vMWgTi4DaZjtHuV--T82gTBJipJIZCnh7ABCDFP4WocIVzEZJM51UnQT4gjxk3nt8-iZY3kuXjbFOfMhMthjpj3fRWBQL8HvKwiMegGIY3c_N2tUVdLolVIPuZGyGQmWEv74wuZBBLrrv52KTzw65tKjjuYyejQnA_mXQNsnsbilE"

Of course, I have stripped the output for security reason.

The code

Now that we have a token, we have 15 days to issue any API calls we want :)

You need to know the charger ID of your charger to start interacting with it. This is easy to get, when on the Wallbox portal, you can see your charger ID in the URL :

Let's try to get something useful.

This function return all information about a specific charger : 


php wallbox.php

object(stdClass)#4 (30) {
  string(20) "PulsarPlus SN XXXXXX"
  string(10) "PulsarPlus"
  string(9) "ocpp_1.6j"
  string(4) "wifi"
  string(3) "kWh"
  string(2) "kW"
  string(55) "https://api.wall-box.com/uploads/PLP1-0-2-4-0-002-A.png"
  string(7) "Private"

From the above example, you see how easy it is to get some information about the charger, the status, the configuration, ... And there is more. 

I have created a quick code that display all the relevant information in one screen : 

Happy with this result, I decided to create a background script recording the various status during a charging session : energy injected against power of charge. This is leading to an interesting graphic : 

On this graph we see in orange the charging power in kW. My charger is capable (both the wallbox and the onboard charger in my car) of delivering 7.22 kW. Sometimes, the charging power is less, this is because my setup is equipped with a powerboost which is giving priority to the house. For example, when using the dishwasher or the frier, the energy demand for the house is higher, then the car is becoming secondary and the charger is lowering the load to prevent any circuit break down. This is a mandatory option in my opinion.

At the end of the charing session, we see the charging power is less, this is very common on EV when reaching the end of the charge.

The blue line is of course the energy delivered to the battery in kWh.

I'm still learning the API, and I'm also trying to get in touch with some Wallbox engineers but they are hard to get in touch with. I still have a lot of question of course ! ;)

All the information and scripts in this post can be found on my GitHub Repo.
More to come ...

I hope this helps !


  1. Hi, thats awesome! I was wondering, are you able to control (i.e. turn on and off) the charging the EV charger using that token?

    1. Hello, if you mean stop the charge, yes you can pause it. Sorry, not sure I totally got your point.

  2. Hi Frederic, thanks for this, do you know if the API also supports restarting the unit (if there is an error). Thanks!

    1. Hi There, I never tried it, probably, there is a POST command allowing a unit restart. What do you mean by "if there is an error" ?

  3. I'm looking at a way how to turn on charging based on current kwh pricing. In The Netherlands there are energy suppliers delivering power with an hourly rate. My idea is to build a script to monitor the pricing and based on set values start the charging of my car and stop it once it goes over the threshold. I think your research is of nice value in getting my idea to reality. Thanks!

    1. Very interesting ! Please consider sharing your script when completed, I'm sure it will help others !

    2. Hello Anonymous (and Frederic).
      I too am trying to work on a small app to charge my car based on the hourly-pricing (which is how I came across this article - thank you).
      Although - I am not a coder /developer - so I'm not moving too fast. But I am using a low-code platform (Retool).
      I have managed to find an API which has the NL (or any other EU country for that matter) hourly pricing.... and have managed to pull this info into my app.

      I plan to then control my wallbox (with the help of this article) based on the least expensive hour(s).

      Would be happy to share more and learn more from you - my email is above. Hope to hear. thanks again. Neil

    3. Hi Neil, welcome to my blog. I would say that anything useful has to be shared. This is the whole purpose of this blog actually. So, if you found something useful, I cannot encourage you more than sharing it ! Either on your own blog (why not ?) or in the comments here. Thanks ! ;)

  4. Not sure this helps you, but the charger supports OCPP protocol. There is Home Assistant implementation of it. It acts as local server and the charger connects to it, not only it reports all the data, but you can also control the charge.

    1. Thanks a lot ! Unfortunately I'm not using Home Assistant (yet). But I'm sure this will allow others to play with it ! ;)

  5. Bonjour Frédéric,
    Très intéressant votre framework PHP.
    Question naïve : comment l'implémenter ? Faut-il un serveur Apache ? Local/distant ?
    Quel est le point d'entrée ?

    Merci pour votre réponse.
    Bien à vous.

    1. Bonsoir, merci ! ;)
      La bonne nouvelle c'est qu'il ne faut absolument aucun serveur web. Je fais tourner tout ça en ligne de commande avec php-cli. Php n'a pas absolument besoin de tourner dans une page web/serveur web. On peut continuer sur twitter @flhoest car mon audience est principalement anglophone.

  6. Thanks for this article. By the way, that’s not just a random auth token; it’s a JSON web token. It can be decoded (using a tool like jwt.io) to reveal your Gmail address and user ID. Not sure if you consider those to be sensitive info.

    1. Hi, thanks for your comment. If you have noticed, I have changed the article. Well spotted !


Post a Comment

Thank you for your message, it has been sent to the moderator for review...

What's hot ?

RClone : Mount Google Drive on any File System