Passing Cookies HTTP header to the API GET request

I’m testing the API sending direct API requests(without using the browser).

In order to authenticate, I have to add the http header Cookie value with LoginToken that changes at every request.

I tried to set a GlobalVariable.gl_Cookies with the cookie value, but not sure how I can pass this value to the Web service Request Object so that WS.verifyResponseStatusCode(response, 200) passes.

There is an option in Katalon to set the http header Cookie manually via the Object Repository, but I want this process to run automatically.

Is it possible in Katalon?

Hi Lily,

this article may be helpful for you -

Hi Marek,

Thank you for a prompt response,

Indeed this article was helpful. However, it seems that a single function which would have dealt with the cookie would have saved me the requirement to manually create an API request and its verification functions.
Is there any other alternative just for setting the http cookie header function?

Just to make sure - you have WS object in Object repository and you want to put there Cookies header dynamically on test run, right?

I currently have an Object similar to the SampleRequestObject from the article you sent so I can set the http cookie header dynamically, and wanted to use verifyResponseStatusCode() or verifyElementPropertyValue functions.

If you follow my article and you want to add a new header, just add a new line:

TestObjectProperty header4 = new TestObjectProperty("Cookie", ConditionType.EQUALS, "anyCookieHere")

Then, you can fire a request with Cookie in HTTP header.

1 Like

This is what I eventually did and it worked.
Thank you.

A way for a newby like me does this is that I
1. Login to my website with my credentials and get the cookie.
2. Create a Global variable for the cookie.
3. Create a Web Service Object.
4. Click the Variables tab and create a variable which is bound to the global variable, like so:
5. Click the Http Header tab and add a cookie under the Http Header tab, like so:



1 Like

It’s not working for me … :frowning:
Is there another way to pass cookies in get request ?
Tks :slight_smile:


The above process Which Kathy had suggested is working.

  1. 1st request get a cookie value
  2. Assign to a Global Variable(Cookie)
  3. In 2nd request. Create a local variable and refer to a Global Variable(Refer above Kathy image)
  4. In HTTP Header, select Authorization in value column select ${Cookie}


I have a problem the same.
Ex : When cookies: PHPSESSID: 121213123

How to enter the PHPSESSID cookie into katalon.?

Thank you.

Hi Kathy,

I have a scenario like same as you have but with slight deviation,
1.For login we have an api and for submit otp we have another api. After the submit OTP call, when the dashboard of the application launches, a cookie gets generated. How to fetch this cookie value and give in the header of the rest of API’s .
2.How to fetch this cookie value and store in the global variable and use for other API’s which are dependent to run with the cookie other wise it will fail.


Hi Marek,

I am stuck with the same scenario, I have WS object in object repository and want to pass the cookies header dynamically on test run. Can you please help me?

And also the link you shared in previous comment, when clicked on it shows me 404 page not found error.

Thanks, Sahithi.