---
sidebar_label: Delete applications
doc_id: e3c1f6ab-4c02-4e32-9a4a-9f7a0a2bf3de
description: >-
  Learn how to delete applications in nullplatform using the UI, CLI, or API by
  setting the application status to `deleting`.
keywords:
  - applications
  - delete
  - application status
  - admin-role
  - nullplatform
---

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

# Delete applications

You can delete applications from your organization using the nullplatform UI, CLI, or API.

:::info You must have an [**Admin** or **Developer** role](/docs/authorization/roles) to delete applications.
:::


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

You can delete an application directly from the **Namespace** view.  
Open the options menu **(⋮)** next to the application you want to remove and select **Delete**.

</TabItem>
<TabItem value="delete-app-cli">

[Patch the application](/docs/api/application-update)'s status to **`deleting`**.

```bash
np application patch \
--id <APPLICATION_ID> \
--body '{
"status": "deleting"
}'
```

</TabItem>
<TabItem value="delete-app-curl">

[Patch the application](/docs/api/application-update)'s status to **`deleting`**.

```bash
curl -L -X PATCH 'https://api.nullplatform.com/application/:id' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <token>' \
-d '{
"status": "deleting"
}'
```
</TabItem>
</Tabs>

## Troubleshooting: I can't delete my application

You can't delete an application if it still owns any services or links, or has scopes associated with it.

To resolve this, you'll need to:

1. Transfer ownership of links and services.
2. Update where the service can be linked.
3. Remove scopes associated with the application.


### Transfer ownership of links and services

#### 1. Identify what services or links the application owns

First, check what services or links the application owns:

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

  1. Go to **Development > Services**.
  2. Select the **Owned by this application** tab to see the services you need to transfer.
  
</TabItem>
  <TabItem value="service-cli">

  Use the [service list](/docs/api/service-list) or [link list](/docs/api/link-list) commands with the application's `entity_nrn` as a query parameter.

  > **Tip:** For services, the `nrn` (source) must match the `entity_nrn`.

  <Tabs
    defaultValue="service-list"
    values={[
      { label: 'Service', value: 'service-list' },
      { label: 'Link', value: 'link-list' },
    ]}>
    <TabItem value="service-list">

    ```bash
    np service list 
      --nrn organization=1:account=1:namespace=1:application=1  
      --entity_nrn organization=1:account=1:namespace=1:application=1    
    ```

    </TabItem>
    <TabItem value="link-list">

    ```bash
    np link list 
      --nrn organization=1:account=1:namespace=1:application=1 
    ```

    </TabItem>
  </Tabs>

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

  Use the [service list](/docs/api/service-list) or [link list](/docs/api/link-list) commands with the application's `entity_nrn` as a query parameter.

  > **Tip:** For services, the `nrn` (source) must match the `entity_nrn`.

  <Tabs
    defaultValue="service-list"
    values={[
      { label: 'Service', value: 'service-list' },
      { label: 'Link', value: 'link-list' },
    ]}>
    <TabItem value="service-list">

    ```bash
    curl -L 'https://api.nullplatform.com/service?nrn=organization=1:account=1:namespace=1:application=1&entity_nrn=organization=1:account=1:namespace=1:application=1' \
    -H 'Authorization: Bearer <token>'

    ```

    </TabItem>
    <TabItem value="link-list">

    ```bash
    curl -L 'https://api.nullplatform.com/link?nrn=organization=1:account=1:namespace=1:application=1' \
    -H 'Authorization: Bearer <token>' 
    ```

    </TabItem>
  </Tabs>

  These commands will show what the application owns and what's blocking deletion.


</TabItem>
</Tabs>


#### 2. Change the owner

Once you've identified the service or link, update its owner by changing the `entity_nrn` to a different application. Use a PATCH request to [services](/docs/api/service-update) or [links](/docs/api/link-update).

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

  - Update a service owner:

    ```bash
    np service patch \
      --id <SERVICE_ID> \
      --body '{
        "entity_nrn": "organization=1:account=1:namespace=1:application=2"
      }'
    ```

  - Update a link owner:

    ```bash
    np link patch \
      --id <LINK_ID> \
      --body '{
        "entity_nrn": "organization=1:account=1:namespace=1:application=2"
      }'
    ```

</TabItem>

<TabItem value="owner-patch-curl">

  - Update a service owner:

    ```bash
    curl -L -X PATCH 'https://api.nullplatform.com/service/<SERVICE_ID>' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <token>' \
    -d '{
        "entity_nrn": "organization=1:account=1:namespace=1:application=2"
      }'
    ```

  - Update a link owner:

    ```bash
    curl -L -X PATCH 'https://api.nullplatform.com/link/<LINK_ID>' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <token>' \
    -d '{
        "entity_nrn": "organization=1:account=1:namespace=1:application=2"
      }'
    ```


</TabItem>
</Tabs>

Replace the IDs and target NRNs with your own values.

### Update the `linkable_to` property

After transferring ownership, you might also want to [update the service](/docs/api/service-update)'s `linkable_to` property so it reflects the new relationships between applications.

1. Decide which applications should be able to link to this service using their `nrn` values.
2. Patch the service's `linkable_to` array to include the new application(s) and remove the old owner if needed.

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

  ```bash
  np service patch \
    --id <SERVICE_ID> \
    --body '{
      "linkable_to": [
        "organization=1:account=1:namespace=1:application=2",
        "organization=1:account=1:namespace=1:application=3"
      ]
    }'
  ```

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

  ```bash
  curl -L -X PATCH 'https://api.nullplatform.com/service/<SERVICE_ID>' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <token>' \
    -d '{
      "linkable_to": [
        "organization=1:account=1:namespace=1:application=2",
        "organization=1:account=1:namespace=1:application=3"
      ]
    }'
  ```

  </TabItem>
</Tabs>

### Remove scopes from your application

Next, remove all scopes associated with your application. 

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

  1. Go to **Development > Scopes**.
  2. Click on **Manage** and select **Delete** for each scope.

</TabItem>
  <TabItem value="scope-delete-cli">

  Use the [scope endpoint](/docs/scope-api-index) to list and remove scopes.

  1. List scopes associated with the application.

    ```bash
    np scope list \
      --application_id 1234   
    ```

  2. Take the IDs returned for each scope and delete them.

    ```bash
    np scope delete \
      --id 2345
    ```

</TabItem>
<TabItem value="scope-delete-curl">

  Use the [scope endpoint](/docs/scope-api-index) to list and remove scopes.

  1. List scopes associated with the application.

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

  2. Take the IDs returned for each scope and delete them.

    ```bash
    curl -L -X DELETE 'https://api.nullplatform.com/scope/1' \
    -H 'Authorization: Bearer <token>'
    ```

</TabItem>
</Tabs>

:::note
If you're having problems deleting your scopes, see [how to force delete misconfigured scopes](/docs/agent-backed-scopes/troubleshooting/force-delete-scopes).
:::

Now try deleting your application again.
