# HomeyAPI.createLocalAPI and meyAPI.createAppAPI inconsistency

**URL:** <https://community.homey.app/t/homeyapi-createlocalapi-and-meyapi-createappapi-inconsistency/90658>\
**Category:** Developers\
**Tags:** homey-pro\
**Created:** [October 1, 2023, 8:14am UTC](https://community.homey.app/t/homeyapi-createlocalapi-and-meyapi-createappapi-inconsistency/90658 "2023-10-01T08:14:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Baldhor](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/baldhor/32/27028_2.png) [@Baldhor](https://community.homey.app/u/Baldhor)\
**Post date:** [October 1, 2023, 8:14am UTC](https://community.homey.app/t/homeyapi-createlocalapi-and-meyapi-createappapi-inconsistency/90658/1 "2023-10-01T08:14:22Z")

</div>

Hello,

Following conversation in thread: [Zone and zoneName of device from driver context](https://community.homey.app/t/zone-and-zonename-of-device-from-driver-context/89327)

I want my Homey PRO app to be able to modify the name and zone of a device.  
To do so, I’m doing:

```auto
            this.homeyApi = await HomeyAPI.createLocalAPI({
                address: "http://127.0.0.1",
                token: "<my secret token>"
            });

            let realDevice = this.getDevices().find(device => device.getData().id === virtualDeviceId);
            
            if (data.name !== realDevice.getName() || data.zoneId !== realDevice.getZone()) {
                await this.homeyApi.devices.updateDevice({
                    id: realDevice.getId(),
                    device: {
                        name: data.name,
                        zone: data.zoneId
                    }
                });
            }

```

When using the createAppApi instead of createLocalAPI:

```auto
            this.homeyApi = await HomeyAPI.createAppAPI({
                homey: this.homey
            });

```

I get the error:

```auto
2023-10-01T08:08:17.557Z [err] [ManagerDrivers] [Driver:esphome-wizard] [HomeyAPIError: Vous n'avez pas la possibilité de faire ceci.] {
  statusCode: 403,
  description: "Vous n'avez pas la possibilité de faire ceci."
}

```

Even I found a way to make it works, the token requirement is very annoying, it’s not like I want an external application to acces the web api, the code is running insde the homey PRO app…

Any idea?

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 1, 2023, 8:15am UTC](https://community.homey.app/t/homeyapi-createlocalapi-and-meyapi-createappapi-inconsistency/90658/2 "2023-10-01T08:15:32Z")

</div>

Probably better to ask on Slack or to post a [Github issue](https://github.com/athombv/homey-apps-sdk-issues/issues).

---

<div class="post-metadata">

**Author:** ![Baldhor](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/baldhor/32/27028_2.png) [@Baldhor](https://community.homey.app/u/Baldhor)\
**Post date:** [October 1, 2023, 7:06pm UTC](https://community.homey.app/t/homeyapi-createlocalapi-and-meyapi-createappapi-inconsistency/90658/3 "2023-10-01T19:06:15Z")

</div>

Better calm down a little before I go through Athom BV …

My app is now working as I expect, but I’m switching between SDK, localAPI and AppAPI for different functionnalities, thanks to Athom BV developpers consistancy …  
=\> The worst here is about memory … and maybe memory leak 🙂

AppAPI usage require the user to input his token through the pair session interface, but it only concerns:

- deletion of a device
- modification of the name or zone of a device

(yes, the interface of the pair session is more like a manager 🙂 )

Which are easily accessible through the standard user interface of Homey, so it’s ok I suppose.

Anyway, maybe I just do it all wrong, I don’t know …
