Deleting APIs
User can delete their own API definitions at any time, but organization-owned APIs can only be deleted by the organization owners. When an API is deleted, all the designers and consumer sharing that API receive an email notification.
Important
Deleting an API cannot be undone. You might want to download the API definition for backup purposes before deleting it.
Delete from API catalog pages
Note: In SwaggerHub On-Premise, this is supported since v. 1.26.
In the SwaggerHub sidebar, select the organization or project that contains the API you want to delete.
If you want to delete a personal API, select Home instead.
Find the API you want to delete. You can use sort, filter, and search options to find that API.
Click to the right of the API.
Note
If there is no button, it means you don’t have permissions to delete this API. For example, you may be an Editor, but not the Owner of the API.
Select the Yes, I want to delete this API check box and click Delete API.
Delete from SwaggerHub Editor
Open the API in the SwaggerHub Editor.
Click the API name. This will open the API Info panel.
Click in the API Info panel.
Note
If there is no button, it means you don't have permissions to delete this API. For example, you may be an Editor, but not the Owner of the API.
Select the Yes, I want to delete this API check box and click Delete API.
Delete an API with published versions
If your API has published versions, you need to unpublish them before deleting the API. This is an extra safety precaution against deleting published APIs.
On your API page, open the version list and see which versions are published.
For each published version:
Switch to this version.
Click to unpublish this version.
After all versions have been unpublished, you can delete the API by clicking in the info panel.
Delete via CLI
Use SwaggerHub CLI to delete an API from the command line:
swaggerhub api:delete OWNER/API_NAME
The --force
option bypasses the confirmation prompt:
swaggerhub api:delete OWNER/API_NAME --force
Note
The API must not have published versions, otherwise, the api:delete
command will fail.