Is it possible to make the Account Expiration Date field mandatory when creating a user in DHIS2? How can we achieve this?
Hi Hiral!
Thank you for your inquiry. To begin with, thereâs a ârequire user account password changeâ that the admin can enforce for all users:
However, itâs not the same as âaccount expirationâ, the account expiration is set by updating the userâs info in the user system setting:
Or with an API PATCH request to user_id https://play.im.dhis2.org/stable-2-42-4/api/42/users/{user_id} and payload: [{"op":"add","path":"/accountExpiry","value":"[date here such as 2026-04-21 without the square brackets]"},{"op":"add","path":"/attributeValues","value":[]}]
Although I thought of some workarounds, this appears to be a feature request (please see ideas if youâd like to make a request and itâd be greatly helpful to know the use-case and why this is needed in the field).
As a workaround, if this is critical in your implementation, you could do one of these options:
- disable self-registration, and create a âcustom registrationâ app that users will use to create their accounts but the app will use the API to create the user with an âexpiration dateâ.
- Run a regular API script (either using Postman Runner or a serverless service like Vercel) to go over list of the userâs youâd like to set an expiration date for.
There are probably much more workarounds but it all depends on your use-case. I hope these suggestions help.
Thanks!

