Troubleshooting: Coupa API Connection Error 'Failed to establish the connection to Coupa API. Error code: 400' in Process Mining
When attempting to extract data from the Coupa P2P Source Connection in Process Mining at step 'Extract CSV files' using UiPath provided python script in this documentation the following error may be encountered:
'Failed to establish the connection to Coupa API. Error code: 400'
This error typically indicates that the initial authentication request to Coupa’s API has failed due to malformed or incorrect parameters. It commonly relates to OAuth 2.0 misconfiguration, such as invalid credentials or incorrect scopes.
Troubleshooting Steps:
Use Postman to validate whether the Coupa OAuth 2.0 flow is correct and to know exact cause of the issue.
How to Test:
-
Set method to POST.
-
Endpoint: Use the Token URL from Coupa (https://<your_instance>.coupa.com/oauth2/token)
-
Headers:
-
Content-Type: application/x-www-form-urlencoded
-
-
Body (x-www-form-urlencoded):
-
grant_type: client_credentials
-
client_id: <your_client_id>
-
client_secret: <your_client_secret>
-
scope: <your_scope_if_required>
-
Next Steps:
If you have confirmed that credentials are correct via Postman but the issue persists in Process Mining:
-
Check for proxy or firewall restrictions between Process Mining and Coupa.
-
Confirm that Coupa’s API URL and OAuth URLs are publicly accessible.
-
Engage with Coupa Support or your internal API admin for further analysis of failed token requests.