Sleep user in company API Route
This route is used to sleep up to 100 users at a time via the Phin API. Users who do not exist or are already slept will not be updated.
Body Reference
| Field | Type | Required |
| userEmails | array[String] | Yes |
Body Sample
{ "userEmails":
[
"userEmail1@example.com",
"userEmail2@example.com",
...,
"userEmailN@example.com"
]
}
Response Reference
| Field | Type | Description |
|---|---|---|
| error | string | Returned only when one or more users who were found and active could not be updated |
| failedUserEmails | array[string] | Lists only users who were found, were active, and whose update failed. Unmatched and already-slept emails never appear here. |
| message | string | Returned with status 200 when no update failed: "Successfully slept users". Emails that don’t match a user, and users who are already slept, are skipped and don’t count as failures. |
Error Response Sample
{
"error": "Failed to sleep 1 users. Ensure that provided emails are valid and that the users exist in the provided company",
"failedUserEmails": ["userEmail1@example.com"]
}
Error Reference
| Code | Message | Explanation |
|---|---|---|
| 400 | Bad request | The request was missing required fields. |
| 404 | Company does not exist | The provided companyId either does not exist, or maps to a company that has been deleted. |
| 500 | Failed to sleep users | Some users were found and active but could not be slept. Check failedUserEmails for the affected users and retry. If this persists, contact Phin Support. Emails that don’t match a user don’t cause this error. |