Why it won't change to system user when the user was created through the API

when i try to give user type as system user through api, why it won’t change to system user when the user was created?
and how can i select option like crm, support, asserts and Payments from allow module through api?

@frappe.whitelist()
def insert_user(first_name,email):
user = frappe.get_doc({
“doctype”:“User”,
“first_name”:first_name,
“email”:email,
“new_password”:“Frappe@123”,
“role_profile_name”:“RPQB”,
“user_type”:“System User”
})
user.insert(ignore_permissions=True)
frappe.db.commit()
return f"The data for {first_name} inserted"

add any roles.

"roles": [{"role": "System Manager"}]

1 Like

Thank you very much for the solution it works.! :smile: