DHL Rest Connector Error

I have created a rest connector for DHL. I was able to get the token correctly. But when trying to execute a post call. The below error occurs. I am passing the token to the Authorization in the format Bearer format

Hi,

Are you sure you pass the token correctly? Next step would be to look in att the REST connector log file to make sure you have the correct header as described in the DHL API Doc . If that doesn’t give any clues I always setup the same request(s) in Postman, it’s just easier there to troubleshoot.

Hi Albin,

I have tried this request in postman and it worked. Please find the log attached below

StatusCode: 401, ReasonPhrase: ‘Unauthorized’, Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Connection: keep-alive
Correlation-Id: a659d714-e497-4d45-bf3f-f924a328815a
Access-Control-Allow-Origin: https://developer.dhl.com/
Vary: Origin
Access-Control-Allow-Methods: GET,OPTIONS
Access-Control-Max-Age: 7200
Access-Control-Allow-Headers: Accept-Encoding,Accept-Language,Accept,Authorization,Cache-Control,Content-Language,Content-Length,Content-Type,Correlation-Id,DHL-API-Key,Expires,Host,Last-Modified,Origin,Pragma,Referer,User-Agent,X-Forwarded-For,X-Forwarded-Port,X-Forwarded-Proto,X-Requested-With
Access-Control-Expose-Headers: Cache-Control,Content-Encoding,Content-Language,Content-Length,Content-Security-Policy,Content-Type,Correlation-Id,Expires,Last-Modified,Permissions-Policy,Pragma,Referrer-Policy,Strict-Transport-Security,Vary,X-Content-Type-Options,X-DNS-Prefetch-Control,X-Frame-Options,X-XSS-Protection
X-XSS-Protection: 1; mode=block
Content-Security-Policy: default-src ‘self’; script-src ‘self’
X-Content-Type-Options: nosniff
Cache-Control: must-revalidate, no-cache, private
Date: Wed, 19 Nov 2025 15:17:05 GMT
Content-Length: 87
Content-Language: en
Content-Type: application/problem+json
Expires: Sun, 19 Nov 1978 05:00:00 GMT
}
Content:
{“status”:401,“title”:“Unauthorized”,“detail”:“Access to the resource is not allowed.”}

Great!

Could you also share the Request? And it would be helpful to see the Postman request that works as well. :slight_smile:

{

"profile": "STANDARD_GRUPPENPROFIL",

"shipments": \[

    {

        "product": "V01PAK",

        "billingNumber": "50293431450101",

        "refNo": "Order No. 1234",

        "shipper": {

            "name1": "My Online Shop GmbH",

            "addressStreet": "Sträßchensweg 10",

            "postalCode": "53113",

            "city": "Bonn",

            "country": "DEU",

            "email": "max@mustermann.de",

            "phone": "+49 123456789"

        },

        "consignee": {

            "name1": "Maria Musterfrau",

            "addressStreet": "Kurt-Schumacher-Str. 20",

            "postalCode": "53113",

            "city": "Bonn",

            "country": "DEU",

            "email": "maria@musterfrau.de",

            "phone": "+49 987654321"

        },

        "details": {

            "dim": {

                "uom": "mm",

                "height": 100,

                "length": 200,

                "width": 150

            },

            "weight": {

                "uom": "g",

                "value": 500

            }

        }

    }

\]

}

The Rest connector can produce two files per Request. One for Request and one for the Response. Can you post the content of the Request log file? That should also include headers etc.

Hi Albin,

below is the request

Method: POST, RequestUri: ‘https://api-eu.dhl.com/parcel/de/de/shipping/v2/orders’, Version: 1.1, Content: System.Net.Http.StringContent, Headers:
{
Authorization:
DHL-API-Key: mEn3zl8ANQ0J25RnIAufwaCelAgPeAn8
Content-Type: application/json; charset=utf-8
Content-Length: 517
}

