# Remove member

> Source: https://elaichi.ai/docs/api-reference/members/member/deletemember/

`DELETE /member/{userId}`

Resource: **Member** · API: **Members**

## Path parameters

- **`userId`** _(string, required)_
  User id (`usr_…`) of an org member.

## Request body

- **`connection_actions`** _(array<object>)_
  Optional: every connection the member owns is deleted whether named or not.
  - **`connection_id`** _(string)_
    Connection id (`conn_…`) from the offboarding preflight.
  - **`action`** _(string)_
    The only action. `transfer` answers 400 `connection_transfer_removed`.
    Allowed: `delete`
- **`connection_replacements`** _(array<object>)_
  Before each old connection is deleted, rewrite every toolbox entry and other member's synthetic tool step naming it onto the replacement. One entry per old connection.
  - **`connection_id`** _(string)_
    The leaver's connection (`conn_…`).
  - **`replacement_connection_id`** _(string)_
    Same connector, active, not the leaver's, usable by the caller. `null` keeps this one connection out of its app's `replacement_defaults` entry: the tools that used it stop.
- **`toolbox_actions`** _(array<object>)_
  Per-resource decisions; a shared one with none (and no bulk target) refuses the removal.
  - **`resource_id`** _(string)_
    Id from the offboarding preflight.
  - **`action`** _(string)_
    Allowed: `transfer`, `delete`
  - **`target_user_id`** _(string)_
    A person (`usr_…`): an active member other than the leaver and the caller.
  - **`target_team_id`** _(string)_
    A team (`team_…`): its first active admin owns it, the team gets an `edit` share. Never with `target_user_id`.
- **`template_actions`** _(array<object>)_
  Per-resource decisions; a shared one with none (and no bulk target) refuses the removal.
  - **`resource_id`** _(string)_
    Id from the offboarding preflight.
  - **`action`** _(string)_
    Allowed: `transfer`, `delete`
  - **`target_user_id`** _(string)_
    A person (`usr_…`): an active member other than the leaver and the caller.
  - **`target_team_id`** _(string)_
    A team (`team_…`): its first active admin owns it, the team gets an `edit` share. Never with `target_user_id`.
- **`collection_actions`** _(array<object>)_
  Per-resource decisions; a shared one with none (and no bulk target) refuses the removal.
  - **`resource_id`** _(string)_
    Id from the offboarding preflight.
  - **`action`** _(string)_
    Allowed: `transfer`, `delete`
  - **`target_user_id`** _(string)_
    A person (`usr_…`): an active member other than the leaver and the caller.
  - **`target_team_id`** _(string)_
    A team (`team_…`): its first active admin owns it, the team gets an `edit` share. Never with `target_user_id`.
- **`dashboard_actions`** _(array<object>)_
  Per-resource decisions; a shared one with none (and no bulk target) refuses the removal.
  - **`resource_id`** _(string)_
    Id from the offboarding preflight.
  - **`action`** _(string)_
    Allowed: `transfer`, `delete`
  - **`target_user_id`** _(string)_
    A person (`usr_…`): an active member other than the leaver and the caller.
  - **`target_team_id`** _(string)_
    A team (`team_…`): its first active admin owns it, the team gets an `edit` share. Never with `target_user_id`.
- **`knowledge_base_actions`** _(array<object>)_
  Per-resource decisions; a shared one with none (and no bulk target) refuses the removal.
  - **`resource_id`** _(string)_
    Id from the offboarding preflight.
  - **`action`** _(string)_
    Allowed: `transfer`, `delete`
  - **`target_user_id`** _(string)_
    A person (`usr_…`): an active member other than the leaver and the caller.
  - **`target_team_id`** _(string)_
    A team (`team_…`): its first active admin owns it, the team gets an `edit` share. Never with `target_user_id`.
- **`bundle_actions`** _(array<object>)_
  Per-resource decisions; a shared one with none (and no bulk target) refuses the removal.
  - **`resource_id`** _(string)_
    Id from the offboarding preflight.
  - **`action`** _(string)_
    Allowed: `transfer`, `delete`
  - **`target_user_id`** _(string)_
    A person (`usr_…`): an active member other than the leaver and the caller.
  - **`target_team_id`** _(string)_
    A team (`team_…`): its first active admin owns it, the team gets an `edit` share. Never with `target_user_id`.
