# Determine which gateway is used by a given node

**URL:** <https://www.thethingsnetwork.org/forum/t/determine-which-gateway-is-used-by-a-given-node/11531>\
**Category:** End Devices (Nodes)\
**Created:** [January 4, 2018, 8:50am UTC](https://www.thethingsnetwork.org/forum/t/determine-which-gateway-is-used-by-a-given-node/11531 "2018-01-04T08:50:54Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [January 4, 2018, 4:35pm UTC](https://www.thethingsnetwork.org/forum/t/determine-which-gateway-is-used-by-a-given-node/11531/12 "2018-01-04T16:35:22Z")

</div>

⚠ ⚠ ⚠

**This post contains references to outdated APIs.**

**Please read the following for the new APIs: [https://www.thethingsnetwork.org/forum/t/new-api-for-gateway-mapping-status-and-info/49778](https://www.thethingsnetwork.org/forum/t/new-api-for-gateway-mapping-status-and-info/49778)**

* * *

Get the gateway id(s) from the meta data, like from the MQTT JSON message or by expanding an item in the device’s Data page in TTN Console.

> **TTN Console example**
>
> ![](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/5/5ed1a605005221738b0301d81004cb94dae1cef9.png)

> **MQTT example**
>
> ```json
> {
> "app_id":"arjanvanb-app-1",
> "dev_id":"arjanvanb-bb-1",
> "hardware_serial":"70B3D5B020035CD1",
> "port":2,
> "counter":7165,
> "payload_raw":"CWUMqw0LDNM=",
> "metadata":{
> "time":"2017-04-27T10:07:27.207187339Z",
> "frequency":868.1,
> "modulation":"LORA",
> "data_rate":"SF7BW125",
> "coding_rate":"4/5",
> "gateways":[
> {
> "gtw_id":"eui-b827ebffff5fe05c",
> "timestamp":532315708,
> "time":"",
> "channel":0,
> "rssi":-57,
> "snr":9,
> "latitude":52.37447,
> "longitude":4.63576
> },
> {
> "gtw_id":"eui-5ccf7ff42f1970ec",
> "timestamp":1284851361,
> "time":"2017-04-27T10:07:26.494026Z",
> "channel":0,
> "rssi":-49,
> "snr":9,
> "rf_chain":1,
> "latitude":52.374523,
> "longitude":4.635771,
> "altitude":4
> }
> ]
> }
> }
> 
> ```

Next:

- Simply find the matching id in the popups of nearby gateways on [your local community](https://www.thethingsnetwork.org/community/)’s map. This also gives you a link to the owner, if the gateway’s privacy settings allow for that:

- Or, use that id in a TTN Mapper URL. If it starts with `eui-` such as `eui-0000024b080606d8` then remove that prefix and uppercase the rest:

- Or, get the specific gateway from, e.g.:

- Similarly, one could use the id in a NOC URL, yielding slightly different details (beware, this is an HTTP URL; right-clicking and some “open in new incognito window” might help if your browser tries HTTPS instead):

- Likewise, use [the Account Server API](https://www.thethingsnetwork.org/docs/network/account/api.html#get-gatewaysgw_id), showing different details but still including the owner:

- Likewise, use [the `ttnctl` command line interface](https://www.thethingsnetwork.org/docs/network/cli/):

- To get all gateways around some location:

- To get all gateways in some country:

- To get all gateways of a specific user:

- You can paste the coordinates into Google Maps:

Beware:

- ⚠ The `http://noc.thethingsnetwork.org:8085` endpoint [is known to be unreliable](https://status.thethings.network/incidents/3zddstxw97k9).

- ⚠ The endpoints starting with [https://www.thethingsnetwork.org/gateway-data/](https://www.thethingsnetwork.org/gateway-data/) might not be officially supported APIs. As for validity/caching of that specific endpoint, @htdvisser wrote on Slack:

- ⚠ The coordinates in an uplink’s metadata may be different from what is reported using the methods above. Presumably that is caused by a gateway including GPS/GNSS coordinates, or _fake_ GPS/GNSS coordinates (which it [should not do](https://www.thethingsnetwork.org/forum/t/gateway-gps-configuration-in-local-conf-json/6176/4)) in its messages. It seems `ttnctl gateways status` uses the coordinates from the last uplink’s metadata, while `ttnctl gateways info` reports whatever is configured in TTN Console.

---

_[View the full topic](https://www.thethingsnetwork.org/forum/t/determine-which-gateway-is-used-by-a-given-node/11531)._
