# Set user registration IP address API endpoint

**URL:** https://meta.discourse.org/t/set-user-registration-ip-address-api-endpoint/300138
**Category:** Plugin
**Tags:** rest-api
**Created:** [March 20, 2024, 9:21am UTC](https://meta.discourse.org/t/set-user-registration-ip-address-api-endpoint/300138 "2024-03-20T09:21:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![NubeBuster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nubebuster/32/371096_2.png) [@NubeBuster](https://meta.discourse.org/u/NubeBuster)
#### Post date: [March 20, 2024, 9:21am UTC](https://meta.discourse.org/t/set-user-registration-ip-address-api-endpoint/300138/1 "2024-03-20T09:21:36Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **Summary** | Create an API endpoint to set user\_registration\_ip |
| 🛠 | **Repository Link** | [https://github.com/Nubebuster/discourse-set-user-ip](https://github.com/Nubebuster/discourse-set-user-ip) |
| 📖 | **Install Guide** | [How to install plugins in Discourse](https://meta.discourse.org/t/install-plugins-in-discourse/19157) |

  

### Abstract

When creating users with [the existing API endpoint](https://docs.discourse.org/#tag/Users/operation/createUser) their registration ip address is set to the ip of the server/application that calls the api. This is a problem when you want to create users from an external service such as a minecraft server. This plugin provides a way to set the registration ip after user creation.

### Features

This plugin creates the following API endpoint

> POST /admin/set\_user\_ip#set\_ip  
> Params: id=Number&ip=String

to set the user\_registration\_ip address of a user with a given forum id.

#### Example curl command

```plaintext
curl -X POST "http://127.0.0.1:3000/admin/set_user_ip#set_ip" \
-H "Content-Type: multipart/form-data;" \
-H "Api-Key: <key>" \
-H "Api-Username: <username>" \
-F "id=1" \
-F "ip=127.0.0.1"

```

#### Example java code, including account creation

Can be found in the [README.md](https://github.com/Nubebuster/discourse-set-user-ip/blob/main/README.md#example-code-for-java)

### TODO

- You can request changes and report bugs [here](https://github.com/Nubebuster/discourse-set-user-ip/issues)
