Per the documentation, I've created an "installed package" in the admin panel of SFMC, which provides me a clientId and clientSecret. I'm using the Python requests library to make the call from my command line. This is just to get an accessToken, so the code is pretty straightforward:

import requests

url = 'https://auth.exacttargetapis.com/v1/requestToken'
headers = {'Content-Type': 'application/json'}
clientId = '123'
clientSecret = 'abc'

response = requests.request('POST', url,
                            auth=(clientId, clientSecret),


The verify flag is set to False for now because of unresolved issues with the Python package certifi, but this is a separate issue and shouldn't affect the request.

I don't know exactly what the issue is, but I always receive this error message:

{"message":"clientId is required","errorcode":10002,"documentation":""}

I'm supplying the clientId in the appropriate (Python) syntax, and it's such a simple request that I can't see why it's failing. Any help is much appreciated.

SFMC API documentation: https://developer.salesforce.com/docs/atlas.en-us.mc-getting-started.meta/mc-getting-started/mc-dev-setup.htm

Requests (Python HTTP library): http://docs.python-requests.org/en/master/

  • Have you tried using the clientId and clientSecret in just Postman, or some other REST tool?
    – Timothy
    Commented Feb 22, 2018 at 20:24
  • I just downloaded Postman for Windows (x64) and it worked, but only after I turned off SSL certificate verification (this is a separate issue I'm having with the 'Request' library, but I don't think it's related). In any case, I'm still not sure why making the Python request is resulting in an error.
    – smc5293
    Commented Feb 22, 2018 at 21:07
  • I was able to duplicate this error by setting Content-Type to text instead of application/json Commented Jun 7, 2019 at 4:16

1 Answer 1


You need to send the clientId and clientSecret as the body of the POST not as an auth header like:

  "clientId": "gyjzvytv7ukqtfn3x2qdyfsn",
  "clientSecret": "************"

or a data key value pair like: data = {'clientId':'value'}

  • I tried this but received a different error: {"documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm", "errorcode": 0, "message": "Bad Request"}. I assume that this means the request validated (i.e., credentials were supplied in the correct format), but the credentials themselves were incorrect. I copied/pasted the clientId and clientSecret directly from SFMC into my script, so I'm certain that they're correct.
    – smc5293
    Commented Feb 23, 2018 at 17:31
  • It occurred to me that, in addition to removing the auth header, I should try removing the headers header as well. This did the trick! I'm not really sure exactly why this is, but it solved the issue. Thanks for the tip @TravisNaughton.
    – smc5293
    Commented Feb 23, 2018 at 17:34

You must log in to answer this question.

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