---
title: "Create a new User"
method: POST
path: "/users"
tags: ["User"]
---

# Create a new User

`POST /users`

Creates a new User and persists it to storage.

## Request body

- object
  - `name` string, required
  - `age` integer, required
  - `pets` integer[]

## Response `200`

User created

- UserCreate
  - `id` integer, required
  - `name` string, required
  - `age` integer, required

## Other responses

- `400` — invalid input, data invalid
- `409` — conflicting resources
- `500` — unexpected error

## Changes

- **2022-01-03** `be4e7ff3034b` — 2 breaking, 5 info
  - the `code` response's property format changed from `int32` to no format for status `400`
  - the `code` response's property format changed from `int32` to no format for status `500`
  - added the non-success response with the status `409`
  - the response property `code` became required for the status `400`
  - …3 more
- **2021-12-21** `de0ebba2e9d9` — 2 breaking, 2 info
  - the `age` response's property format changed from `int32` to no format for status `200`
  - the `id` response's property format changed from `int32` to no format for status `200`
  - the `age` request property format was generalized from `int32` to no format
  - the `pets/items/` request property format was generalized from `int32` to no format
- **2021-12-20** `c20645e44d2d` — 3 breaking
  - request body became required
  - the `errors` response's property type changed from `object` to no type for status `400`
  - the `errors` response's property type changed from `object` to no type for status `500`
- **2021-11-15** `495e5eef05c1` — 8 breaking, 2 info
  - the `age` request property format changed from no format to `int32`
  - the `pets/items/` request property format changed from no format to `int32`
  - the response property `code` became optional for the status `400`
  - the response property `code` became optional for the status `500`
  - …6 more

[Change history](https://skmtc.dev/ent/apis/my-pets-api/changes/users/post.md)

---

[API](https://skmtc.dev/ent/apis/my-pets-api.md) · [All operations](https://skmtc.dev/ent/apis/my-pets-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ent/my-pets-api/revisions/4455d46a2733/schema)
