---
title: "Leave team REST API | HitKeep"
description: "Reference for the HitKeep REST API operation Leave team, including request parameters, responses, and authentication notes."
canonical: "https://hitkeep.com/api/operations/apiuserteamsidleave/"
---

# Leave team REST API

DELETE

/api/user/teams/{id}/leave

FetchcURL

```
const url = 'http://127.0.0.1:25737/api/user/teams/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/leave';
const options = {method: 'DELETE', headers: {cookie: 'hk_token=<hk_token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```
curl --request DELETE \
  --url http://127.0.0.1:25737/api/user/teams/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/leave \
  --cookie hk_token=<hk_token>
```

-

Removes the authenticated user from the specified team and returns the new active team.

## Authorizations

- **[cookieAuth](https://hitkeep.com/api/#cookieauth)**

## Parameters

### Path Parameters

**id**

required

string format: uuid

## Responses

### 200

Leave team response

application/json

object

**active_team_id**

string format: uuid

**recent_team_ids**

Array<string>

**status**

string

##### Examplegenerated

```
{
  "active_team_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
  "recent_team_ids": [
    "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
  ],
  "status": "example"
}
```

### 400

Cannot leave your only team or last owner

application/json

object

**message**

string

##### Examplegenerated

```
{
  "message": "example"
}
```

### 403

Access denied

application/json

object

**message**

string

##### Examplegenerated

```
{
  "message": "example"
}
```

[Previous Resend team invite](https://hitkeep.com/api/operations/apiuserteamsidinvitesinviteidresend/)[Next List team members](https://hitkeep.com/api/operations/apiuserteamsidmembers/get/)
