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

# Create User Template

`POST /api/user_template`

Create a new user template

- **name** can be up to 64 characters
- **data_limit** must be in bytes and larger or equal to 0
- **expire_duration** must be in seconds and larger or equat to 0
- **group_ids** list of group ids

## Request body

- UserTemplateCreate
  - `name` string, nullable
  - `data_limit` integer, nullable — data_limit can be 0 or greater
  - `hwid_limit` integer, nullable
  - `expire_duration` integer, nullable — expire_duration can be 0 or greater in seconds
  - `username_prefix` string, nullable
  - `username_suffix` string, nullable
  - `group_ids` integer[], required
  - `extra_settings` ExtraSettings
    - `method` 'aes-128-gcm' | 'aes-256-gcm' | 'chacha20-ietf-poly1305' | 'xchacha20-poly1305'
  - `status` 'active' | 'on_hold'
  - `reset_usages` boolean, nullable
  - `on_hold_timeout` integer, nullable
  - `data_limit_reset_strategy` 'no_reset' | 'day' | 'week' | 'month' | 'year'
  - `is_disabled` boolean, nullable

## Response `201`

Successful Response

- UserTemplateResponse
  - `name` string, nullable
  - `data_limit` integer, nullable — data_limit can be 0 or greater
  - `hwid_limit` integer, nullable
  - `expire_duration` integer, nullable — expire_duration can be 0 or greater in seconds
  - `username_prefix` string, nullable
  - `username_suffix` string, nullable
  - `group_ids` integer[], required
  - `extra_settings` ExtraSettings
    - `method` 'aes-128-gcm' | 'aes-256-gcm' | 'chacha20-ietf-poly1305' | 'xchacha20-poly1305'
  - `status` 'active' | 'on_hold'
  - `reset_usages` boolean, nullable
  - `on_hold_timeout` integer, nullable
  - `data_limit_reset_strategy` 'no_reset' | 'day' | 'week' | 'month' | 'year'
  - `is_disabled` boolean, nullable
  - `id` integer, required

## Other responses

- `403` — Forbidden 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)
