> ## Documentation Index
> Fetch the complete documentation index at: https://docs.winningvariant.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Winning Variant implements a small set of first order resources that can be managed via the Configuration API.

## Managing Resources

Resources are all managed within Snowflake via stored procedures within the Winning Variant Application.

[Read more here](/resources/manage)

## Resource Kinds

* **[Labs](/resources/labs) (Key: `lab`)**: Logical grouping of experiments. You can think of this as a workspace or even just as a folder containing experiments. Each experiment belongs to a lab.

* **[Subject Types](/resources/subjects) (Key: `subjecttype`)**: Used by experiments, these are types of identifiers that are assigned variants within an experiment. Subject types exist at the account level and can be used across all experiments within all labs. Each experiment must specify the subject type to use for assignments.

* **[Experiments](/resources/experiments) (Key: `experiment`)**: Any type of experiment you wish to run.

## YAML

### Schema

Each resource requires a top-level `schemaVersion`, a resource `kind`, and a `metadata` object. Subject types and experiments also require a `spec` section with details on the resource. For example:

```yaml theme={null}
schemaVersion: 1
kind: lab | subjecttype | experiment
metadata:
  <Metadata>
spec:
  <Spec>
```

### Metadata

When defining a resource in YAML, each must have a `metadata` section. The following properties within `metadata` are shared across all resource types:

| Key               | Data Type                           | Description                                                                                                                                                                                                   |
| ----------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`              | `string`                            | Unique identifier. Case insensitive and consist of alphanumeric characters, '-', '\_' or '.’ For example: `home-page-test`. IDs will be stored and displayed in UPPERCASE.                                    |
| `name`            | `string`                            | Name of the resource.                                                                                                                                                                                         |
| `description`     | `string`                            | Description of the resource.                                                                                                                                                                                  |
| `resourceVersion` | `int`                               | Modification version for a given resource. Incremented each time the resource is updated. This will be shown when retreiving a resource, but is ignored if provided as part of a resource update.             |
| `status`          | [`ResourceStatus`](#resourcestatus) | The status of the resource.                                                                                                                                                                                   |
| `parentKind`      | `lab`                               | The kind of resouce this one belongs to. Only applies to experiments, in which case the value is `lab`. Exclude for non experiments.                                                                          |
| `parentId`        | `string`                            | The ID of the resources parent. Only applies to experiments and the ID of its parent lab. Exclude for non experiments.<br /><br />If an experiment does not specified a `parentID`, it defaults to `DEFAULT`. |

#### `ResourceStatus`

Possible statuses include:

| Status            | Description                                                      | Resources  |
| ----------------- | ---------------------------------------------------------------- | ---------- |
| `draft`           | The experiment exists, but is not ready to go live.              | Experiment |
| `active`          | The experiment is live and making/tracking/returned assignments. | All        |
| `winner_declared` | A winner has been declared.                                      | Experiment |
| `ended`           | The experiment has ended. No assignments are made/returned.      | Experiment |
| `archived`        | The experiment has ended and is archived from view.              | All        |

### Spec

This is specific to the resource kind. View the pages for [Labs](/resources/labs), [Subjects](/resources/subjects), or [Experiments](/resources/experiments) for more info.

### Examples

<CodeGroup>
  ```yaml Lab theme={null}
  schemaVersion: 1
  kind: lab
  metadata:
    id: marketing
    resourceVersion: 1
    status: active
    name: Marketing
    description: All initiatives for the marketing org.
  ```

  ```yaml Subject Type theme={null}
  schemaVersion: 1
  kind: subjecttype
  metadata:
    id: anonymous-id
    resourceVersion: 2
    status: active
    name: Anonymous ID
    description: Public, anonymous ID for a user (such as the cookie ID).
  spec:
    ...
  ```

  ```yaml Experiment theme={null}
  schemaVersion: 1
  kind: experiment
  metadata:
    id: hero-nov-2024
    resourceVersion: 1
    status: draft
    name: Hero text test for November 2024
    description: Test variations of the hero on the website home page. Test launches in November 2024!
    parentKind: lab
    parentId: marketing
  spec:
    ...
  ```
</CodeGroup>
