Skip to main content
Version: v1

Custom cookies

Custom cookies usage via ScrapingAnt API. Where to get and how to pass them as a parameter.

Request

You can pass custom cookies to the target webpages. ScrapingAnt API only handles the name and value of custom cookies. If you want to set multiple cookies separate them with ;.

Cookies should be passed in the following format: cookie_name1=cookie_value1;cookie_name2=cookie_value2

If you are using GET, don't forget to urlencode cookies param, so for example above it will look like the following:

?url=...&cookies=cookie_name1%3Dcookie_value1%3Bcookie_name2%3Dcookie_value2

For POST request you can just pass the cookie string as is. For example:

{
"url": "...",
"cookies": "cookie_name1=cookie_value1;cookie_name2=cookie_value2"
}

Response

The cookies from the target website will be returned in the cookies response property with the same format, so you can just get cookies from the response and then reuse them in new requests.

{
"content": "...",
"cookies": "cookie_name_1=cookie_value_1;cookie_name_2=cookie_value_2"
}
tip

We're highly recommending chaining the scraping requests with a cookies.

For example: to grab the cookies from the main/landing page of the target site and then pass those cookies while scraping of other pages.