---
schema_version: "1"
id: 683a030dbae0987a02604cefb98c3409209843fb2aa1479e469d21ea9e248230
title: Getting the Bearer Token for a Connected App in Anypoint Platform
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/access-management/connected-app-bearer-token-example.md
canonical_url: https://docs.mulesoft.com/access-management/connected-app-bearer-token-example
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 3335cbb0a604d1038d4f7f707884d96d0398babf65890b8c24e2b245b2b69c7c
description: MuleSoft Documentation Site
latest: true
---
---
product: Access Management
version: master
---

# Getting the Bearer Token for a Connected App in Anypoint Platform

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Use this example as a reference for creating a connected app with client credentials, adding Runtime
Manager scopes, and retrieving a bearer token to invoke Anypoint Platform APIs. The example includes
deploying the app to CloudHub and using the Access Management API to obtain the token.

## Create a Connected App

To create a connected app, add Runtime Manager scopes, and deploy the app to CloudHub:

1.  In the Access Management navigation menu, click **Connected Apps**.

2.  In **Owned Apps**, click **Create App**.

3.  In **Create App**, enter a unique name for the app, select **App acts on its own behalf (client
    credentials)**, and then click **Save**.

4.  Click **Add Scopes**.

5.  Select the scopes for the app from the **Runtime Manager** section, and then click **Next**.

    For information about scopes and permissions for connected apps, see the
    [Endpoint Scopes](https://docs.mulesoft.com/access-management/connected-apps-developers#endpoint-scopes).

6.  Select the **Business Groups** the app has permission to access the assigned scopes in and click
    **Next**.

7.  Select the **Environments** for the business groups and scopes you selected, and click **Next**.

8.  Review the scopes you added and click **Add Scopes**.

    ![Add scopes review with Runtime Manager scopes selected](/mulesoft/current/en-us/access-management/_images/bearer-token-example-review-scopes.png)

9.  In **Update App**, click **Save Changes**.

## Get the bearer token

To get the bearer token for the app:

1.  In the Access Management navigation menu, click **Connected Apps**.

2.  In **Owned Apps**, click **Copy Id** and save the app’s client ID in a secure location.

3.  Repeat the previous step to copy the app’s client secret.

4.  Run the following cURL command and replace `CLIENT_ID` and `CLIENT_SECRET` with your client ID
    and secret:

    ```command
    curl --location --request POST https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data-urlencode 'client_id=<CLIENT_ID>' \
    --data-urlencode 'client_secret=<CLIENT_SECRET>' \
    --data-urlencode 'grant_type=client_credentials'
    ```

    You receive the following response:

    { "access\_token": "<bearer token>", "token\_type": "bearer" }

    Now that you have the bearer token, you can use the connected app to invoke Anypoint Platform
    APIs. For more examples, see the
    [Access Management API documentation](https://dev-portal.mulesoft.com/apis/access-management.html).

## See Also

- [Anypoint Platform Connected Apps for Developers](https://docs.mulesoft.com/access-management/connected-apps-developers)
