User creation in Hue

@Romain
We are looking to automate the user creation in hue, can you please help? Is it possible with REST Api’s?
Can you please share the example to create a user using Api’s

@Romain
Thanks for the reply.
I tried this

curl -i -X GET hueserver:8888/hue/accounts/login/?fromModal=true -o /dev/null -D -

curl -v -X POST hueserver:8888/hue/accounts/login/ -d 'username=hueadmin&password=PASSWORD' -o /dev/null -D - --cookie "csrftoken=CSRFTOKEN;sessionid=SESSIONID" -H "X-CSRFToken: CSRFTOKEN"

curl -X POST hueserver:8888/hue/useradmin/users/new  --data '{"username":"usersample","password1":"password123","password2":"password123","ensure_home_directory":"on","groups":"2","is_active":"on"}' --cookie "csrftoken=CSRFTOKEN,sessionid=SESSIONID" -H "X-CSRFToken: CSRFTOKEN" -o /dev/null -D -

Getting 302 redirect when I log in and when I tried running hue/useadmin/users/new getting authentication failure

Below is the log

hueadmin - "POST /hue/accounts/login/ HTTP/1.1" - (mem: 174mb)-- Successful login for user: hueadmin

 hueadmin - "POST /hue/accounts/login/ HTTP/1.1" returned in 116ms 302 0 (mem: 174mb)
 hueadmin - "POST /hue/useradmin/users/new HTTP/1.1" - (mem: 174mb)-- Failed login for user: None
 hueadmin - "POST /hue/useradmin/users/new HTTP/1.1" returned in 96ms 200 238629 (mem: 174mb)

Can you please help in this?