Loading

How to generate your Authorization Bearer token for Anypoint Platform

Publiceringsdatum: Jul 17, 2025
Uppgift

Generate an authorization bearer token for usage in Anypoint Platform REST APIs

Steg

DESCRIPTION

This KB works if your account username is excluded from MFA, If the MFA is mandatory, then it won’t work.
If your organization has implemented external identity management (SSO/SAML), follow the steps - To Obtain an API Bearer Token Using a SAML Assertion.
If you're rather using a non-federated user, follow the steps described in this article.

You can also get a bearer token using the client_id and client_secret of your CloudHub Organization or Environment via OAuth2, as described in the Anypoint Access Management API documentation.

However, this token is mainly helpful for API Manager purposes and is not associated with a user, therefore you cannot use it to call most APIs (for example CloudHub).

If MFA is enabled on the user, the following method to get a token using a username/password can not be used. Please reference Creating connected app and getting the bearer token example, or How to Get the Anypoint Access Token from Chrome Browser Session.


STEPS TO FOLLOW

Please see the following CURL comments.

On Mac, replace <USERNAME> and <PASSWORD>: 

curl -H "Content-Type: application/json" -X POST -d '{"username":"<USERNAME>","password":"<PASSWORD>"}' "https://anypoint.mulesoft.com/accounts/login"


On Linux, replace my-user and my-pass with your actual username and password for CloudHub, and then run it:

curl -d 'username=my-user&password=my-pass' https://anypoint.mulesoft.com/accounts/login


On Windows please use:

curl -sq 'https://anypoint.mulesoft.com/accounts/login' -H "Content-Type: application/json" -d "{\"username\": \"my-user\",\"password\": \"my-pass\"}"​​​​


A JSON output should be generated, you should see an access_token in that output. The such token will be valid for at least 60 minutes, depending on the account configuration.

You can optionally get the organization id to use in other CloudHub API calls. In the following command replace my-token with the bearer token from the previous command, and run:

curl -sq 'https://anypoint.mulesoft.com/accounts/api/me' -H 'Authorization: Bearer my-token'

 

REFERENCE

Please note that this method of accessing the Anypoint API will be going away with the intro of the MFA requirement for all MuleSoft Anypoint Platform users.

 

 
Knowledge-artikelnummer

001115323

 
Laddar
Salesforce Help | Article