## Getting Cookies Back from Responses The responseCookies feature enables you to retrieve a list of cookies that were set during a request. This information is valuable for understanding website behavior, managing sessions, or replicating cookie settings in subsequent requests. ### Using responseCookies To enable this feature, set the responseCookies field to true in your request body. This will instruct the API to include a responseCookies field in the response, containing an array of objects representing the set cookies. **Example Request:** Below we will do a request using the [[requestCookies]] in combination with the responseCookies ```markdown POST https://api.proxyscrape.com/v3/accounts/freebies/scraperapi/request HTTP/1.1 Request headers: Content-Type: application/json X-Api-Key: <your api key> Request body: { "url": "https://www.example.com/", "browserHtml": true, "responseCookies": true, "requestCookies": [ { "name": "session_id", "value": "1234567890", "domain": "www.example.com", "path": "/", "httpOnly": true }, { "name": "preference", "value": "dark_mode", "domain": "www.example.com" } ] } ``` **Example Response (with responseCookies):** As you can se in the below result, the same cookies were returned in the responseCookies section. ``` { "success": true, "used_credits": 40, "remaining_credits": 1049430, "scrape_id": "37a0ba36-3e5d-4327-adee-dc764ff158cd", "data": { "url": "https://www.example.com/", "statusCode": 200, "browserHtml": "<!DOCTYPE html><html><head>\n <title>Example Domain</title>\n\n <meta charset=\"utf-8\">\n <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <style type=\"text/css\">\n body {\n background-color: #f0f0f2;\n margin: 0;\n padding: 0;\n font-family: -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n \n }\n div {\n width: 600px;\n margin: 5em auto;\n padding: 2em;\n background-color: #fdfdff;\n border-radius: 0.5em;\n box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);\n }\n a:link, a:visited {\n color: #38488f;\n text-decoration: none;\n }\n @media (max-width: 700px) {\n div {\n margin: 0 auto;\n width: auto;\n }\n }\n </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n <p>This domain is for use in illustrative examples in documents. You may use this\n domain in literature without prior coordination or asking for permission.</p>\n <p><a href=\"https://www.iana.org/domains/example\">More information...</a></p>\n</div>\n\n\n</body></html>", "responseCookies": [ { "name": "session_id", "value": "1234567890", "domain": "www.example.com", "path": "/", "expires": 1713726883, "httpOnly": true, "secure": false }, { "name": "preference", "value": "dark_mode", "domain": "www.example.com", "path": "/", "expires": 1713726883, "httpOnly": false, "secure": false } ] } } ``` The responseCookies array contains objects with the following properties: |Property|Required|Type|Description| |---|---|---|---| |name|Yes|string|The name of the cookie (max 256 characters).| |value|Yes|string|The value of the cookie (max 2100 characters).| |domain|Yes|string|The domain the cookie belongs to (max 500 characters).| |path|No|string|The path the cookie belongs to.| |expires|No|integer|Unix timestamp in seconds indicating the cookie's expiration.| |httpOnly|No|boolean|Whether the cookie is accessible only through HTTP requests.| |secure|No|boolean|Whether the cookie should only be transmitted over HTTPS.| |sameSite|No|string|The SameSite attribute of the cookie (Strict, Lax, Extended, None).| ### Interaction with requestCookies The information retrieved through responseCookies can be directly used to populate the [[requestCookies]] field in subsequent requests. This allows you to maintain session state or leverage specific cookie values for further interaction with the website.