---
title: "Modify User"
method: PUT
path: "/api/user/{username}"
tags: ["User"]
---

# Modify User

`PUT /api/user/{username}`

Modify an existing user

- **username**: Cannot be changed. Used to identify the user.
- **status**: User's new status. Can be 'active', 'disabled', 'on_hold', 'limited', or 'expired'.
- **expire**: UTC datetime for new account expiration. Set to `0` for unlimited, `null` for no change.
- **data_limit**: New max data usage in bytes (e.g., `1073741824` for 1GB). Set to `0` for unlimited, `null` for no change.
- **data_limit_reset_strategy**: New strategy for data limit reset. Options include 'daily', 'weekly', 'monthly', or 'no_reset'.
- **proxies**: Dictionary of new protocol settings (e.g., `vmess`, `vless`). Empty dictionary means no change.
- **group_ids**: List of new group IDs to assign to the user. Empty list means no change.
- **note**: New optional text for additional user information or notes. `null` means no change.
- **on_hold_timeout**: New UTC timestamp for when `on_hold` status should start or end. Only applicable if status is changed to 'on_hold'.
- **on_hold_expire_duration**: New duration (in seconds) for how long the user should stay in `on_hold` status. Only applicable if status is changed to 'on_hold'.
- **next_plan**: Next user plan (resets after use).

Note: Fields set to `null` or omitted will not be modified.

## Path parameters

- `username` string, required

## Request body

- UserModify
  - `proxy_settings` ProxyTable
    - `vmess` VMessSettings
      - `id` string, uuid
    - `vless` VlessSettings
      - `id` string, uuid
    - `trojan` TrojanSettings
      - `password` string
    - `shadowsocks` ShadowsocksSettings
      - `password` string
      - `method` 'aes-128-gcm' | 'aes-256-gcm' | 'chacha20-ietf-poly1305' | 'xchacha20-poly1305'
    - `wireguard` WireGuardSettings
      - `private_key` string, nullable
      - `public_key` string, nullable
      - `peer_ips` string[]
    - `hysteria` HysteriaSettings
      - `auth` string
  - `expire` union
    - string, date-time
    - integer
  - `data_limit` integer, nullable — data_limit can be 0 or greater
  - `data_limit_reset_strategy` 'no_reset' | 'day' | 'week' | 'month' | 'year'
  - `note` string, nullable
  - `on_hold_expire_duration` integer, nullable
  - `on_hold_timeout` union
    - string, date-time
    - integer
  - `group_ids` integer[], nullable
  - `auto_delete_in_days` integer, nullable
  - `hwid_limit` integer, nullable
  - `next_plan` NextPlanModel
    - `user_template_id` integer, nullable
    - `data_limit` integer, nullable
    - `expire` integer, nullable
    - `add_remaining_traffic` boolean
  - `status` 'active' | 'disabled' | 'limited' | 'expired' | 'on_hold'

## Response `200`

Successful Response

- UserResponse
  - `proxy_settings` ProxyTable
    - `vmess` VMessSettings
      - `id` string, uuid
    - `vless` VlessSettings
      - `id` string, uuid
    - `trojan` TrojanSettings
      - `password` string
    - `shadowsocks` ShadowsocksSettings
      - `password` string
      - `method` 'aes-128-gcm' | 'aes-256-gcm' | 'chacha20-ietf-poly1305' | 'xchacha20-poly1305'
    - `wireguard` WireGuardSettings
      - `private_key` string, nullable
      - `public_key` string, nullable
      - `peer_ips` string[]
    - `hysteria` HysteriaSettings
      - `auth` string
  - `expire` union
    - string, date-time
    - integer
  - `data_limit` integer, nullable — data_limit can be 0 or greater
  - `data_limit_reset_strategy` 'no_reset' | 'day' | 'week' | 'month' | 'year'
  - `note` string, nullable
  - `on_hold_expire_duration` integer, nullable
  - `on_hold_timeout` union
    - string, date-time
    - integer
  - `group_ids` integer[], nullable
  - `auto_delete_in_days` integer, nullable
  - `hwid_limit` integer, nullable
  - `next_plan` NextPlanModel
    - `user_template_id` integer, nullable
    - `data_limit` integer, nullable
    - `expire` integer, nullable
    - `add_remaining_traffic` boolean
  - `id` integer, required
  - `username` string, required
  - `status` 'active' | 'disabled' | 'limited' | 'expired' | 'on_hold', required
  - `used_traffic` integer, required
  - `lifetime_used_traffic` integer
  - `created_at` string, date-time, required
  - `edit_at` string, date-time, nullable
  - `online_at` string, date-time, nullable
  - `subscription_url` string
  - `admin` AdminBase — Minimal admin model containing only the username.
    - `username` string, required

## Other responses

- `400` — BadRequest Error
- `401` — Unauthorized Error
- `403` — Forbidden Error
- `404` — NotFound Error
- `422` — Validation Error

---

[API](https://skmtc.dev/rain/apis/pasarguardapi.md) · [All operations](https://skmtc.dev/rain/apis/pasarguardapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/rain/pasarguardapi/revisions/b3bebca20611/schema)
