Environment Variable in HEADER

Im trying to use ang environment variable in the header of my POST request but I get this error. I already turned off SSL verification and Im not sure about the proxy settings. I tried putting the value directly into the field instead of using a variable for the request to work.

Hey @pjp.marikit, looks like the environment variable is not possibly an issue, and I can see that the variable is being resolved since it’s orange in color. Maybe the value is incorrect?

Can you check the outgoing request by opening Postman Console and debug the request to see what’s actually being called with what all parameters etc.

Let us know, what you find!

Hi @sivcan thanks for replying. The environment variable works fine because I can use it elsewhere except for the HEADER. If I hover on it, it shows me the value I set in the settings for that variable.

It is RED if I input an invalid environment variable.

Yes, that’s what I pointed out that it’s getting resolved and that’s fine. What I was suggesting is that you open the Postman console while sending the request, and see whether the request that you are sending is going correct or not.
It could be related to multiple things, the console will tell you exactly how the request is going.
As pointed in my previous reply, follow this link: https://learning.postman.com/docs/postman/sending-api-requests/debugging-and-logs/

On how to debug using the Postman console.

@sivcan The console helped me figure out the problem, a special character didnt show up on the variable preview which made me think I had the correct value. The console error made me investigate deeper, thanks!

Error: Invalid character in header content [“x-api-key”]
Warning: This request did not get sent completely and might not have all the required system headers

1 Like

Ahan, knew it!
Although might not show the special character, but still worth checking out: https://blog.postman.com/2020/03/26/how-postman-increases-the-visibility-of-invalid-whitespaces-and-newlines-in-your-api-requests/ !