# Delete organization

> Source: https://elaichi.ai/docs/api-reference/organizations/organization/deleteorganization/

`DELETE /organization/{id}`

Resource: **Organization** · API: **Organizations**

## Path parameters

- **`id`** _(string, required)_
  Organization id (`org_…`).

## Request body

- **`confirm_slug`** _(string)_
  Must equal this organization’s `slug`. Re-checked server-side.
- **`reason`** _(string)_
  Optional note, recorded on the audit entry this deletion writes before it runs.

## Response body

- **`deleted`** _(boolean)_
  Allowed: `true`
- **`organization_id`** _(string)_
- **`pending_deletion`** _(boolean)_
  Always `true` here: this route only schedules. The organization is read-only until `purge_after` and can be brought back with `POST /organization/{id}/restore`.
  Allowed: `true`
- **`purge_after`** _(string)_
  When the daily cron will run the full teardown, 30 days out. The restore window closes at this instant. A repeat call on an already-scheduled organization returns the deadline already set, never a later one.
- **`summary`** _(object)_
  Only what THIS call severed. Counts are of items successfully removed. The purge-only counts (`api_tokens_revoked`, `conversations_purged`, `logo_objects_deleted`) are absent here, not zero: they appear only on the day-30 purge and on a staff `immediate` delete.
  - **`connections_deleted`** _(integer)_
  - **`scim_tokens_revoked`** _(integer)_
  - **`oauth_grants_revoked`** _(integer)_
  - **`stripe_subscription_cancelled`** _(boolean)_
  - **`failures`** _(array<object>)_
    Steps that did not come off cleanly on this run, one entry per step. Empty on a clean run; a retry of the same delete may clear them. Bounded by the fixed number of teardown steps, never by organization size — a step that walks a collection reports a count and a few sample ids in its single entry rather than one entry per row.
    - **`step`** _(string)_
    - **`detail`** _(string)_
  - **`residue`** _(array<object>)_
    Stores a deletion cannot reach at all. Empty on this route, because scheduling touches none of them; the day-30 purge (and a staff immediate delete) reports them, and that list is never a sign that anything went wrong. It is the list an erasure request is answered with.
    - **`step`** _(string)_
    - **`detail`** _(string)_

## Code examples

### curl

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

### JavaScript

```javascript
const response = await fetch('https://api.elaichi.ai/organization/<id>', {
  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/organization/<id>"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}

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