Set XBee PAN id programmatically

Hi together,

does anyone know if and how I can set the PAN ID of an XBee module inside my arduino code programmatically in API mode.

I want to create my own implementation of a mesh network without using a coordinator.
I want to make a PAN in which end divices "meet" and change into their own PAN from there.

To accomplish this, I need to change the PAN inside my arduino code.

Is this possible?

regards
Menico

I want to create my own implementation of a mesh network without using a coordinator.

A mesh network must always have a coordinator. You can NOT create a network without one.

As I've understood Xbee documentations the coordinator builds up a device table.
I can still send broadcasts without having a coordinator (if other devices are in the same PAN / Channel).

And I can also send unicasts and multicasts if I know the destination device IDs.

Also, a mesh network wont fail if its coordinator breaks down. It looses some functionality but still remains functional.

I've already found a documentation on how to use AT commands in running arduino code, but havn't found something about it in API mode.