After you delete an API, Cloud Endpoints retains the service in a deleted state and will not allow another API with the same service name for approximately 30 days. This allows you to restore your service configuration in case of accidental deletion.
If you want to deploy a different API using the same service name, you can restore the deleted service and deploy a new service configuration, reusing the service name.
To restore a deleted service, run:
gcloud endpoints services undelete SERVICE_NAME
The service has now been restored and assigned to the project that originally created it.
gcloud endpoints services undelete command fails with a permission
error similar to:
ERROR: (gcloud.endpoints.services.undelete) User [EMAIL] does not have permission to access service
make sure you have the Service Management > Service Management Administrator IAM role. Refer to the IAM documentation for how to grant IAM roles to a user.