--- title: "CookieStore.AddCookies - Web Scraping API - Mozenda" slug: "cookiestoreaddcookies" description: "CookieStore.AddCookies adds one or more cookies to an existing store from JSON POST data. This comes in handy for web scraping projects that require two-factor authentication or CAPTCHA validation. " updated: 2024-05-14T14:25:23Z published: 2024-05-14T14:25:23Z canonical: "help.mozenda.com/cookiestoreaddcookies" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.mozenda.com/llms.txt > Use this file to discover all available pages before exploring further. # CookieStore.AddCookies ### Description Adds one or more **cookies** to an existing **cookie store** from valid *JSON POST* data. ### URL parameters URL parameter ordering The **URL parameters** below are listed in the order they should be entered in the API **URL**. | Name | Required | Type | Description | | --- | --- | --- | --- | | `CookieStoreID` | True | numeric | Unique identifier of the **cookie store**. | | `CookieStoreName` | True | string | The name of the **cookie store**. | ### Request body #### JSON Must be valid JSON with the following properties: | Name | Required | Type | Description | | --- | --- | --- | --- | | `Name` | True | string | The name of the **cookie**. | | `Domain` | True | string | The domain of the **cookie**. | | `Value` | False | string | The value of the **cookie**. | | `HttpOnly` | False | boolean | *True* to set the `HttpOnly` flag on the **cookie**. | | `Secure` | False | boolean | *True* to set the `Secure` flag on the **cookie**. | | `Path` | False | string | The **cookie** path. | ``` [ { "Name": "First cookie from JSON", "Domain": "www.mozenda.com", "Value": "First cookie value", "Secure": "True", "HttpOnly": "True", "Secure": "True" }, { "Name": "Second cookie from JSON", "Domain": "help.mozenda.com", "Value": "Second cookie value", "HttpOnly": "True", "Secure": "True" } ] ``` ### Responses | Name | Type | Description | | --- | --- | --- | | `Result` | string | `Success` if the operation was successful. | | `CookieStoreID` | numeric | Unique identifier for the **cookie store**. | | `NewCookieCount` | numeric | The number of **cookies set by the call**. | ### Sample request ``` curl -X POST 'https://api.mozenda.com/rest?WebServiceKey=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX&Service=Mozenda10&Operation=CookieStore.AddCookies&CookieStoreID=1001' \ -d '[{"Name":"First cookie from JSON","Domain":"lowes1.mozenda.com","Value":"First cookie value", "HttpOnly": "True"},{"Name":"Second cookie from JSON","Domain":"lowes2.mozenda.com","Value":"Second cookie value"}]' ``` ### Sample responses #### XML ``` Success 1006 2 ``` #### JSON (add `&ResponseFormat=JSON`) ``` { "CookieStoreID": 1001, "NewCookieCount": 2, "JsonResult": { "Command": "CookieStore.AddCookies", "AutoLoggedIn": false, "WebConsoleKey": "", "Result": "Success", "ErrorCode": "", "ErrorDescription": "", "ErrorList": [], "ExecutionTime": { "Ticks": 0, "Days": 0, "Hours": 0, "Milliseconds": 0, "Minutes": 0, "Seconds": 0, "TotalDays": 0, "TotalHours": 0, "TotalMilliseconds": 0, "TotalMinutes": 0, "TotalSeconds": 0 } } } ```