Skip to main content
AI agents are now live in Website Scanner! Enter your URL and fix website issues 3x faster with AI. Explore now!
No Result Found
Get your setup working faster. Join our Discord for optimisation tips from elite testers. Join our DiscordJoin our Discord

Cookie configurations

Use the Website Scanner REST API to create, retrieve, update, and delete cookie configurations for your website scans.

Cookie configurations let you attach cookies to scan requests so that pages behind consent gates or region selectors are scanned in the correct state. Create a configuration once and reference it by ID when you create a scan.

GET /api/v1/scanner/cookie_configs

Use this endpoint to retrieve all cookie configurations associated with your account.

Request parameters

Request

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
  https://api-scanner.browserstack.com/api/v1/scanner/cookie_configs
  • No parameter required.

Response attributes 200 application/json

Response

{
  "success": true,
  "data": {
    "cookieConfigs": [
      {
        "id": 24,
        "name": "consent_config_1",
        "domain": "example.com",
        "cookies": "consent=accepted; region=uk",
        "scanConfigCount": 3
      }
    ]
  },
  "error": null
}
  • success Boolean

    Indicates whether the request was successful.

  • data Object

    Contains the list of cookie configurations.

    â–¶ SHOW VALUES
    • cookieConfigs Array

      List of cookie configuration objects.

      â–¶ SHOW VALUES
      • id Integer

        The unique ID of the cookie configuration.

      • name String

        The name of the cookie configuration.

      • domain String

        The domain the cookies apply to. The apex domain covers all subdomains, including www.

      • cookies String

        Semicolon-separated name=value pairs representing the cookies.

      • scanConfigCount Integer

        The number of scan configurations currently using this cookie configuration.

POST /api/v1/scanner/cookie_configs

Use this endpoint to create a new cookie configuration. After creation, reference the configuration by its ID when you create a scan.

Request parameters

Request

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
  -X POST https://api-scanner.browserstack.com/api/v1/scanner/cookie_configs \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "consent_config_1",
    "domain": "example.com",
    "cookies": "consent=accepted; region=uk"
  }'
  • name* String

    A unique name for the cookie configuration. Maximum 255 characters.

  • domain* String

    The domain the cookies apply to, without a scheme or path (for example, example.com). The apex domain covers all subdomains, including www.

  • cookies* String

    Semicolon-separated name=value pairs (for example, consent=accepted; region=uk). Maximum 50 cookies per configuration, cookie name up to 255 characters, cookie value up to 4096 characters.

Response attributes 201 application/json

Response

{
  "success": true,
  "data": {
    "id": 24,
    "name": "consent_config_1",
    "domain": "example.com",
    "cookies": "consent=accepted; region=uk",
    "createdAt": "2026-10-09T10:00:00Z"
  },
  "error": null
}
  • success Boolean

    Indicates whether the request was successful.

  • data Object

    The created cookie configuration object.

    â–¶ SHOW VALUES
    • id Integer

      The unique ID of the cookie configuration.

    • name String

      The name of the cookie configuration.

    • domain String

      The domain the cookies apply to.

    • cookies String

      Semicolon-separated name=value pairs representing the cookies.

    • createdAt String

      The ISO 8601 timestamp when the cookie configuration was created.

Error responses 422

The API returns a 422 status code when validation fails. The following validation errors can occur:

  • Name is required
  • A cookie configuration named '<name>' already exists
  • Domain is required
  • '<domain>' is not a valid domain. Send the domain only, without https:// or a path
  • Cookies are required
  • Cookie '<entry>' must be in name=value format
  • Duplicate cookie name '<name>'
  • Cookie name '<name>' is longer than 255 characters
  • Cookie '<name>' has a value longer than 4096 characters
  • A configuration can hold at most 50 cookies
  • An account can hold at most 200 cookie configurations

PUT /api/v1/scanner/cookie_configs/{id}

Use this endpoint to update an existing cookie configuration. Only the fields you send are changed, so a cookie rotation can be a single-field request.

Request parameters

Request

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
  -X PUT https://api-scanner.browserstack.com/api/v1/scanner/cookie_configs/24 \
  -H 'Content-Type: application/json' \
  -d '{ "cookies": "consent=accepted-v2; region=uk" }'
  • id* Integer

    The unique ID of the cookie configuration to update.

  • name String

    A unique name for the cookie configuration. Maximum 255 characters.

  • domain String

    The domain the cookies apply to, without a scheme or path (for example, example.com). The apex domain covers all subdomains, including www.

  • cookies String

    Semicolon-separated name=value pairs (for example, consent=accepted; region=uk). Maximum 50 cookies per configuration, cookie name up to 255 characters, cookie value up to 4096 characters.

Response attributes 200 application/json

Response

{
  "success": true,
  "data": {
    "id": 24,
    "name": "consent_config_1",
    "domain": "example.com",
    "cookies": "consent=accepted-v2; region=uk",
    "createdAt": "2026-10-09T10:00:00Z"
  },
  "error": null
}
  • success Boolean

    Indicates whether the request was successful.

  • data Object

    The updated cookie configuration object.

    â–¶ SHOW VALUES
    • id Integer

      The unique ID of the cookie configuration.

    • name String

      The name of the cookie configuration.

    • domain String

      The domain the cookies apply to.

    • cookies String

      Semicolon-separated name=value pairs representing the cookies.

    • createdAt String

      The ISO 8601 timestamp when the cookie configuration was created.

Error responses 404

The API returns a 404 status code if the cookie configuration ID does not exist or belongs to another account.

Error responses 422

The API returns a 422 status code when validation fails. The following validation errors can occur:

  • A cookie configuration named '<name>' already exists
  • '<domain>' is not a valid domain. Send the domain only, without https:// or a path
  • Cookie '<entry>' must be in name=value format
  • Duplicate cookie name '<name>'
  • Cookie name '<name>' is longer than 255 characters
  • Cookie '<name>' has a value longer than 4096 characters
  • A configuration can hold at most 50 cookies

DELETE /api/v1/scanner/cookie_configs/{id}

Use this endpoint to delete a cookie configuration. Scans already using the configuration continue to run with the last known cookie values.

Request parameters

Request

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
  -X DELETE https://api-scanner.browserstack.com/api/v1/scanner/cookie_configs/24
  • id* Integer

    The unique ID of the cookie configuration to delete.

Response attributes 200 application/json

Response

{
  "success": true,
  "data": {
    "message": "Cookie configuration has been deleted"
  },
  "error": null
}
  • success Boolean

    Indicates whether the request was successful.

  • data Object

    Contains the deletion confirmation message.

    â–¶ SHOW VALUES
    • message String

      Confirmation message indicating the cookie configuration has been deleted.

Error responses 404

The API returns a 404 status code if the cookie configuration ID does not exist or belongs to another account.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Download Copy Check Circle