User Creation (Mobile Worker)

Purpose: Create CommCare(mobile-worker) user.

Permissions Required: Edit Mobile Workers & Edit Access API's

Authentication: For more information, please review https://dimagi.atlassian.net/wiki/x/LwXKfw.

URL: https://www.commcarehq.org/a/[domain]/api/[version]/user/

Method: POST

Input Parameters: * means required

Name 

Description 

Example



Name 

Description 

Example



username* 

User name of user

jdoe

password* 

User password 

qwer1234 

first_name 

First name of user 

John 

last_name 

Last name of user 

Doe 

email 

Email address of user 

john.doe@example.org 

phone_numbers 

List of all phone numbers of the user. The first one will be set to the default number

(see examples) 

groups 

List of all group ids belonging to the user 

(see examples) 

user_data 

Any additional custom data associated with the user 

(see examples) 

language

User language

en

primary_location

The location id of the primary location, it must be one of the locations

26fc44e2792b4f2fa8ef86178f0a958e

locations

A list of location_ids that the mobile worker will be assigned to. Location id can be acquired by Location API.

["26fc44e2792b4f2fa8ef86178f0a958e", "c1b029932ed442a6a846a4ea10e46a78"]

Output Parameters:

Name


 

Description 

Example 

Name


 

Description 

Example 

user_id 

User UUID 

3c5a623af057e23a32ae4000cf291339 



Sample input:

JSON Format

{ "username": "jdoe", "password": "qwer1234", "first_name": "John", "last_name": "Doe", "default_phone_number": "+50253311399", "email": "jdoe@example.org", "language": "en", "phone_numbers": [ "+50253311399", "50253314588" ], "groups": [ "9a0accdba29e01a61ea099394737c4fb", "b4ccdba29e01a61ea099394737c4fbf7" ], "primary_location": "26fc44e2792b4f2fa8ef86178f0a958e", "locations": ["26fc44e2792b4f2fa8ef86178f0a958e", "c1b029932ed442a6a846a4ea10e46a78"], "user_data": { "chw_id": "13/43/DFA" } }