# Cancel a scheduled deletion

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

`POST /organization/{id}/restore`

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

## Path parameters

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

## Response body

- **`restored`** _(boolean)_
  Allowed: `true`
- **`organization`** _(object)_
  - **`id`** _(string)_
    Organization id (`org_…`) — the value for `X-Organization-Id`.
  - **`name`** _(string)_
  - **`slug`** _(string)_
    Immutable after creation.
  - **`plan`** _(string)_
    The stored plan: `gold`, `black`, or `none` when locked. This is not the same as the effective entitlement — read `GET /organization/{id}/entitlements` before gating a feature on it.
  - **`region`** _(string,null)_
    Data location fixed at creation: `us`/`eu` pin a hard jurisdiction, `apac` is a placement hint.
  - **`trial_ends_at`** _(string,null)_
  - **`trial_indefinite_at`** _(string,null)_
    When staff granted an indefinite trial, or null. Unlocked with no end date: no countdown, no expiry email, billing still reachable.
  - **`settings`** _(object)_
    Free-form org settings. `PATCH /organization/{id}` REPLACES this object wholesale.
  - **`logo`** _(string,null)_
    Public URL of the logo image, or null.
  - **`can_delete`** _(boolean)_
    Whether the CALLER may delete this organization — the `org:delete` permission, which only the Org Owner role holds, and never for the platform root organization. Server-computed: branch on this rather than inspecting roles. Always `false` where the response has no member context to compute it from — the org switcher list `GET /organization` (one member-context lookup per row would be a per-row round trip), the staff console, and the invite-accept response. It never overstates: trust it when true, and read `GET /user/me` or `GET /organization/{id}` (both of which compute it) when you need it for a list row.
  - **`deletion_scheduled_at`** _(string,null)_
    Set when a deletion has been scheduled (`DELETE /organization/{id}`). The organization is read-only until `purge_after`. Null otherwise.
  - **`purge_after`** _(string,null)_
    When a scheduled deletion becomes permanent — 30 days after `deletion_scheduled_at`. Null unless scheduled.
  - **`can_restore`** _(boolean)_
    Whether the CALLER may cancel a scheduled deletion: the `org:manage` permission, and only while `purge_after` is still ahead. Server-computed, like `can_delete`, and `false` for the same reasons — no member context (the org switcher list, the staff console) — plus once the window has closed. Read `purge_after` to tell "too late" from "not yours to undo".
  - **`created_at`** _(string)_
  - **`updated_at`** _(string)_

## Code examples

### curl

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

### JavaScript

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

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