DHL API access not possible

Hi,
we have the starter account to test workflows with n8n.
We want to automate our shipping process. So we need to get the data about DHL API access. I have tried to enter the credentials but an error message came up. Is it possible that this function only works with the enterprise version?
Or is there any chance to load the DHL data into n8n?

According to the DHL API Documentation it looks like you would need to use a “client credentials” style generic Oauth2 credential to set n8n up to fetch an access token for you. I don’t have a DHL account, so I’m partially guessing here, but nothing looks unusual, so there’s a good chance this will work. Once you have the Credential item created, use it in an HTTP Request node on one of the DHL API endpoints.

  • Note: There’s an alternative authentication endpoint → https://api.dhlecs.com/auth/v4/accesstoken that you might need to use instead of the one linked above (and shown in the screenshot below). DHL seems to have different API systems depending on the client/account/task/???.

Create an Oauth2 API credential type.

Fill in values like this:

Thank you very much!
Client ID is the API KEy?
And Client Secret the API Secret KEy?
And the Access Token Url is the URL in your screenshot?

Try and see. It helps when the documentation matches up on what everything is called, but sometimes it doesn’t. Again, I don’t have a DHL account so I don’t have a way to verify what should/shouldn’t work.

Just curious (because of the difference in parameter names)…
Did you register a DHL developer account?
And create an app?

Just curious (because of the difference in parameter names)…
Did you register a DHL developer account?
And create an app?

yes both

According to this article on setting up API authentication on Postman, it should work to use the n8n Basic Auth credential type and fill in your API Key and API Secret (from the App details in the DHL API Developer Portal) for User and Password respectively.

I set up a developer account to play around with this (just curiosity to see if I could find a way to make it work).

So far nothing has worked though (various 401 errors).

I also hit a few other issues that you might encounter, so maybe some of this will help…

  • It is EXTREMELY UNCLEAR which DHL APIs must be enabled on the account/app (their documentation is awful). Even if you get the authentication working, you have that puzzle waiting for you.
  • I could find no place in the API Developer Portal or docs where ‘Client ID, and Client Secret’ are mentioned, so I’m not entirely sure where/how they support Oauth2. The existence of the “get token” endpoints would suggest they do support it, but they’re certainly not making it easy to figure out.
  • The response Content-type header on a 401 response from their token endpoints is application/problem+json, which n8n doesn’t understand, and masks the actual problem with a different error message: Unsupported content type: application/problem+json (I ran the request through mitmproxy to see what was happening, and it was actually a 401 - Unauthorized response. The only additional info said something about it being an “Invalid Client” (which sounded like a client software type restriction, but adding a “fake” User-Agent header didn’t help).
    • BTW, if you want to set up mitmproxy (which is a free alternative to something like CharlesProxy) to snoop requests from n8n (self hosted n8n), here’s a link to instructions for that.

1 Like