# Any way to get user's last IP and IP when registered via API?

**URL:** https://meta.discourse.org/t/any-way-to-get-users-last-ip-and-ip-when-registered-via-api/55146
**Category:** Development
**Tags:** rest-api
**Created:** [2017 年 1 月 4 日午前 9:38 UTC](https://meta.discourse.org/t/any-way-to-get-users-last-ip-and-ip-when-registered-via-api/55146 "2017-01-04T09:38:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![maigaard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maigaard/32/121259_2.png) [@maigaard](https://meta.discourse.org/u/maigaard)
#### Post date: [2017 年 1 月 4 日午前 9:38 UTC](https://meta.discourse.org/t/any-way-to-get-users-last-ip-and-ip-when-registered-via-api/55146/1 "2017-01-04T09:38:37Z")

</div>

In an effort to create a nice visual of where on the planet our users are from, I wanted to extract the last IP address (and the IP address the user had when he first registered) for our users via API.

However, in the /users/username.json this data is not available.  
I can see it under users in the admin UI, but naturally that scales poorly 🙂

Any way to do this via an API request?

Thanks!

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [2017 年 1 月 4 日午後 12:34 UTC](https://meta.discourse.org/t/any-way-to-get-users-last-ip-and-ip-when-registered-via-api/55146/2 "2017-01-04T12:34:11Z")

</div>

This endpoint should have what you need: `http://localhost:3000/admin/users/2.json`

```
  "ip_address": "192.168.0.1",
  "registration_ip_address": "192.168.0.1",

```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2019 年 4 月 16 日午後 8:48 UTC](https://meta.discourse.org/t/any-way-to-get-users-last-ip-and-ip-when-registered-via-api/55146/3 "2019-04-16T20:48:20Z")

</div>



---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [2019 年 4 月 17 日午後 5:37 UTC](https://meta.discourse.org/t/any-way-to-get-users-last-ip-and-ip-when-registered-via-api/55146/4 "2019-04-17T17:37:31Z")

</div>


