Update Employee Data
This section focuses on:
- Structure of PUT requests to users for basic profile updates
- Structure of POST requests to the assignment endpoints for assignment updates
- Important constraints for
emailandmobile_number
Update employee profile in 7shifts
Use the PUT /api/v2/company/{id}/users/{user_id} endpoint to update employee profile fields.
This request should be used for updates like:
- first_name
- last_name
- mobile_number
- other supported profile fields (address, language, notes, etc.)
You only need to include fields that changed.
Account model (important context) Users are company-level records. When a person works at multiple companies, 7shifts links those user records to one shared login account.
For integrations, treat this as:
- Login username = email
- Changing a user email changes the username the person uses to log in
Email and phone constraints
Before syncing email or phone fields, follow these rules:
- Email is not always freely editable
- If a user is part of a shared cross-company account, email updates may be rejected.
- If accepted, changing email changes the user’s login username.
- Phone is also protected in shared-account scenarios
mobile_numberupdates may be rejected when the user is part of a shared cross-company account.- Equivalent formatting changes (for example, country code normalization) may still be accepted.
- Email cannot always be cleared
- Setting
emailto empty may be rejected for users that already have a login account.
- Setting
- Email must be unique within the company
- Reusing an email already used by another active or inactive user in the same company is rejected.
- Email update attempts are rate-limited
- Repeated email changes in a short period can be blocked temporarily.
Recommended sync workflow for email/phone
Before sending PUT with email or phone fields:
GET /api/v2/company/{id}/users/{user_id}- Compare your source value vs current 7shifts value
- Only send fields that actually changed
- Handle 400 validation responses as non-retryable business-rule failures (unless your data changes)
Request URL
curl --request PUT --url 'https://api.7shifts.com/v2/company/12335/users/1111'Request body
{
"first_name": "Bertram",
"last_name": "Gilfoyle",
"mobile_number": "3065558888"
}Please note the following about the above request:
- The request URL must specify the
idof the 7shifts user to be updated. - You only need to specify the fields that got updated, although it wouldn’t make a difference if you specified all the fields in the request body.
Error handling (business-rule 4XX only)
Use this table for validation/conditional failures that come from request data and user state.
| HTTP status | Condition | Example response message (English) | Recommended integrator action |
|---|---|---|---|
400 Bad Request | first_name is an empty string | First name cannot be empty | Send a non-empty first name. |
400 Bad Request | Name collides with another active user in company | A user with the name %s already exists in your account | Do not retry; resolve duplicate in source system. |
400 Bad Request | Name collides with an inactive user in company | %s is currently inactive in your account. | Do not retry; resolve identity/mapping choice manually. |
400 Bad Request | First/last name contains blocked URL-like pattern | Name contains bad characters | Clean/sanitize name and resend. |
400 Bad Request | employee_id duplicates another user in company | Employee ID must be unique | Ensure employee_id is unique before retry. |
400 Bad Request | punch_id is non-numeric | Punch ID must be numeric | Send numeric value only. |
400 Bad Request | punch_id already in use (location scope) | That punch ID is already in use | Generate/select a different punch ID. |
400 Bad Request | email already used by active user in same company | There is already an employee in your account by this name, or with this email address. | Do not retry; choose different email or fix mapping. |
400 Bad Request | email already used by inactive user in same company | %s is currently inactive in your account. | Do not retry; resolve with reactivation/merge workflow. |
400 Bad Request | Attempt to change email on protected shared-account user | You do not have permission to change this email address | Treat email as read-only for this user; skip email sync. |
400 Bad Request | Attempt to change phone on protected shared-account user | You do not have permission to change this number | Treat phone as read-only (except equivalent formatting). |
400 Bad Request | Attempt to clear email for account-linked user | You cannot remove your email address. | Do not send empty email for this user. |
400 Bad Request | Attempt to clear email for employer/admin user | As the admin, you must have a valid email address. | Always provide a valid non-empty email. |
400 Bad Request | Email takeover protection triggered (unclaimed invited account) | Another user with this email already exists. This user must accept their invite from their existing company. | Do not retry; escalate for manual account resolution. |
400 Bad Request | appear_as_employee changed on employee user type | Cannot modify appear_as_employee on an employee | Stop sending this field for employee-type users. |
400 Bad Request | type and permissions_template_id are inconsistent | Template level does not equal new user type | Align template level with target user type. |
400 Bad Request | Enabling sms_notifications without valid phone | Cannot enable SMS notifications without a valid mobile number | Send valid phone first, then enable SMS notifications. |
429 Too Many Requests | Email change attempts exceeded limit window | Too many email change attempts. Please try again later. | Retry later with backoff; do not loop immediate retries. |
Updating LDR and Wage Assignments
We provide endpoints to modify locations, departments and role assignment for each user. Before you proceed you must have a clear understanding of 7shifts mapping specified in our Mapping guide. Additionally your implementation must have a synchronized table for each location, department and role ID's and how they map to your system.
Referencing the previous POST, here we provide an example PUT request to the assign the existing user to yet another role with the ID 55555 which exists under department ID 33333 at location 22222, which is another location under the same company, for a $15.00 wage:
Request URLs
curl --request POST \
--url 'https://api.7shifts.com/api/v2/company/1234/users/1111/location_assignments' \
--data '{"location_id":22222}'curl --request POST \
--url 'https://api.7shifts.com/api/v2/company/1234/users/1111/department_assignments' \
--data '{"department_id":33333}'curl --request POST \
--url 'https://api.7shifts.com/api/v2/company/1234/users/1111/role_assignments' \
--data '{"role_id":555555}'TIP The POST /role_assignments includes logic to add a location and department if they are not assigned to the user. For the example above you only needed to make the last call to assign the location, department and role for user 1111
When removing assignments, use the DELETE action for the endpoints. NOTE deleting assignments will cascade the changes down to their children objects. If you delete a user location assignment, it will also delete the associated department and role assignments.
Example request to remove a department assignment 8256 from a user 1111:
curl --request DELETE --url https://api.7shifts.com/api/v2/company/1234/users/1111/department_assignments/8256Changing Wage Type
Did an employee just switch from being on an hourly wage to a weekly salary? When updating the user wage you must set a new wage with the wage_type = weekly_salary with a new effective date and wage_cents value.
The same can be done when switching from weekly salary to hourly wage.
curl --request POST \
--url 'https://api.7shifts.com/v2/company/1234/users/1111/wages' \
--data '
{
"role_id": 555555,
"effective_date": "2022-06-01",
"wage_type": "hourly",
"wage_cents": 1500
}'Unassigning locations, departments and roles
You can use the following endpoints to remove assignments. Each endpoint will cascade the changes down so if a location is removed from a users assignments, it will remove the related departments and roles.
Updated 15 days ago
