[PR #2446] [CLOSED] API - Add Client to inbounds #5111

Closed
opened 2026-10-31 20:44:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/2446
Author: @MrR4di0k4l
Created: 8/6/2024
Status: ❌ Closed

Base: main ← Head: main


📝 Commits (8)

📊 Changes

5 files changed (+354 additions, -7 deletions)

View changed files

📝 README.md (+3 -1)
📝 web/controller/api.go (+2 -0)
📝 web/controller/inbound.go (+80 -0)
📝 web/middleware/domainValidator.go (+4 -6)
📝 web/service/inbound.go (+265 -0)

📄 Description

API - Add Client to inbounds

If the list of inboundIds is sent empty, a user will be created on all existing inbounds, otherwise, the inbound ID must be entered as follows:
"inboundIds": [1, 2]

Example

import requests

url = "http://localhost:2053/panel/api/inbounds/addClientInbounds"

payload = {'settings': '{"clients":[{"id":"983ecd09-6257-411d-a58c-fa7473ca3c0c","flow":"","email":"SpeedVpn","limitIp":2,"totalGB":32212254720,"expiryTime":1712927113000,"enable":true,"tgId":"","subId":"subId","reset":0}]}', 'inboundIds': []}
headers = {
  'Accept': 'application/json',
  'Cookie': '3x-ui=MTcyMjkzOTQwNnxEWDhFQVFMX2dBQUJFQUVRQUFCMV80QUFBUVp6ZEhKcGJtY01EQUFLVEU5SFNVNWZWVk5GVWhoNExYVnBMMlJoZEdGaVlYTmxMMjF2WkdWc0xsVnpaWExfZ1FNQkFRUlZjMlZ5QWYtQ0FBRUVBUUpKWkFFRUFBRUlWWE5sY201aGJXVUJEQUFCQ0ZCaGMzTjNiM0prQVF3QUFRdE1iMmRwYmxObFkzSmxkQUVNQUFBQUZQLUNFUUVDQVFWaFpHMXBiZ0VGWVdSdGFXNEF8uVa-901gifdCXLToceyxtfnjMOvHDZer53Ks2O0V6gA='
}

response = requests.request("POST", url, headers=headers, json=payload)

print(response.text)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/2446 **Author:** [@MrR4di0k4l](https://github.com/MrR4di0k4l) **Created:** 8/6/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (8) - [`9d97866`](https://github.com/MHSanaei/3x-ui/commit/9d9786679b357047f9e3d519593509406bf89c5d) API - Add Client to inbounds - [`22c1bbd`](https://github.com/MHSanaei/3x-ui/commit/22c1bbd1955c2ac85f2cfb55180ad5c6fa257741) fixed - [`ef99062`](https://github.com/MHSanaei/3x-ui/commit/ef990626ea444c32765b611492e679116c58cbd1) Merge branch 'MHSanaei:main' into main - [`1a24c38`](https://github.com/MHSanaei/3x-ui/commit/1a24c386ce3e7cb605db540a401ba83428fa1ece) Fix domain validation for Nginx/CDN compatibility #2450 - [`1e52d0a`](https://github.com/MHSanaei/3x-ui/commit/1e52d0ac6e3d73086eb35412e2e6304dee06145d) API - Update Client to inbounds - [`e3c3a5f`](https://github.com/MHSanaei/3x-ui/commit/e3c3a5f71ea276194317139c5b92826ab6e13475) API - Update Client to inbounds Readme.md - [`3b5dde8`](https://github.com/MHSanaei/3x-ui/commit/3b5dde83824ac7bbe03db8bcedfddf416ce82bd2) Merge branch 'MHSanaei:main' into main - [`da3f6aa`](https://github.com/MHSanaei/3x-ui/commit/da3f6aa30299cbdfbf1cea3ae5d05d82be09b013) Merge branch 'main' of https://github.com/MrR4di0k4l/3x-ui ### 📊 Changes **5 files changed** (+354 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+3 -1) 📝 `web/controller/api.go` (+2 -0) 📝 `web/controller/inbound.go` (+80 -0) 📝 `web/middleware/domainValidator.go` (+4 -6) 📝 `web/service/inbound.go` (+265 -0) </details> ### 📄 Description ## API - Add Client to inbounds If the list of inboundIds is sent empty, a user will be created on all existing inbounds, otherwise, the inbound ID must be entered as follows: "inboundIds": [1, 2] ## Example ```python import requests url = "http://localhost:2053/panel/api/inbounds/addClientInbounds" payload = {'settings': '{"clients":[{"id":"983ecd09-6257-411d-a58c-fa7473ca3c0c","flow":"","email":"SpeedVpn","limitIp":2,"totalGB":32212254720,"expiryTime":1712927113000,"enable":true,"tgId":"","subId":"subId","reset":0}]}', 'inboundIds': []} headers = { 'Accept': 'application/json', 'Cookie': '3x-ui=MTcyMjkzOTQwNnxEWDhFQVFMX2dBQUJFQUVRQUFCMV80QUFBUVp6ZEhKcGJtY01EQUFLVEU5SFNVNWZWVk5GVWhoNExYVnBMMlJoZEdGaVlYTmxMMjF2WkdWc0xsVnpaWExfZ1FNQkFRUlZjMlZ5QWYtQ0FBRUVBUUpKWkFFRUFBRUlWWE5sY201aGJXVUJEQUFCQ0ZCaGMzTjNiM0prQVF3QUFRdE1iMmRwYmxObFkzSmxkQUVNQUFBQUZQLUNFUUVDQVFWaFpHMXBiZ0VGWVdSdGFXNEF8uVa-901gifdCXLToceyxtfnjMOvHDZer53Ks2O0V6gA=' } response = requests.request("POST", url, headers=headers, json=payload) print(response.text) ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 20:44:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5111
No description provided.