Update Webform A/B Testing
Purpose
To update the configuration of an existing Webform A/B testing in your Zoho CRM organization.
Use this API to modify an A/B test that has already been created — for example, to rename the test, change the traffic split, revise the end criteria, update variant form design or fields, adjust the winner configuration, or transition the test to a different lifecycle state (such as pausing a running test or resuming a paused one).
Key terminology
- Original form — the existing webform on which the A/B test is running. Referenced by base_form in the request.
- Variant — a modified version of the original webform used for comparison. Configured under variant_form.
- Conversion rate — the percentage of visitors who submitted the webform.
- Winner — the webform with the highest conversion rate at the end of the test.
Endpoints
- PUT /settings/AB_testing/{AB_testing_ID}
Request Details
Request URL
{api-domain}/crm/{version}/settings/AB_testing/{AB_testing_ID}
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
Scope
ZohoCRM.settings.abtest.ALL
(or)
ZohoCRM.settings.abtest.UPDATE
Parameters
- modulestring, mandatory
Specify the module API name to which the A/B testing belongs. The module of an existing A/B test cannot be changed — the value supplied here must match the module the test was originally created for.
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v8/settings/AB_testing/4794410000000772294?module="Leads" "
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-X PUT
-d "@updatewebformabtesting.json"Input JSON keys
The request body must be a JSON object with the root key AB_testing, which is a JSON array containing a single A/B test configuration object with the following keys:
- namestring, mandatory
Specify the name of the Webform A/B test. The name must be unique within the module.
- trafficinteger, mandatory
Specify the overall percentage of visitors to be included in the Webform A/B test.
- notifyboolean, optional
Specify whether to receive an email notification with the A/B test winner once the test is completed.
- statusstring, mandatory
Specify the desired status of the A/B test after this update.
Supported values:
- drafted - A preliminary version of the A/B test that has been configured but not yet executed.
- running - The test is currently in progress. Use this value to start a drafted test, launch a scheduled test early, or resume a paused test.
- scheduled - The test is scheduled to start in the future, at the time specified in the condition object.
- paused - The test has been temporarily put on hold. Applicable only to tests that are currently running. While paused, the original webform is displayed to all visitors and metrics collected so far are preserved.
The lifecycle statuses completed and launched are returned by read APIs but cannot be set through this API. The paused status is accepted for updates but not when creating a test.
- dynamic_allocation_by_ziaboolean, optional
Specify whether traffic should be dynamically allocated across the base and variant forms based on form performance (powered by Zia). If enabled, during the test the system dynamically increases the visitor allocation in favour of better-performing variations.
- moduleJSON object, mandatory
Specify the CRM module to which the A/B test belongs. At least one of api_name or id must be specified. The module of an existing A/B test cannot be changed; the value supplied here must match the module the test was originally created for.
- idstring, optional
Specify the unique ID of the module.
- api_namestring, optional
Specify the API name of the module.
- base_formJSON object, mandatory
Specify the base webform used for the A/B test. The base webform (identified by id) of an existing A/B test cannot be changed; only its traffic allocation can be updated (subject to state restrictions).
- idstring, mandatory
Specify the unique ID of the base webform. Must match the base form the test was originally created with.
- trafficinteger, optional
Specify the percentage of traffic allocated to the base form.
- conditionJSON object, mandatory
Specify how the A/B test duration is determined. The type key inside this object controls which additional fields must be provided. For scheduled tests, updating this object is how you change the planned start and end date-times.
- typestring, mandatory
Specify how the test duration is determined.
Supported values:
- duration – Run the A/B test for a fixed duration. Requires period and unit.
- range – Run the A/B test between specific start and end date-times. Requires from and to.
- visits – Run the A/B test until a specified number of visitors is reached. Requires unit.
- periodstring, optional
Specify the unit of time when type is duration.
Supported values:
- days – Maximum unit value is 90.
- weeks – Maximum unit value is 12.
- months – Maximum unit value is 3.
- unitinteger, optional
When type is duration, specify the number of periods for which the test should run. When type is visits, specify the total number of visitors after which the test ends (maximum 100000).
- fromdatetime, optional
Specify the start date and time of the A/B test in ISO 8601 format. Applicable when type is range. Can be updated for tests in scheduled state.
- todatetime, optional
Specify the end date and time of the A/B test in ISO 8601 format. Applicable when type is range. Can be updated for tests in scheduled state.
- variant_formJSON array, mandatory
Specify the variant webforms used in this A/B test. A maximum of 2 variant objects can be provided. Variants can only be modified while the test is in drafted or scheduled state.
- trafficinteger, mandatory
Specify the percentage of traffic allocated to this variant form.
- form_attributesJSON object, optional
Specify the visual and layout attributes of this variant webform.
- colorstring, optional
Specify the background color of the variant form.
- widthinteger, optional
Specify the width of the variant form in pixels. Supported values: 600, 700, 800, 900.
- display_form_nameboolean, optional
Specify whether the form name should be displayed on the variant webform.
- alignstring, optional
Specify the alignment of the form on the web page.
- font_attributesJSON object, optional
Specify the font styling applied to the variant form.
- sizeinteger, optional
Specify the font size used in the form.
- colorstring, optional
Specify the font color used in the form.
- familystring, optional
Specify the font family used in the form.
- button_attributesJSON array, mandatory
Specify the properties of the action buttons displayed in the variant form.
- namestring, mandatory
Specify the label displayed on the button.
- colorstring, optional
Specify the color of the button.
- form_fieldsJSON array, mandatory
Specify the fields configured for this variant webform. Each object in the array represents one field and defines how it is displayed, validated, and mapped to a CRM field.
- typestring, mandatory
Specify the category of the form field.
Supported values:
- general – Standard CRM fields (for example, Name, Email, Company).
- advanced – Special fields such as file upload, captcha, or privacy policy. Advanced fields use the field_info object to describe their metadata.
- portal – Portal-related fields such as Password and Confirm Password.
- helpJSON object, optional
Specify the help information shown to users while filling the form.
- textstring, mandatory
Specify the help text to be displayed near the field. Mandatory if the help key is specified.
- urlstring, optional
Specify an optional link for additional information.
- fieldJSON object, mandatory
Specify the CRM field to which this webform field is mapped. Used for fields of type general and portal.
- api_namestring, optional
Specify the API name of the CRM field.
- field_labelstring, optional
Specify the label displayed on the webform.
- idstring, optional
Specify the unique ID of the CRM field.
- field_infoJSON object, optional
Specify metadata for advanced fields such as file upload, captcha, or privacy policy fields. This object is used instead of field when type is advanced.
- hiddenboolean, optional
Specify whether the field is hidden from users.
Supported values:
- true – Field is hidden.
- false – Field is visible.
- default_valuestring, optional
Specify the default value for a hidden field.
- date_formatstring, optional
Specify the date format for date-type fields (for example, DD/MM/YYYY).
- requiredboolean, optional
Specify whether the field is mandatory for form submission.
Supported values:
- true – Field must be filled.
- false – Field is optional.
- display_labelstring, optional
Specify a custom label to display on the webform instead of the default CRM field label.
- winner_configurationJSON object, optional
Specify how the winning webform should be announced and launched. The webform with the highest conversion rate is considered the winner of the A/B test.
- announce_automaticallyboolean, optional
Specify whether the winner should be automatically launched (used across all locations of the original form) once the test is completed.
- conversion_percentage_differenceinteger, optional
Specify the minimum conversion rate (as a percentage) that a variant must achieve before it is eligible to be launched automatically.
Notes
- Only one A/B test can be in the running state at a time within a module.
- Updating an A/B test does not reset any collected metrics (visits, submissions, conversions).
- Pausing a running test stops serving variants to visitors; the original webform is shown to all traffic until the test is resumed.
- Once the test reaches completed or launched, the configuration is frozen and cannot be updated through this API.
- The webform with the highest conversion rate is considered the winner. If multiple webforms have the same conversion rate, the winner is decided using this tie-breaker order:
- Minimum abandonment rate
- Highest complete submission rate
- Original form
- A/B testing is supported only for webforms hosted using the Embed or iFrame format. For Zoho Sites CRM forms, only manual embed is supported (not element-embedded forms).
Traffic allocation
The request accepts three traffic-related values:
- traffic at the root of the A/B test object – The overall percentage of visitors included in the test.
- base_form.traffic – The percentage of test traffic sent to the base webform.
- variant_form[].traffic – The percentage of test traffic sent to each variant webform.
Rules:
- The sum of base_form.traffic and all variant_form[].traffic values must equal 100.
- The minimum value for any individual traffic allocation is 5.
What can be updated
- name, notify, dynamic_allocation_by_zia: can be updated in all editable states.
- traffic, base_form.traffic, variant_form[].traffic: traffic split can be updated as long as the test has not yet started or is in an editable state (see the "State-based restrictions" section below).
- condition: end criteria (duration, range, or visits) can be updated for tests that are in drafted or scheduled state. For a scheduled test, this includes changing the start and end date-times (the from and to values inside a range condition).
- variant_form: variant form design, buttons, and fields can be updated only in drafted or scheduled state.
- status: can be transitioned between the supported states as described below.
- winner_configuration: can be updated before the test is completed.
What cannot be updated
- module: the module of an existing A/B test is immutable. The value in the request must match the module the test was created for.
- base_form.id: the base (original) webform of the A/B test cannot be changed after creation. Only base_form.traffic may be updated (subject to state restrictions).
- Once an A/B test is in the running, completed, or launched state, its condition and variant_form configuration cannot be edited.
Other webform state wise update restrictions
- drafted: all fields (except module and base_form.id) can be updated.
- scheduled: all fields (except module and base_form.id) can be updated, including the scheduled start and end date-times.
- running: only name, notify, winner_configuration, and status transitions to paused are allowed. Variants, base form traffic split, and end criteria cannot be edited while the test is running. Metrics collected so far are preserved and are not reset by an update.
- paused: the same edit restrictions as running apply. The test can be resumed by updating status back to running. Existing metrics are preserved on resume.
- completed, launched: the test configuration cannot be updated. Only winner_configuration related actions (where applicable) are supported before the winner is launched.
Metrics are never reset by an update: updating an A/B test does not clear conversion, submission, or visitor counts collected up to that point.
Sample Input
Copied{
"AB_testing": [
{
"name": "newtestab",
"traffic": 100,
"notify": false,
"status": "running",
"dynamic_allocation_by_zia": false,
"module": {
"api_name": "Leads",
"id": "4794410000000000125"
},
"base_form": {
"id": "4794410000000765145",
"traffic": 34
},
"condition": {
"type": "duration",
"period": "days",
"unit": 30
},
"variant_form": [
{
"traffic": 33,
"form_attributes": {
"color": "white",
"width": 600,
"display_form_name": true,
"align": "left",
"font_attributes": {
"size": 12,
"color": "black",
"family": "Arial"
}
},
"button_attributes": [
{
"name": "Submit",
"color": "#fff"
},
{
"name": "Reset",
"color": "#fff"
}
],
"form_fields": [
{
"type": "general",
"hidden": false,
"required": true,
"field": {
"api_name": "Company",
"field_label": "Company",
"id": "4794410000000000555"
}
},
{
"type": "general",
"hidden": false,
"required": true,
"field": {
"api_name": "Last_Name",
"field_label": "Last Name",
"id": "4794410000000000559"
}
},
{
"type": "general",
"hidden": false,
"required": false,
"date_format": "DD/MM/YYYY",
"field": {
"api_name": "Date_1",
"field_label": "Date 1",
"id": "4794410000000755001"
}
},
{
"type": "advanced",
"hidden": false,
"required": false,
"field_info": {
"type": "file_upload",
"field_label": "Upload a File"
}
},
{
"type": "advanced",
"hidden": false,
"required": false,
"field_info": {
"type": "privacy_policy",
"field_label": "Privacy Policy",
"privacy_value": "I agree to the Privacy Policy and Terms of Service"
}
}
]
},
{
"traffic": 33,
"form_attributes": {
"color": "white",
"width": 600,
"display_form_name": true,
"align": "left",
"font_attributes": {
"size": 12,
"color": "black",
"family": "Arial"
}
},
"button_attributes": [
{
"name": "Submit",
"color": "#fff"
},
{
"name": "Reset",
"color": "#fff"
}
],
"form_fields": [
{
"type": "general",
"hidden": false,
"required": true,
"field": {
"api_name": "Company",
"field_label": "Company",
"id": "4794410000000000555"
}
},
{
"type": "general",
"hidden": false,
"required": true,
"field": {
"api_name": "Last_Name",
"field_label": "Last Name",
"id": "4794410000000000559"
}
},
{
"type": "general",
"hidden": true,
"required": false,
"default_value": "hidden",
"field": {
"api_name": "Single_Line_1",
"field_label": "Single Line 1",
"id": "4794410000000755018"
}
},
{
"type": "advanced",
"hidden": false,
"required": false,
"field_info": {
"type": "standard_captcha",
"field_label": "Enter the Captcha"
}
}
]
}
],
"winner_configuration": {
"announce_automatically": false
}
}
]
}Possible Errors
- INVALID_DATAHTTP 400
Invalid data type or structure for the AB_testing request body.
Resolution: Ensure the request body follows the correct JSON array format and maximum length constraints. - PATTERN_NOT_MATCHEDHTTP 400
The value provided does not match the expected pattern (for example, an invalid A/B test name).
Resolution: Verify that the field values follow the supported pattern and constraints. - DUPLICATE_DATAHTTP 400
Another A/B test with the same name already exists in the module.
Resolution: Use a unique name for the A/B test. - INVALID_DATAHTTP 400
Traffic percentage is outside the allowed range.
Resolution: Ensure each individual traffic value is at least 5, and that base_form.traffic plus all variant_form[].traffic values sum to 100. - INVALID_DATAHTTP 400
Invalid base Webform ID provided, or the base form ID does not match the base form the test was originally created with.
Resolution: Specify the same base base_form.id the test was created with. The base form of an existing A/B test cannot be changed. - INVALID_DATAHTTP 400
Attempt to change the module of an existing A/B test.
Resolution: The module of an existing A/B test cannot be updated. Supply the module (both in the query parameter and in the request body) that the test was originally created for. - INVALID_DATAHTTP 400
Duration exceeds the allowed limit for the selected period.
Resolution:- Days must be ≤ 90
- Weeks must be ≤ 12
- Months must be ≤ 3
- INVALID_DATAHTTP 400
Visitor limit exceeds the maximum allowed value (100000).
Resolution: Specify a visitor count less than or equal to 100000. - INVALID_DATAHTTP 400
Invalid field ID provided for a variant form field.
Resolution: Ensure that all field IDs belong to the specified module and Webform. - INVALID_DATAHTTP 400
Invalid status transition (for example, attempting to set status to paused for a test that is not currently running, or trying to move a completed/launched test back to running).
Resolution: Use a status transition supported for the test's current state (see the "State-based restrictions" section). - NOT_ALLOWEDHTTP 400
Attempt to edit fields (such as condition, variant_form, or traffic split) that cannot be modified in the test's current state (for example, while the test is running, paused, completed, or launched).
Resolution: Only update fields that are editable in the current state, or move the test to drafted/scheduled where applicable before making structural changes. - INVALID_DATAHTTP 400
Invalid start/end date-time for a scheduled test (for example, from in the past, or to earlier than from).
Resolution: Ensure from is in the future and to is later than from, and that both are valid ISO 8601 date-time values. - REQUIRED_PARAM_MISSINGHTTP 400
Required parameter module is missing.
Resolution: Specify the module query parameter with a valid module API name. - INVALID_URL_PATTERNHTTP 404
The requested URL is invalid, or the {AB_testing_ID} in the URL does not exist.
Resolution: Verify the URL path and ensure the A/B test ID is correct. - OAUTH_SCOPE_MISMATCHHTTP 401
The access token used does not have the required scope.
Resolution: Use a token with ZohoCRM.settings.abtest.UPDATE or ZohoCRM.settings.abtest.ALL scope.
Sample Response
Copied{
"AB_testing": [
{
"code": "SUCCESS",
"details": {
"id": "4794410000000772294"
},
"message": "ABTesting details updated successfully",
"status": "success"
}
]
}