# Move a space to trash

> DELETE /spaces/{spaceId}

Source: https://mockflow.com/developers/reference/spaces/delete-space

**DELETE** `https://api.mockflow.com/v1/spaces/{spaceId}`  
Scopes: `boards:write`

**curl**

```bash
curl https://api.mockflow.com/v1/spaces/spc_92kd \
  -X DELETE \
  -H "Authorization: Bearer $MOCKFLOW_API_KEY"
```

**JavaScript**

```javascript
const response = await fetch("https://api.mockflow.com/v1/spaces/spc_92kd", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${process.env.MOCKFLOW_API_KEY}`
  }
});

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

**Python**

```python
import os, requests

response = requests.delete(
    "https://api.mockflow.com/v1/spaces/spc_92kd",
    headers={"Authorization": f"Bearer {os.environ['MOCKFLOW_API_KEY']}"},
)

response.raise_for_status()
data = response.json()
```

**204**

No body. Trashed.

**402**

```json
{
  "error": {
    "code": "plan_limit",
    "message": "AI credits exhausted. 0 of 2000 remaining this month.",
    "upgradeUrl": "https://mockflow.com/pricing"
  },
  "requestId": "req_01ja"
}
```

**429**

```json
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests.",
    "docsUrl": "https://mockflow.com/developers/concepts/errors#rate_limited"
  },
  "requestId": "req_45d49816999bac40"
}
```

The space and every board in it go to the trash for 30 days, as in the app. Only the owning workspace can do this. Basic has no trash, so a Basic space with boards in it answers 402.

### Authorization

- `Authorization` (string, required): `Bearer <key>`. The key needs `boards:write` scope. Create and manage keys in the [developer console](/developers/console/); what each scope unlocks is on the [scopes page](/developers/concepts/scopes).

### Path parameters

- `spaceId` (string, required)

### Response

- `No body`: Trashed.

### Errors

- 402 `plan_limit`: The workspace plan does not allow this, or AI credits are exhausted.
- 429 `rate_limited`: Too many requests.