Content:
{“profile”:“STANDARD_GRUPPENPROFIL”,“shipments”:[{“product”:“V01PAK”,“billingNumber”:“50293431450101”,“refNo”:“Order No. 1234”,“shipper”:{“name1”:“test”,“addressStreet”:“Sträßchensweg 10",“postalCode”:“53113”,“city”:“Bonn”,“country”:“DEU”,“email”:“max@mustermann.de”,“phone”:“+49 123456789”},“consignee”:{“name1”:“test”,“addressStreet”:“Kurt-Schumacher-Str. 20”,“postalCode”:“53113”,“city”:“Bonn”,“country”:“DEU”,“email”:"maria@musterfrau.de”,“phone”:“+49 987654321”},“details”:{“weight”:{“uom”:“g”,“value”:500}}}]}

Thx. I suspect you don’t have the same values for the Authorization header in Postman and Flow. Is it in factt empty?

And why are you using both an Authorization header and the custom “DHL-API-Key” header with an API key?

I would open the Console in Postman to see the RAW request and compare it to what’s printed in the Flow log. And make sure that you have the same Token for auth in Flow as you do in Postman.

And if you have in fact posted an API key here, I suggest you create new one since it’s kind of compromised :slight_smile:

Hi Albin,

I tried without that 1st but had the same error.

Method: POST, RequestUri: ‘https://api-eu.dhl.com/parcel/de/de/shipping/v2/orders’, Version: 1.1, Content: System.Net.Http.StringContent, Headers:
{
Authorization:
Content-Type: application/json; charset=utf-8
Content-Length: 517
}

Content:
{“profile”:“STANDARD_GRUPPENPROFIL”,“shipments”:[{“product”:“V01PAK”,“billingNumber”:“50293431450101”,“refNo”:“Order No. 1234”,“shipper”:{“name1”:“test”,“addressStreet”:“Sträßchensweg 10",“postalCode”:“53113”,“city”:“Bonn”,“country”:“DEU”,“email”:“max@mustermann.de”,“phone”:“+49 123456789”},“consignee”:{“name1”:“test”,“addressStreet”:“Kurt-Schumacher-Str. 20”,“postalCode”:“53113”,“city”:“Bonn”,“country”:“DEU”,“email”:"maria@musterfrau.de”,“phone”:“+49 987654321”},“details”:{“weight”:{“uom”:“g”,“value”:500}}}]}

StatusCode: 401, ReasonPhrase: ‘Unauthorized’, Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Connection: keep-alive
Correlation-Id: 6783f658-69a6-4f93-8db0-203bd29dc5e1
Access-Control-Allow-Origin: https://developer.dhl.com/
Vary: Origin
Access-Control-Allow-Methods: GET,OPTIONS
Access-Control-Max-Age: 7200
Access-Control-Allow-Headers: Accept-Encoding,Accept-Language,Accept,Authorization,Cache-Control,Content-Language,Content-Length,Content-Type,Correlation-Id,DHL-API-Key,Expires,Host,Last-Modified,Origin,Pragma,Referer,User-Agent,X-Forwarded-For,X-Forwarded-Port,X-Forwarded-Proto,X-Requested-With
Access-Control-Expose-Headers: Cache-Control,Content-Encoding,Content-Language,Content-Length,Content-Security-Policy,Content-Type,Correlation-Id,Expires,Last-Modified,Permissions-Policy,Pragma,Referrer-Policy,Strict-Transport-Security,Vary,X-Content-Type-Options,X-DNS-Prefetch-Control,X-Frame-Options,X-XSS-Protection
X-XSS-Protection: 1; mode=block
Content-Security-Policy: default-src ‘self’; script-src ‘self’
X-Content-Type-Options: nosniff
Cache-Control: must-revalidate, no-cache, private
Date: Thu, 20 Nov 2025 08:49:49 GMT
Content-Length: 87
Content-Language: en
Content-Type: application/problem+json
Expires: Sun, 19 Nov 1978 05:00:00 GMT
}
Content:
{“status”:401,“title”:“Unauthorized”,“detail”:“Access to the resource is not allowed.”}

Hi Albin,

Below is the request from console

Hi @Alluse I was able to find the issue, it was somethign wrong with the path in the post call. it had more character before. Thanks a lot for the support on investigation

Ohh yeah, I see it now. Good catch, great that you solved it! Bit confusing with the response there, should have said “Resource not found” or something :slight_smile: