Users
Delete user by email
Section titled “Delete user by email”Deletes a user from Instaply by their email address.
Endpoint
Section titled “Endpoint”POST https://me.instaply.com/api/user/delete-by-email
Headers
Section titled “Headers”token— Authentication token provided by Instaply.
See Authentication for the full set of required headers.
Request body
Section titled “Request body”{ "email": "user@test.com"}Fields
Section titled “Fields”email(string) — The email address of the user to delete.
Example (curl)
Section titled “Example (curl)”curl --location --request POST "https://me.instaply.com/api/user/delete-by-email" \ --header "token: <to-be-provided-by-instaply>" \ --header "Content-Type: application/json" \ --data-raw '{ "email": "user@test.com" }'Behavior & constraints
Section titled “Behavior & constraints”- Authorization
- The provided
tokendetermines the organization context. - Clients can only delete users belonging to their own organization.
- The API token must include the
user:deletepermission. - If you intend to use this endpoint, ask your Instaply CSM to enable
user:deletefor your API token.
- The provided
- Business rules
- A user cannot be deleted if they are the last customer representative (contactable employee) in any business.
- A user cannot be deleted if they are the last member of an escalation pool for a business.
- Attempting to delete in these scenarios will return an error response.
Responses
Section titled “Responses”Successful deletion (200)
Section titled “Successful deletion (200)”{ "status": "success", "deletedUserId": "1388838", "email": "user@test.com"}Unknown user (404)
Section titled “Unknown user (404)”{ "error": "User not found in organization"}Missing email (400)
Section titled “Missing email (400)”{ "body": [ { "message": "is missing and not optional", "property": "@.email" } ], "headers": []}Last customer representative for at least one business (400)
Section titled “Last customer representative for at least one business (400)”{ "error": "User cannot be deleted as they are the last customer representative in one or more businesses"}Last user in escalation pool (400)
Section titled “Last user in escalation pool (400)”{ "error": "User cannot be deleted as they are the last person in the escalation pool for business 123"}