so because of that in other requests, API key shows null in the header.
and if I manually update the value it gives 403 forbidden.
Unable to understand why?
I found out why I was getting 403.
Somehow my token is not updating in the collection variable although its printing right value in the console.
What is the problem with my script?
On a side note and it shouldn’t make any difference but you are already declaring the “user_id” and “token” from the response, so why aren’t you using those variables when setting the collection variable?
On a final note, the recommendation when using confidential data like tokens, is to only use the current value. Therefore, I would define the token variable and set the initial value to null or something similar. Postman always uses the current value unless the current value is not set and it will then copy the initial value. Therefore I would recommend putting something obviously incorrect in the initial value.