---
title: "Create a new user with roles"
method: POST
path: "/users"
tags: ["Users"]
---

# Create a new user with roles

`POST /users`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/users`
- Auth: HTTP bearer

## Request body

- CreateUserRequest
  - `email` string, nullable
  - `must_change_password` boolean
  - `password` string, nullable
  - `roles` string[], required
  - `username` string, required

## Response `201`

User created successfully

- RouteUserWithRoles
  - `roles` RouteRole[], required
    - `created_at` string, date-time, required
    - `id` integer, required
    - `name` string, required
    - `updated_at` string, date-time, required
  - `user` RouteUser, required
    - `created_at` string, date-time, required
    - `deleted_at` string, date-time, nullable
    - `email` string, required
    - `email_verified` boolean, required
    - `id` integer, required
    - `image` string, required
    - `mfa_enabled` boolean, required
    - `must_change_password` boolean, required
    - `name` string, required
    - `updated_at` string, date-time, required
    - `username` string, required

## Other responses

- `400`: Invalid input
- `500`: Internal server error

## Changes

- **2026-11-26** `e1864d950604`: 5 breaking
  - the `roles/items/created_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `201`
  - the `roles/items/updated_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `201`
  - the `user/created_at` response's property type changed from `integer` to `string`, and format from `int64` to `date-time` for status `201`
  - the `user/deleted_at` response's property type changed from `integer, null` to `string, null`, and format from `int64` to `date-time` for status `201`
  - …1 more
- **2026-09-07** `5ab851bb63bf`: 2 info
  - added the new optional request property `must_change_password`
  - added the required property `user/must_change_password` to the response with the `201` status
- **2026-09-07** `22543057a288`: 1 breaking, 1 warning
  - removed the required property `user/must_change_password` from the response with the `201` status
  - removed the request property `must_change_password`
- **2026-09-07** `8be6c67df066`: 2 info
  - added the new optional request property `must_change_password`
  - added the required property `user/must_change_password` to the response with the `201` status
- **2026-09-07** `f7404eb7ac98`: 1 breaking, 1 warning
  - removed the required property `user/must_change_password` from the response with the `201` status
  - removed the request property `must_change_password`

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/users/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
