Delete an App
Overview
You can delete an App Services App from the App Services UI, CLI, or Admin API.
Before You Begin
You will need the following to delete an App in the Atlas UI:
A MongoDB Atlas account with Project Owner permissions. To learn how to sign up for a free account, see Get Started with Atlas.
You will need the following to delete an App in the CLI:
A MongoDB Atlas account with Project Owner permissions. To learn how to sign up for a free account, see Get Started with Atlas.
A MongoDB Atlas Admin API public/private key pair. The API key must have Project Owner permissions to work with App Services Admin API.
A copy of App Services CLI installed and added to your local system
PATH
. To learn how, see Install App Services CLI.Your App's client App ID. This is the unique string that contains your App name, e.g.
"myapp-abcde"
. To learn how to find your App ID, see Get App Metadata.
You will need the following to delete an App with the Admin API:
A MongoDB Atlas account with Project Owner permissions. To learn how to sign up for a free account, see Get Started with Atlas.
A MongoDB Atlas Admin API public/private key pair. The API key must have Project Owner permissions to work with App Services Admin API.
Your App's internal ObjectId hex string and the Project ID of the Atlas Project that contains your App. To learn how to find these, see Get App Metadata.
Procedure
Run the App Delete Command
The CLI can delete one or more apps with the following command:
appservices apps delete
If you have more than one App, you will be prompted to select one or more apps that you would like to delete from a list of all your Apps.
If you already know the name or id of the app you would like
to delete, you can specify it with the --app
flag:
appservices apps delete --app <App ID | App Name>
Tip
See also:
For more details and additional flags, see the CLI documentation for the app delete command.
Authenticate a MongoDB Atlas User
Call the admin user authentication endpoint with your MongoDB Atlas API key pair:
curl -X POST \ https://services.cloud.mongodb.com/api/admin/v3.0/auth/providers/mongodb-cloud/login \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -d '{ "username": "<Public API Key>", "apiKey": "<Private API Key>" }'
If authentication succeeds, the response body contains a JSON object
with an access_token
value:
{ "access_token": "<access_token>", "refresh_token": "<refresh_token>", "user_id": "<user_id>", "device_id": "<device_id>" }
The access_token
grants access to the App Services Admin API. You
must include it as a Bearer token in the Authorization
header for
all Admin API requests.
Delete the App
Send a request to the Delete an App endpoint.
Make sure to include your Admin API access_token
, the
groupId
of the Atlas project containing your App, and
the App's internal appId
hex string:
curl --request DELETE 'https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}' \ --header 'Authorization: Bearer <access_token>' \ --header 'Content-Type: application/json'
If your application deletes successfully, App Services returns a 204
response.