Skip to content

API Error: /panel/api/inbounds/update returns "Success" but doesn't save changes to the DB #3083

Description

@AlexanderVechkasov

Describe the bug

When attempting to update an inbound connection via the /panel/api/inbounds/update endpoint, the API returns a 200 OK response with an empty body, which signals a successful operation. However, the actual changes are not written to the x-ui.db database.

For example, when programmatically changing the expiryTime for a client, this value remains unchanged in the database and the web interface.

Environment Information:

  • Operating System: Ubuntu 22.04.5 LTS
  • Installation Method: Docker

Important Notes:

  • Updating the same client via the web panel's interface works correctly and saves the data.
  • Creating new clients via the API (/panel/api/inbounds/addClient) works correctly.
  • The issue specifically occurs when trying to update an existing inbound connection via the API.

How to repeat the problem?

The issue can be reproduced using an external client (e.g., a Python script) that performs the following actions:

  1. Authentication: Successfully authenticates via POST /login with valid credentials, receiving all necessary session cookies.
  2. Read: Performs a GET /panel/api/inbounds/list to retrieve the current configuration of the desired inbound. The request is successful.
  3. Modification: Programmatically changes the expiryTime value for one of the clients within the JSON string in the settings field.
  4. Data Filtering and Preparation: A payload for the update request is formed. To avoid errors with extra fields, only the fields that are part of the inbound configuration (such as id, remark, port, settings, streamSettings, etc.) are included in the payload.
  5. Write: A POST request is sent to /panel/api/inbounds/update with the prepared payload and all session cookies.

Expected action

The server should respond with 200 OK, and the new data (specifically, expiryTime) should be correctly saved to the database and reflected in the panel.

Received action

The server consistently responds to the request from step 5 with a 200 OK status and an empty response body. The external client's logs confirm a successful request/response cycle.

**Client Log Example:**INFO - UPDATE: Starting update for UUID 489f9b32-4b93-466c-af65-7916dcb3717d for 30 days.
INFO - API_REQUEST: Calling GET .../panel/api/inbounds/list
INFO - API_REQUEST: Response from .../panel/api/inbounds/list: Status 200
INFO - API_REQUEST: Calling POST .../panel/api/inbounds/update
INFO - API_REQUEST: Response from .../panel/api/inbounds/update: Status 200

Despite the 200 OK status, upon subsequent verification via the API or in the web interface, it is clear that the client's expiryTime value has not changed.

3x-ui Version

v2.6.0

Xray-core Version

25.5.16

Checklist

  • This bug report is written entirely in English.
  • This bug report is new and no one has reported it before me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions