I have created an App in Marketing Cloud in App center, as off now the app summary page gives me Cilent Id, Client Secret and Application Id for my App.

But, I also need OAuth token for connecting my App to Marketing Cloud.

As I am new to API calls and Marketing cloud, Can someone give a code example of how to retrieve the OAuth access token from the application in App Center and also can I use the same process once the access token expires after 1 hour.

All I found on net regarding this is, To obtain an OAuth token, perform a HTTP POST specifying your clientID and clientSecret in the payload. But, I was not able to put the pieces together.

Also, could some one give some sample code for using this OAuth and Client details to connect to marketing cloud.

  • Which language are you coding your application ? Dec 10, 2016 at 6:14
  • I want it XML or JSON as I need to make a restful service call
    – Sandesh
    Dec 10, 2016 at 17:11

1 Answer 1


To obtain an OAuth token, you will first need to perform an HTTP POST request to the Fuel Authentication Service specifying your client ID and client secret in the payload. An example request is provided below.

POST https://auth.exacttargetapis.com/v1/requestToken
Content-Type: application/json
"clientId": "gyjzvytv7ukqtfn3x2qdyfsn",
"clientSecret": "SJbAEenSK2SVBK4d4vBV6NKT"

This HTTP POST request returns an accessToken which is the OAuth token used for subsequent API requests, and an expiresIn value indicating the expiration period of the OAuth token in seconds. An example response is provided below.

"accessToken": "4ae36paatp4mnwkhanyhajp4",
"expiresIn": 3456

You should also consider using one of the Marketing Cloud SDKs to manage access tokens. These SDKs available include at their core an object for acquiring and refreshing OAuth access tokens using client credentials, removing the requirement to manage access tokens at the application layer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .