---
title: "Create Experiment"
method: POST
path: "/ab-testing/spaces/{space_id}"
tags: ["ab-testing"]
---

# Create Experiment

`POST /ab-testing/spaces/{space_id}`

Create a new A/B experiment.

## Path parameters

- `space_id` string, uuid, required

## Request body

- ExperimentCreate
  - `name` string, required
  - `description` string, nullable
  - `agent_id` string, nullable
  - `variants` VariantConfig[], required
    - `id` string, required
    - `name` string, required
    - `weight` integer
    - `config` object
  - `traffic_percentage` integer
  - `success_metric` string

## Response `201`

Successful Response

- ExperimentResponse
  - `id` string, required
  - `space_id` string, required
  - `agent_id` string, nullable, required
  - `name` string, required
  - `description` string, nullable, required
  - `status` string, required
  - `variants` object[], required
  - `traffic_percentage` integer, required
  - `success_metric` string, required
  - `started_at` string, nullable, required
  - `ended_at` string, nullable, required
  - `created_at` string, required
  - `updated_at` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/meganova/apis/fastapi.md) · [All operations](https://skmtc.net/meganova/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/meganova/fastapi/revisions/2b2bab8b9017/schema)
