# `LightningWeb.API.UserController`
[🔗](https://github.com/OpenFn/lightning/blob/main/lib/lightning_web/controllers/api/user_controller.ex#L1)

The users resource, for service accounts only.

`POST /api/users` takes a flat object of `email`, `password`, `first_name`,
`last_name`, `role` (`user` or `superuser`) and `confirmed`, and refuses any
other key with a 422 `unknown_key` entry at that key, alongside every other
error in the body. It answers 201 with the new user. An email already taken
in any case is a `taken` entry at `#/email`, which names nothing about the
user who holds it.

`PATCH /api/users/:id` takes any of `first_name`, `last_name`, `role`,
`password` and `confirmed`, with the same rules as a create, and refuses any
other key the same way, `email` included, since the email can't be changed.
It answers 200 with the user rendered as a 201 renders one. `confirmed` only
ever confirms.

Either answers 400 `malformed` to a body that isn't a JSON object.

`GET /api/users` is paginated, at most 100 a page, and filters by `?email=`
without regard to case. An `email` that isn't a string answers 400
`invalid_parameter`.

# `create`

# `index`

# `show`

# `update`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
