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.

  1. 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 My Hub instead.

  2. Find the API you want to delete. You can use sort, filter, and search options to find that API.

  3. Click Delete API to the right of the API.

    Deleting an API

    Note

    If there is no Delete APIbutton, 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.

  4. Select the Yes, I want to delete this API check box and click Delete API.

Delete from SwaggerHub Editor

  1. Open the API in the SwaggerHub Editor.

  2. Click the API name. This will open the API Info panel.

    Opening the API Info panel
  3. Click Delete API in the API Info panel.

    Deleting an API

    Note

    If there is no Delete APIbutton, 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.

  4. 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.

  1. On your API page, open the version list and see which versions are published.

    Published versions
  2. For each published version:

    • Switch to this version.

    • Click unpublish.png to unpublish this version.

      Unpublish version
  3. After all versions have been unpublished, you can delete the API by clicking Delete API 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.

See Also

Publication date: