# Variant

URL: /business/nouns/variant · Id: `noun:variant`

> A Variant is one value an Experiment can assign, such as a revision, a Price on a sibling Offer, or a prompt, with its lineage.

A Variant is one value an [Experiment](/business/nouns/experiment) can assign, such as a revision, a [Price](/business/nouns/price) on a sibling [Offer](/business/nouns/offer), or a prompt, with its lineage.

## Properties
| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `key` | `string` | Yes | The name the Flag returns for it. |
| `value` | `json` | Yes | What it changes: copy, behavior, a definition Version, or a Thing. |
| `control` | `boolean` | No | True for the current definition every challenger is judged against. |
| `follows` | [Variant](/business/nouns/variant) | No | The Variant it was drafted from by a learn step. |

## Object
```json
{
  "$id": "https://api.sb/shiftnote.app/variants/variant_1",
  "$type": "Variant",
  "key": "Example key",
  "value": {},
  "control": true,
  "follows": "variant_1"
}
```

## Relationships
- <a id="rel-exposures"></a>A Variant **has** many [Exposures](/business/nouns/exposure): the Variant the [Flag](/business/nouns/flag) assigned to this unit. `exposures`, inverse [`meets`](/business/nouns/exposure#rel-meets).
- <a id="rel-offered-by"></a>A Variant **is offered by** one [Experiment](/business/nouns/experiment): the Variants the [Experiment](/business/nouns/experiment) can assign, the control among them. `offeredBy`, inverse [`offers`](/business/nouns/experiment#rel-offers).
- <a id="rel-scored-by"></a>A Variant **is scored by** many [Readouts](/business/nouns/readout): the Variant the number describes. `scoredBy`, inverse [`scores`](/business/nouns/readout#rel-scores).

## Verbs
| Verb | Description | Subject | Event | Class |
| --- | --- | --- | --- | --- |
| <a id="create"></a>[Variant.create](/business/nouns/variant/create) | Creates a Variant. Inherited from [Noun](/business/nouns/noun). | None. | `Variant.created` | Two-way: `try`, `send`, `do` |
| <a id="get"></a>[Variant.get](/business/nouns/variant/get) | Returns one Variant by id. Inherited from [Noun](/business/nouns/noun). | None. | None. | Read: `try`, `do` |
| <a id="list"></a>[Variant.list](/business/nouns/variant/list) | Returns Variants, newest first, one page at a time. Inherited from [Noun](/business/nouns/noun). | None. | None. | Read: `try`, `do` |
| <a id="update"></a>[Variant.update](/business/nouns/variant/update) | Changes the given properties of a Variant. Inherited from [Noun](/business/nouns/noun). | None. | `Variant.updated` | Two-way: `try`, `send`, `do` |
| <a id="delete"></a>[Variant.delete](/business/nouns/variant/delete) | Deletes a Variant; its history is kept. Inherited from [Noun](/business/nouns/noun). | None. | `Variant.deleted` | One-way: `send`, `do` |

## Permissions
Which Access level may call each Verb. One-way Verbs wait their delay window.

| Operation | `owner` | `admin` | `member` | `viewer` |
| --- | --- | --- | --- | --- |
| `Variant.create` | Yes | Yes | Yes | No |
| `Variant.get` | Yes | Yes | Yes | Yes |
| `Variant.list` | Yes | Yes | Yes | Yes |
| `Variant.update` | Yes | Yes | Yes | No |
| `Variant.delete` | Yes | Yes | Yes | No |

## Call it

**Ask**

```text
Add a variant to RouteWise.
```

**API**

```bash
curl -X POST https://api.sb/routewise.dev/variants \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"key":"Example key","value":{}}'
```

```json
{
  "api": "https://api.sb/routewise.dev",
  "variant": {
    "$id": "https://api.sb/routewise.dev/variants/variant_1",
    "$type": "Variant",
    "key": "Example key",
    "value": {}
  },
  "action": {
    "$id": "https://api.sb/routewise.dev/actions/action_1",
    "operation": "Variant.create",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/routewise.dev/actions/action_1"
  }
}
```

**SDK**

```ts
import { $ } from 'startup-builder'

const variant = await $.Variant.create({ key: 'Example key', value: {} })
```

**CLI**

```bash
npx startup-builder do Variant.create --json '{"key":"Example key","value":{}}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Variant.create({ key: 'Example key', value: {} })"
  }
}
```

## Example
A bakery tests two Variants of its pickup button behind one [Flag](/business/nouns/flag): the control reads `Pick up today`, and the challenger reads `Hold my loaf`. The challenger follows the control.