Deleting an API Gateway
Find out how to delete API gateways that you previously created with the API Gateway service.
After you have created an API gateway, you might decide that the API gateway is no longer required. You can delete an API gateway from the API Gateway service, provided there are no API deployments on it.
Deleted API gateways continue to be shown in the Console for 90 days, with a status of Deleted. After 90 days, deleted API gateways are no longer shown.
- On the Gateways list page, find the API gateway that you want to delete. If you need help finding the list page or the API gateway, see Listing API Gateways.
- From the
The API gateway is permanently removed. Note that you cannot delete an API gateway if it still has API deployments on it. You must delete the API deployments first.
for the API gateway, select Delete.
To delete API gateways using the CLI:
- Configure your client environment to use the CLI (Configuring Your Client Environment to use the CLI for API Gateway Development).
-
To delete an existing API gateway:
-
Open a command prompt and run
oci api-gateway gateway delete
to delete the API gateway:oci api-gateway gateway delete --gateway-id <gateway-ocid>
where:
<gateway-ocid>
is the OCID of the API gateway to delete. To find out the API gateway's OCID, see Listing API Gateways.
For example:
oci api-gateway gateway delete --gateway-id ocid1.apigateway.oc1..aaaaaaaab______hga
Note that you cannot delete an API gateway if it still has API deployments on it (including API deployments that are in different compartments to the API gateway itself). You must delete the API deployments first.
The response to the command includes:
- The lifecycle state (for example, DELETED, FAILED).
- The id of the work request to delete the API gateway (details of work requests are available for seven days after completion, cancellation, or failure).
If you want the command to wait to return control until the API gateway has been deleted (or the request has failed), include either or both the following parameters:
--wait-for-state DELETED
--wait-for-state FAILED
For example:
oci api-gateway gateway delete --gateway-id ocid1.apigateway.oc1..aaaaaaaab______hga --wait-for-state DELETED
-
(Optional) To see the status of the work request that is deleting the API gateway, enter:
oci api-gateway work-request get --work-request-id <work-request-ocid>
-
(Optional) To view the logs of the work request that is deleting the API gateway, enter:
oci api-gateway work-request-log list --work-request-id <work-request-ocid>
-
(Optional) If the work request that is deleting the API gateway fails and you want to review the error logs, enter:
oci api-gateway work-request-error --work-request-id <work-request-ocid>
-
(Optional) To verify that the API gateway has been deleted, enter the following command and confirm that the API gateway's lifecycle state is DELETED:
oci api-gateway gateway get --gateway-id <gateway-ocid>
-
For more information about using the CLI, see Command Line Interface (CLI). For a complete list of flags and options available for CLI commands, see CLI Help.
Run the DeleteGateway operation to delete an API gateway.