How to create users while registering with different roles via API?

thanks for u r command mr.aislam i got (platform.session.user) is null how to solve this