# Remove a team

Removes a team. This can't be undone. Needs a [global API token](https://betterstack.com/docs/uptime/api/getting-started-with-uptime-api/#get-a-global-api-token) that isn't read-only.

[Remove all team members](https://betterstack.com/docs/uptime/api/team-members/delete/) first, and remove admins in Better Stack, since the API can't remove them. Your organization's last team can't be removed.

[endpoint]
base_url = "https://betterstack.com"
path = "/api/v2/teams/{id}"
method = "DELETE"

[[path_param]]
name = "id"
description = "The ID of the team, like `t123`. The number alone, like `123`, works too."
required = true
type = "string"

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

[responses]
[[response]]
status = 204
description = '''The team was removed.'''
body = ''''''

[[response]]
status = 401
description = '''Returned for a missing or invalid token, or a token that isn't a global API token.'''
body = '''{
  "errors": "We could not authenticate your request. Please provide a valid Global API token or Better Stack OAuth token."
}'''

[[response]]
status = 403
description = '''Returned for a read-only global API token.'''
body = '''{
  "errors": "This API token is read-only and cannot be used for write operations."
}'''

[[response]]
status = 404
description = '''Your organization has no team with the given ID.'''
body = '''{
  "errors": "Resource type team with id = t123 was not found"
}'''

[[response]]
status = 422
description = '''Returned when the team still has members, or is your organization's last team.'''
body = '''{
  "errors": "Please remove all team members from this team before removing it."
}'''
[/responses]

#### Example cURL

```shell
[label Example]
curl --request DELETE \
  --url https://betterstack.com/api/v2/teams/t123 \
  --header "Authorization: Bearer $TOKEN"
```
