Create Variant.

POST /api/teams/{team}/experiments/{experiment}/variants

Path parameters

  • team integer Required

    The ID of the team that the variant belongs to.

  • experiment string Required

    The experiment key that the variants belong to.

application/json

Body Required

  • key string Required

    The key to use for the variant. Must match the regex /[a-z0-9]+(?:_[a-z0-9]+)*$/i. Must not be greater than 255 characters.

  • control boolean

    Whether the variant is the control.

  • The description of the variant.

  • traffic string

    The amount of traffic the variant should receive. This is only needed if the experiment is using Weighted Variants. Must be at least 0 characters. Must not be greater than 100 characters.

Responses

POST /api/teams/{team}/experiments/{experiment}/variants
curl \
 -X POST https://checkmango.com/api/teams/19/experiments/autem/variants \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"key":"VARIANT_A","control":true,"description":"Fugiat expedita quisquam error qui iure ut.","traffic":50}'
Request example
{
  "key": "VARIANT_A",
  "control": true,
  "description": "Fugiat expedita quisquam error qui iure ut.",
  "traffic": 50
}
Response examples (200)
{
  "data": {
    "id": "ADIPISCI_EST_ODIT",
    "type": "variants",
    "attributes": {
      "id": 4,
      "team_id": 28,
      "key": "ADIPISCI_EST_ODIT",
      "control": false,
      "description": "Voluptatem nemo temporibus quidem incidunt. Nihil dolorum consequuntur ipsa. Et natus aut non.",
      "created": {
        "human": "1 second ago",
        "string": "2024-04-08 10:42:02"
      },
      "updated": {
        "human": "1 second ago",
        "string": "2024-04-08 10:42:02"
      }
    },
    "links": {
      "self": {
        "href": "http://checkmango.com/api/teams/28/experiments/SINT_IPSAM_VELIT_EXPEDITA_EST/variants/ADIPISCI_EST_ODIT"
      }
    }
  }
}
Response examples (402)
{
  "message": "Subscription required."
}
Response examples (403)
{
  "message": "Unauthenticated."
}
Response examples (404)
{
  "message": "Not Found"
}
Response examples (422)
{
  "message": "The given data was invalid.",
  "errors": {
    "key": [
      "The key has already been taken."
    ]
  }
}