1. Home
  2. Docs
  3. Employee Sync
  4. Create Employee Data
  5. POST Structure for /users

POST Structure for /users

Employee data in 7shifts can be created through the /users endpoint, one user at a time. Location, department & role mapping must be completed in order for the integration to know which location, department & role in 7shifts the user needs to be assigned to.

An example POST request to the /users endpoint to create an employee with the relevant information would look as follows. In this example, we’re creating an employee that’s assigned to two different roles:

Request URL

POST https://api.7shifts.com/v1/users

Request body

{
    "user": {
        "firstname": "Bertram",
	"lastname": "Gilfoyle",
	"email": "bertram.gilfoyle@piedpiper.com",
        "mobile_phone": 3065558888,
        "active": true,
        "user_type_id": 1
    },
    "role": [
        {
            "id": 135790
        },
        {
            "id": 864280
        }
    ],
    "department": [
        {
            "id": 98765
        }
    ],
    "location": [
        {
            "id": 12345
    	}
    ]
}

Here’s an explanation of each of the fields required in the request body:

FieldTypeExplanation
user.firstnameTextThe first name of the employee, can’t be blank
user.lastnameTextThe last name of the employee, can’t be blank, first name & last name combo must be unique
user.emailTextThe email address of the employee, this should not be changed once set as it’s used for logging into 7shifts, must be unique
user.mobile_phoneIntegerThe mobile phone number of the employee, this is where they’ll receive SMS notifications and an invite to join 7shifts
user.activeBooleanWhether the user should be active in 7shifts or not, should always be true when creating new employees
user.user_type_idIntegerMust always be set to 1, denoting that the user profile being created is of the type ‘Employee’
role.idIntegerThe ID(s) of the 7shifts role(s) that the user needs to be assigned to
department.idIntegerThe ID(s) of the 7shifts department(s) that each of the role.ids belong to, and any department(s) that the user needs to be assigned to without a role
location.idIntegerThe ID(s) of the 7shifts location(s) that each of the role.ids & department.ids belong to

A successful user creation request will result in a "status": "success" response with all the details of the created user. Please store the user.id field from the response, as that’s the unique identifier that you’ll need to use for updating the user in the future.