Getting the following error when trying to integrate SFMC using Python. Can someone help me with this?

File "/Users/abhinavagrawal/Desktop/sfmc_new.py", line 17, in <module>
    'account_id': '110007287'
  File "/Users/abhinavagrawal/Library/Python/2.7/lib/python/site-packages/FuelSDK/client.py", line 56, in __init__
    self.configure_client(get_server_wsdl, params, tokenResponse)
  File "/Users/abhinavagrawal/Library/Python/2.7/lib/python/site-packages/FuelSDK/client.py", line 207, in configure_client
  File "/Users/abhinavagrawal/Library/Python/2.7/lib/python/site-packages/FuelSDK/client.py", line 275, in refresh_token
  File "/Users/abhinavagrawal/Library/Python/2.7/lib/python/site-packages/FuelSDK/client.py", line 326, in refresh_token_with_oAuth2
    raise Exception('Unable to validate App Keys(ClientID/ClientSecret) provided: ' + repr(r.json()))
Exception: Unable to validate App Keys(ClientID/ClientSecret) provided: {u'errorcode': 404, u'message': u'Not Found', u'documentation': u'https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm'}
import FuelSDK
import ET_Client

stubObj = FuelSDK.ET_Client(
      False, False,
         'grant_type': 'client_credentials',
          'authenticationurl': 'https://mcxqdjf10j-ts2tln1bh5s72fqnm.auth.marketingcloudapis.com/v2/token',
          'account_id': ''


myClient = FuelSDK.ET_Client()
list = FuelSDK.ET_List()
list.auth_stub = myClient
response = list.get()

print 'Post Status: ' + str(response.status)
print 'Code: ' + str(response.code)
print 'Message: ' + str(response.message)
print 'Result Count: ' + str(len(response.results))
print 'Results: ' + str(response.results)
  • Based on the error, it sounds like the ClientID and Secret (think username/password) for connecting to your SFMC APP are not found where expected. {u'errorcode': 404, u'message': u'Not Found',... Dec 8, 2020 at 16:35
  • @Gortonington I am using the following code. Have edited the question Dec 8, 2020 at 17:14

1 Answer 1


I assume you have deliberately removed the clientId and clientSecret values from your code example and are including these in your call.

You just need to set useOAuth2Authentication to True as you are using OAuth 2.0, not the legacy OAuth 1.0 flow.

You must log in to answer this question.

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