API Manager – Auto-Discovery


API auto-discovery is a mechanism that manages an API from API Manager by pairing the deployed application to an API created on the platform.

In this use case we will deploy the application through Anypoint Studio

First update the AnyPoint Studio with Anypoint Platform credentials –same credential will be used to deploy your code in CloudHub.

Add the credential – Goto Window – Preferences – Anypoint Studio – Authentication

API Manager - Auto-Discovery


Now update organization Client id and secret in AnyPoint Studio

We need to get the credentials from AnyPoint platform – in case you can’t see the option then check with Administrator.

API Manager - Auto-Discovery


Click on organization name and then copy Client id and Secret


Update the same in AnyPoint Studio and validate it.

API Manager - Auto-Discovery


Now we need to create the API Manager configuration for the application.

In API Manager – create the API Manager configuration for the mule application – API name will be synced with Exchange assets.

API Manager - Auto-Discovery


Once saved you can see the API ID under Autodiscovery – please note it down. Also, see the status right now is Unregistered.


Now in mule application we must add the AutoDiscovery configuration – add the Global Elements -> AutoDiscovery -> APP ID which we had noted down in earlier step


Now deploy the application through AnyPoint Studio only – as this will ensure the client id and secret will be pushed from Anypoint Studio to Cloudhub.


Or if we want to deploy the mulesoft application manually or through Maven then please add below properties in your deployment


Under properties tab



Once deployed we can see the application in Mule runtime and logs confirming that its successfully got registered with API manager.

API Manager - Auto-Discovery


Also, we can access the endpoint now –


Now if we check API manager again then it’s status must change to Active as application is now registered.

API Manager - Auto-Discovery


Now attach the client policy in API manager for this application

API Manager - Auto-Discovery


Select credential origin


Click Apply

API Manager - Auto-Discovery

Now if we hit the same endpoint then we must get authentication error –

Now let’s create client application credential for accessing the application – from Exchange request for the access.

If no SLA tier is defined, then it will take to Client App page

Just note down the client id and secret

Now if we pass this client id and secret then we can access the application.

Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.

Share this:
Notify of
Newest Most Voted
Inline Feedbacks
View all comments
Rashmi Sarangi
Rashmi Sarangi
4 years ago

need small help in mulesoft dtawave,If you do not mind can you lease share your number?

4 years ago

Nicely put, Thank you.

Thayanidhi Nagendran
Thayanidhi Nagendran
3 years ago

Hi, I tried the same approach but still my API manager is in unrigestered state.
do we need to add traits in the API spec before build it in anypoint studio.

Uresh K
Uresh K
2 years ago

Hello, Can somebody throw some light on the following error in the runtime manager. I am trying API autodiscovery. I have got client_id/client_secret in the properties and I see the following msg in the log as well: “Client ID and Client Secret successfully validated against API Manager.” I have disabled gatekeeper due to a different error and Mule runtime v 4.2.1. The app is started successfully but the API status is still Unregistered. I see the following error frequently. Failed to retrieve API information for API ‘12345678’. This request will be retried after some backoff time. Reason: com.mulesoft.mule.runtime.gw.client.exception.HttpResponseException: Server returned wrong… Read more »

Uresh K
Uresh K
2 years ago
Reply to  admin

Thanks for responding.

Here is the actual error message with the actual autodiscovery id. Also, I set the client_id and client_secret in the properties.

Failed to retrieve API information for API ‘16282398’. This request will be retried after some backoff time. Reason: com.mulesoft.mule.runtime.gw.client.exception.HttpResponseException: Server returned wrong status code: 403. Details: Forbidden

1 year ago

If there is no SLA based policy will the API Manager approves the request by default ?
I think yes, How to avoid this By forcing the user to select anyone SLA policy ?

11 months ago

is it possible to automate the policy creation, get theAPIid and pass it to the API automated CICD process ?