---
sidebar_label: Force delete for misconfigured scopes
doc_id: 70a942fc-6629-4399-8579-efea79ad9457
description: >-
  How to force delete scopes when standard deletion fails due to configuration
  errors or expired credentials.
keywords:
  - force delete
  - scope management
  - API
  - error handling
  - infrastructure cleanup
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Force delete for misconfigured scopes

Sometimes, scopes can't be deleted normally due to configuration errors that are considered "unfixable". This can happen in cases where the system can't guarantee successful deletion, such as when:

- authentication credentials have expired.
- a provider is misconfigured, such as with GCP.
- a request to create a scope fails.


In such cases, you can use **the `force` query parameter**. This option lets you retry deleting a scope after a previous attempt has failed. When enabled, the system will attempt to remove the scope by bypassing the checks that caused the failure.


### Considerations

- The option becomes available after you've attempted to delete the scope using a standard delete request and that attempt has failed.
- The **approvals** process is not bypassed when performing a force delete. All approval workflows and policies will proceed as usual and **won't be skipped**.
- **Residual infrastructure**: When using force delete, there's a possibility that some infrastructure components may remain if they couldn’t be successfully deleted in previous attempts.


### How it works
- If a standard delete operation fails, the `force` option becomes available.
- When you include `force=true` in your delete request, the system attempts to delete the scope again, ignoring conditions that blocked the initial attempt.

```mermaid
flowchart LR
A[Start:<br>delete scope request] --> C{Delete<br>successful?}
C -- Yes --> D[Scope deleted]
C -- No --> E[Retry delete<br>with force=true]
E --> H{Delete<br>successful?}
H -- Yes --> D
H -- No --> I[Deletion failed:<br>contact support]
```

## Force deleting scopes using the API

:::info You need an [**Ops role**](/docs/authorization/roles) to use force delete on a scope.
:::

### 1. Send the request

Send a [DELETE request](/docs/api/scope-delete) using our CLI or API to remove a scope.

<Tabs
  defaultValue="cli"
  values={[
      { label: 'CLI', value: 'cli' },
      { label: 'cURL', value: 'curl' },
  ]}>
  <TabItem value="cli">

  ```bash
  np scope delete \
  --id :id \
  --force
  ```

</TabItem>
<TabItem value="curl">

```bash
curl -L -X DELETE 'https://api.nullplatform.com/scope/:id?force=true' \
-H 'Authorization: Bearer <token>'
```
  </TabItem>
</Tabs>

Where:

- `id`: the unique identifier of the scope to delete.
- `force=true`: enables force deletion of the scope.

If the request is successful, you'll receive a **200 OK** response.

### 2. Verify the scope is deleted

Send a [GET request](/docs/api/scope-read) to check the status of the scope.

<Tabs
  defaultValue="cli"
  values={[
      { label: 'CLI', value: 'cli' },
      { label: 'cURL', value: 'curl' },
  ]}>
  <TabItem value="cli">

```bash
np scope read \
--id :id
```

</TabItem>
<TabItem value="curl">

```bash
curl -L 'https://api.nullplatform.com/scope/:id' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <token>'
```

  </TabItem>
</Tabs>
where:
- `id`: the unique identifier of the scope to verify.

You'll receive a response with `status: "deleted"`, confirming that the misconfigured scope has been successfully removed.
