# POST /ab-tests/:test_id/versions

**Resource:** [AB_TESTS](./ab-tests.md)  
**MCP tool:** `add_ab_test_version`  
**Scopes:** `ab-tests:write`  
**Write operation:** yes

Add a version to a draft A/B test. It gets the next free label (C, D ...). Running tests cannot gain versions: create a new test instead.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `test_id` | path | string | yes | The A/B test id. |
| `name` | body | string | yes | A short name a person will recognise, e.g. "Price up front". |
| `content` | body | object | no | What this version changes, read by the agent that uses the test. Use the keys the agent reads: "message" (an opening text or email body), "subject" (email subject), "offer" (the offer in words), "greeting" (a voice agent's first line), "instructions" (extra guidance for an AI agent). Example: { "message": "Hi {{contact.first_name}}, ...", "offer": "$129 a seat, free setup" }. For an automation or an Auto Sequence (subject_type automation or auto_queue) this happens on its own, on every email and text it sends to the lead: "subject" and "message" replace each step's own subject and body, and every value can be used in a step's wording as {{ab.<key>}} (e.g. {{ab.offer}}, and {{ab.version}} for the version's name). For a sequence with several emails, put per-step changes under "steps", keyed by the automation action id: { "steps": { "<action id>": { "subject": "...", "message": "..." } } }; these win over the top-level ones. Staff alerts and other fixed-address steps are never changed. Opens are counted for emails sent through TrustPager Email. |
| `weight` | body | number | no | Share of new leads, relative to the other versions. Default 1 (an even split). |
| `is_control` | body | boolean | no | Make this the control version (the one used when the test is not running). |
| `require_approval` | body | boolean | no | Optional. Set true to route this write into the approval queue for human review instead of executing it immediately (returns 202 + an approval_id). Works even when your key/token has permission to execute directly. |

## Request example

```bash
curl -X POST   "https://api.trustpager.com/functions/v1/api/v1/ab-tests/:test_id/versions"   -H "Authorization: Bearer YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"name":"...","content":"...","weight":"..."}'
```

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`