# Remove a team member from team by e-mail

Removes a member from the team, or cancels a pending invitation, by their email address. This action cannot be undone.

[info]
Removing a user with the `admin` role is not permitted via the API.
[/info]

[endpoint]
base_url = "https://betterstack.com"
path = "/api/v2/team-members"
method = "DELETE"

[[query_param]]
name = "team_name"
description = "Required if using a [global API token](https://betterstack.com/docs/uptime/api/getting-started-with-uptime-api/#get-a-global-api-token) to specify the team."
required = false
type = "string"

[[query_param]]
name = "email"
description = "The email address of the team member to remove or invitation to cancel. Can be passed as a query parameter or in the request body."
required = true
type = "string"

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"
[/endpoint]

[responses]
[[response]]
status = 204
description = '''The team member or invitation was successfully removed.'''

[[response]]
status = 404
description = '''No team member or invitation with the specified email was found.'''
body = '''{
  "errors": "Team member with email \"nonexistent@example.com\" not found"
}'''

[[response]]
status = 422
description = '''The email field is missing or blank.'''
body = '''{
  "errors": "Email is required"
}'''

[[response]]
status = 403
description = '''Removing an admin is forbidden.'''
body = '''{
  "errors": "Removing admins is not allowed via API"
}'''
[/responses]

#### Example cURL

```shell
[label Example]
curl --request DELETE \
  --url "https://betterstack.com/api/v2/team-members?email=bob@example.com" \
  --header "Authorization: Bearer $TOKEN"
```