- **`connector_actions`** _(array<object>)_
  One decision per custom connector the member owns (see `connectors` on the offboarding preflight). Required for every connector unless `defaults.transfer_to_user_id` covers it.
  - **`connector_slug`** _(string)_
    Connector slug from the offboarding preflight.
  - **`action`** _(string)_
    `transfer` hands ownership to `target_user_id` (grants untouched). There is no delete, and no release: `release` was removed and answers 400 `connector_release_removed`.
    Allowed: `transfer`
  - **`target_user_id`** _(string)_
    For `transfer` (`usr_…`) — an active member other than the one being removed and other than the caller.
  - **`target_team_id`** _(string)_
    For `transfer`: a team (`team_…`) instead of a person.
- **`replacement_defaults`** _(array<object>)_
  One replacement per app instead of one `connection_replacements` entry per connection: every connection of `connector_slug` with no `connection_replacements` entry of its own is replaced by `replacement_connection_id`, validated per connection exactly like an explicit entry. A replacement the rules refuse is a 400 for the whole request (`replacement_*`); an app named twice is 400 `duplicate_replacement_default`; an app the member has no connection of is 400 `replacement_default_unknown_connector`.
  - **`connector_slug`** _(string)_
    The app, from the preflight's connections.
  - **`replacement_connection_id`** _(string)_
    One of that app's `replacement_candidates`.
- **`kind_defaults`** _(object)_
  One decision per KIND for every item of it with no per-resource entry. Per item: its own entry wins, then its kind's default, then `defaults`. A transfer names exactly one of `target_user_id` / `target_team_id`; a delete names neither (400 otherwise). Unlike `defaults`, a kind default may delete — it names one kind deliberately — and a delete reaches only the items in the summary the caller read: one created since is left for the next round (202).
  - **`toolbox`** _(object, required)_
    - **`action`** _(string)_
      Allowed: `transfer`, `delete`
    - **`target_user_id`** _(string)_
      For `transfer`: a person (`usr_…`).
    - **`target_team_id`** _(string)_
      For `transfer`: a team (`team_…`) instead of a person.
  - **`template`** _(object, required)_
    - **`action`** _(string)_
      Allowed: `transfer`, `delete`
    - **`target_user_id`** _(string)_
      For `transfer`: a person (`usr_…`).
    - **`target_team_id`** _(string)_
      For `transfer`: a team (`team_…`) instead of a person.
  - **`collection`** _(object, required)_
    - **`action`** _(string)_
      Allowed: `transfer`, `delete`
    - **`target_user_id`** _(string)_
      For `transfer`: a person (`usr_…`).
    - **`target_team_id`** _(string)_
      For `transfer`: a team (`team_…`) instead of a person.
  - **`dashboard`** _(object, required)_
    - **`action`** _(string)_
      Allowed: `transfer`, `delete`
    - **`target_user_id`** _(string)_
      For `transfer`: a person (`usr_…`).
    - **`target_team_id`** _(string)_
      For `transfer`: a team (`team_…`) instead of a person.
  - **`knowledge_base`** _(object, required)_
    - **`action`** _(string)_
      Allowed: `transfer`, `delete`
    - **`target_user_id`** _(string)_
      For `transfer`: a person (`usr_…`).
    - **`target_team_id`** _(string)_
      For `transfer`: a team (`team_…`) instead of a person.
  - **`connector`** _(object, required)_
    - **`action`** _(string)_
      Custom connectors are never deleted.
      Allowed: `transfer`
    - **`target_user_id`** _(string)_
      A person (`usr_…`).
    - **`target_team_id`** _(string)_
      A team (`team_…`) instead of a person.
- **`defaults`** _(object)_
  Bulk decisions for every resource that carries no explicit per-resource action.
  - **`transfer_to_user_id`** _(string)_
    One active member (`usr_…`) who inherits everything owned that has no explicit action. Connections never follow it.
  - **`transfer_to_team_id`** _(string)_
    Or one team (`team_…`): its first active admin owns everything, the team gets an `edit` share. Never with `transfer_to_user_id`.
  - **`delete_synthetic_tools`** _(boolean)_
    Acknowledge, once, that every synthetic tool is deleted with its author.

## Response body

- **`success`** _(boolean)_

## Code examples

### curl

```bash
curl -X DELETE 'https://api.elaichi.ai/member/<userId>' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const response = await fetch('https://api.elaichi.ai/member/<userId>', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/member/<userId>"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}

response = requests.delete(url, headers=headers)
print(response.json())
```
