Contact Us 1-800-596-4880

Configure API Autodiscovery for Local Testing

logo cloud IDE Cloud IDE

logo desktop IDE Desktop IDE

Cloud IDE (Beta) is scheduled for retirement on August 31, 2026. August 30, 2026 is the last day you can access Cloud IDE (Beta). Download your projects to work from Desktop IDE. Learn more in Migrate a Project from Cloud IDE to Desktop IDE.

Configure API Autodiscovery to connect your local Mule application to an API instance in API Manager. This setup enables local policy testing before you deploy the application.

Before You Begin

Ensure you have:

Get the API ID

  1. In Anypoint Platform, open API Manager.

  2. In API Administration, select your API instance.

  3. On the API summary page, copy the API Instance ID.

Add the Autodiscovery Element

In your Mule app, add the autodiscovery element in your flow definitions. Use a property reference for apiId so you can load the value through configuration:

<api-gateway:autodiscovery apiId="${api.instance.id}" flowRef="<YOUR_MAIN_FLOW_NAME>" />

Configure Local Credentials

For local execution in Anypoint Code Builder, provide your environment credentials through config.yaml or through Mule runtime arguments in VS Code settings. Avoid hardcoding secrets in Mule XML files.

Set these properties:

  • anypoint.platform.client_id

  • anypoint.platform.client_secret

Example config.yaml:

api.instance.id: "<YOUR_API_ID>"
anypoint.platform.client_id: "<YOUR_ENV_CLIENT_ID>"
anypoint.platform.client_secret: "<YOUR_ENV_CLIENT_SECRET>"

Example Mule runtime arguments:

-M-Danypoint.platform.client_id=<YOUR_ENV_CLIENT_ID> -M-Danypoint.platform.client_secret=<YOUR_ENV_CLIENT_SECRET>

To add these values in Anypoint Code Builder:

  1. Open the Settings tab.

    Show me how
    • From the Anypoint Code Builder panel, click the (gear) icon.

    • From the activity bar, click the (gear) icon, select Settings, and search for mule in the Settings tab.

    • Provide the command MuleSoft: Open ACB Settings in the Command Palette.

  2. In the Settings tab, find Mule › Runtime: Default Arguments.

  3. Append the client ID and client secret arguments to the end of the existing arguments.

Append the placeholder values with your client ID and client secret.