---
title: "Create User"
method: POST
path: "/api/user"
tags: ["User"]
---

# Create User

`POST /api/user`

Create a new user

- **username**: 3 to 32 characters, can include a-z, 0-9, and underscores.
- **status**: User's status, defaults to `active`. Special rules if `on_hold`.
- **expire**: UTC datetime for account expiration. Use `0` for unlimited.
- **data_limit**: Max data usage in bytes (e.g., `1073741824` for 1GB). `0` means unlimited.
- **data_limit_reset_strategy**: Defines how/if data limit resets. `no_reset` means it never resets.
- **proxy_settings**: Dictionary of protocol settings (e.g., `vmess`, `vless`) will generate data for all protocol by default.
- **group_ids**: List of group IDs to assign to the user.
- **note**: Optional text field for additional user information or notes.
- **on_hold_timeout**: UTC timestamp when `on_hold` status should start or end.
- **on_hold_expire_duration**: Duration (in seconds) for how long the user should stay in `on_hold` status.
- **next_plan**: Next user plan (resets after use).

## Request body

- UserCreate
  - `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_expire_duration can be 0 or greater in seconds
  - `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
  - `username` string, required
  - `status` 'active' | 'disabled' | 'limited' | 'expired' | 'on_hold'

## Response `201`

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_expire_duration can be 0 or greater in seconds
  - `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.
    - `id` integer, nullable
    - `username` string, required

## Other responses

- `400` — BadRequest Error
- `401` — Unauthorized Error
- `409` — Conflict Error
- `422` — Validation Error

---

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