> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mithunai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Remove a member from your organisation

> End a person's access: they are signed out, and the API keys they made and invitations they sent stop working. Console session only, never an API key.

Removes one person from your organisation. Their account is not deleted, and any other organisation they belong to is unaffected.

Removing someone takes their access with it, straight away:

* **They are signed out of the console on every device**, and their sign-ins to the other surfaces (Chat, Agents, the Gateway) can no longer be renewed through MITHUNAI. A session already open on one of those may run until it next needs renewing.
* **Every API key they created in your organisation is revoked.** Anything using one of those keys stops working, so check the keys list first if a key they made is in use. See [Managing API keys](https://docs.mithunai.com/administration/api-keys.md).
* **Every invitation they sent that has not been accepted is withdrawn.**

The response tells you how many keys and invitations were affected.

This endpoint takes a **signed-in console session**, not an API key. Send the session cookies your browser received when you signed in, plus the `X-CSRF-Token` header set to the value of the `csrf_token` cookie. A request authenticated with an `mithunai_sk_` key is refused with `403`.

You need the owner or admin role. You cannot remove yourself (`403`), someone more senior than you (`403`), or the organisation's owner (`409`). A member who does not exist, a member of another organisation and a malformed ID all return the same `404`.

To bring someone back, [invite them again](https://docs.mithunai.com/api-reference/invitations/create-invitation.md). See [Members](https://docs.mithunai.com/administration/members.md).

**account\_id** `string` *required*

The member's account ID (UUID), as returned in `account_id` by [List
members](https://docs.mithunai.com/api-reference/members/list-members.md).

**X-CSRF-Token** `string` *required*

The value of your session's `csrf_token` cookie (named `__Host-csrf_token` when the console is
served over HTTPS without a shared cookie domain). A missing or mismatched token returns `401`.

## Response

**removed** `boolean` *required*

Always `true`.

**account\_id** `string` *required*

The account ID of the person removed.

**revoked\_api\_keys** `integer` *required*

How many API keys they created in this organisation were revoked.

**revoked\_invitations** `integer` *required*

How many invitations they sent were withdrawn.

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
# cookies.txt holds the cookies from your signed-in console session.
curl --request DELETE "$MITHUNAI_URL/mithunai/api/v1/members/7c9e6679-7425-40de-944b-e07fc1f90ae7" \
  --cookie cookies.txt \
  --header "X-CSRF-Token: $MITHUNAI_CSRF_TOKEN"
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
import os
from http.cookiejar import MozillaCookieJar

import requests

jar = MozillaCookieJar("cookies.txt")
jar.load()

account_id = "7c9e6679-7425-40de-944b-e07fc1f90ae7"
response = requests.delete(
    f"{os.environ['MITHUNAI_URL']}/mithunai/api/v1/members/{account_id}",
    cookies=jar,
    headers={"X-CSRF-Token": os.environ["MITHUNAI_CSRF_TOKEN"]},
    timeout=30,
)
response.raise_for_status()
print(response.json())
```

```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
// Runs in a page on the MITHUNAI console's own origin, while signed in.
// csrfToken is the value of the csrf_token cookie.
const accountId = '7c9e6679-7425-40de-944b-e07fc1f90ae7'
const response = await fetch(`/mithunai/api/v1/members/${accountId}`, {
  method: 'DELETE',
  credentials: 'include',
  headers: { 'X-CSRF-Token': csrfToken },
})
console.log(await response.json())
```

```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "removed": true,
  "account_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "revoked_api_keys": 1,
  "revoked_invitations": 0
}
```

```json 403 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "code": "authorization_error", "message": "You cannot change or remove your own seat." }
```

```json 404 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{ "code": "not_found", "message": "The requested resource was not found." }
```

```json 409 theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "code": "conflict",
  "message": "The organisation's owner cannot be changed or removed. Transfer ownership first."
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.