---
title: "Create a form A/B setup"
method: POST
path: "/form-ab-setups"
tags: ["Form A/B Setups"]
---

# Create a form A/B setup

`POST /form-ab-setups`

## Request

- Base URL: `https://api.omnisend.com/api`
- URL: `https://api.omnisend.com/api/form-ab-setups`
- Auth: one of:
  - OAuth 2
    - Client credentials
    - Token URL: `https://app.omnisend.com/oauth2/token` scopes: `forms.write`
  - API key in header `Authorization`

Create a draft form A/B setup from an existing popup, flyout or fullscreen form. Only those display types are eligible;
the source form becomes the setup's main form and its two variants start as identical copies that can be edited
independently afterward. The setup is created in draft status and does not serve traffic until started via
`POST /form-ab-setups/{abSetupID}/start`.

Each variant carries a traffic-distribution weight. When `versions` is omitted, both variants receive a weight
of 50; otherwise each weight must be at least 1 and the weights must sum to 100.

**Scopes:**
`forms.write`

**Rate Limiting:**
This endpoint is rate limited to 400 requests per minute.

## Headers

- `Omnisend-Version` string, required

## Request body

- CreateAbSetupRequest: Request to create a draft form A/B setup.
  - `formID` string, required: Main form unique identifier
  - `versions` CreateAbSetupVersion[]: Two competing form variants. When omitted, both variants use a weight of 50
    - `name` string: Variant form name
    - `weight` integer: Traffic distribution weight. Each weight must be at least 1 and both weights must sum to 100

## Response `201`

Created form A/B setup

- AbSetup: Form A/B setup resource.
  - `autoClose` AbSetupAutoClose: Auto-close policy for a form A/B setup.
    - `endsAt` string: Instant at which the test closes automatically. Must be in the future when the test is started.
    - `stopOnSignificance` boolean: Close the test as soon as one variant is a statistically significant winner.
  - `createdAt` string: A/B setup creation timestamp (read-only)
  - `enabledAt` string: A/B setup enable timestamp (read-only)
  - `id` string: A/B setup unique identifier (read-only)
  - `launchedAt` string: A/B setup launch timestamp (read-only)
  - `mainForm` AbSetupMainFormResponse: Main form of an A/B setup.
    - `formID` string: Form unique identifier (read-only)
    - `name` string: Form name
    - `status` 'enabled' | 'disabled' | 'draft': Form status.
  - `status` 'enabled' | 'draft' | 'disabled': A/B test status of a form. `disabled` is a launched A/B test that is currently paused.
  - `updatedAt` string: A/B setup last update timestamp (read-only)
  - `versions` AbSetupVersionResponse[]: Variant forms of the A/B setup
    - `formID` string: Form unique identifier (read-only)
    - `name` string: Form name
    - `weight` integer: Traffic distribution weight for the variant. Range: 0-100

## Other responses

- `400`: Request contains invalid or missing fields
- `401`: Authentication is missing or invalid
- `403`: Insufficient permissions for this operation
- `409`: Form already has an A/B setup
- `410`: API version has been retired
- `429`: Rate limit exceeded
- `500`: Unexpected error occurred

---

[API](https://skmtc.dev/omnisend/apis/forms-api.md) - [All operations](https://skmtc.dev/omnisend/apis/forms-api/llms.txt) - [OpenAPI document](https://skmtc.dev/omnisend/apis/forms-api/revisions/9b53556b2e97?raw)
