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

# Keep a path of an A/B test

> Ends the A/B test by hand: every new lead gets the path from now on, and once nobody is left on another path the sequence keeps only its steps. Keeping the path already kept changes nothing; keeping another one once the test is decided answers 409.

## OpenAPI

```json
{
  "openapi": "3.2.0",
  "info": {
    "title": "Bavlio API",
    "version": "1.0.0"
  },
  "paths": {
    "/campaigns/{id}/sequence/ab-tests/{test_id}/winner": {
      "post": {
        "tags": [
          "Sequences"
        ],
        "operationId": "sequences.pickAbTestWinner",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string",
              "description": "Campaign id."
            },
            "required": true
          },
          {
            "name": "test_id",
            "in": "path",
            "schema": {
              "type": "string",
              "description": "Bavlio's id of the A/B test."
            },
            "required": true
          }
        ],
        "security": [
          {
            "bearer": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign_id": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991,
                      "description": "Version number; each save adds one."
                    },
                    "steps": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Union_"
                      },
                      "description": "The steps, in the order they run."
                    },
                    "stats": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "reached": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991,
                            "allOf": [
                              {
                                "minimum": 0
                              }
                            ]
                          },
                          "converted": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991,
                            "allOf": [
                              {
                                "minimum": 0
                              }
                            ]
                          }
                        },
                        "required": [
                          "reached",
                          "converted"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Per step id: leads that reached the step (reached) and those who accepted, replied or booked a meeting at it (converted)."
                    },
                    "warnings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "step_id": {
                            "type": "string",
                            "description": "The step whose text the warning is about."
                          },
                          "field": {
                            "type": "string",
                            "enum": [
                              "note",
                              "subject",
                              "body"
                            ],
                            "description": "Which text of the step: note, subject or body."
                          },
                          "message": {
                            "type": "string",
                            "description": "What to change, in plain words."
                          }
                        },
                        "required": [
                          "step_id",
                          "field",
                          "message"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Template problems that did not stop the save, such as a custom field no upload to the campaign has; empty when there are none."
                    },
                    "ab_tests": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Bavlio's id of the A/B test."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "waiting",
                              "running",
                              "decided",
                              "applied"
                            ],
                            "description": "waiting until the first lead enters, running, decided once a path is kept, applied once the sequence keeps only that path."
                          },
                          "goal": {
                            "type": "string",
                            "enum": [
                              "replied",
                              "positive_reply",
                              "meeting"
                            ],
                            "description": "What counts as a win."
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "shape",
                              "message",
                              "wording",
                              "timing"
                            ],
                            "description": "What the paths change: shape, message, wording or timing."
                          },
                          "changes": {
                            "type": "array",
                            "items": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "dimension": {
                                      "type": "string",
                                      "enum": [
                                        "invite_note"
                                      ]
                                    },
                                    "values": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "path": {
                                            "type": "string",
                                            "enum": [
                                              "a",
                                              "b",
                                              "c",
                                              "d"
                                            ]
                                          },
                                          "value": {
                                            "type": "string",
                                            "enum": [
                                              "with_note",
                                              "without_note",
                                              "no_invite"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "path",
                                          "value"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "description": "The value on each path."
                                    }
                                  },
                                  "required": [
                                    "dimension",
                                    "values"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "dimension": {
                                      "type": "string",
                                      "enum": [
                                        "follow_ups"
                                      ]
                                    },
                                    "values": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "path": {
                                            "type": "string",
                                            "enum": [
                                              "a",
                                              "b",
                                              "c",
                                              "d"
                                            ]
                                          },
                                          "value": {
                                            "type": "integer",
                                            "minimum": -9007199254740991,
                                            "maximum": 9007199254740991,
                                            "allOf": [
                                              {
                                                "minimum": 0
                                              }
                                            ]
                                          }
                                        },
                                        "required": [
                                          "path",
                                          "value"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "description": "The value on each path."
                                    }
                                  },
                                  "required": [
                                    "dimension",
                                    "values"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "dimension": {
                                      "type": "string",
                                      "enum": [
                                        "emails"
                                      ]
                                    },
                                    "values": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "path": {
                                            "type": "string",
                                            "enum": [
                                              "a",
                                              "b",
                                              "c",
                                              "d"
                                            ]
                                          },
                                          "value": {
                                            "type": "integer",
                                            "minimum": -9007199254740991,
                                            "maximum": 9007199254740991,
                                            "allOf": [
                                              {
                                                "minimum": 0
                                              }
                                            ]
                                          }
                                        },
                                        "required": [
                                          "path",
                                          "value"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "description": "The value on each path."
                                    }
                                  },
                                  "required": [
                                    "dimension",
                                    "values"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "dimension": {
                                      "type": "string",
                                      "enum": [
                                        "first_channel"
                                      ]
                                    },
                                    "values": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "path": {
                                            "type": "string",
                                            "enum": [
                                              "a",
                                              "b",
                                              "c",
                                              "d"
                                            ]
                                          },
                                          "value": {
                                            "type": "string",
                                            "enum": [
                                              "linkedin",
                                              "email",
                                              "none"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "path",
                                          "value"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "description": "The value on each path."
                                    }
                                  },
                                  "required": [
                                    "dimension",
                                    "values"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "dimension": {
                                      "type": "string",
                                      "enum": [
                                        "wait_days"
                                      ]
                                    },
                                    "values": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "path": {
                                            "type": "string",
                                            "enum": [
                                              "a",
                                              "b",
                                              "c",
                                              "d"
                                            ]
                                          },
                                          "value": {
                                            "type": "integer",
                                            "minimum": -9007199254740991,
                                            "maximum": 9007199254740991,
                                            "allOf": [
                                              {
                                                "minimum": 0
                                              }
                                            ]
                                          }
                                        },
                                        "required": [
                                          "path",
                                          "value"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "description": "The value on each path."
                                    }
                                  },
                                  "required": [
                                    "dimension",
                                    "values"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "dimension": {
                                      "type": "string",
                                      "enum": [
                                        "writer"
                                      ]
                                    },
                                    "values": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "path": {
                                            "type": "string",
                                            "enum": [
                                              "a",
                                              "b",
                                              "c",
                                              "d"
                                            ]
                                          },
                                          "value": {
                                            "type": "string",
                                            "enum": [
                                              "template",
                                              "ai",
                                              "mixed",
                                              "none"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "path",
                                          "value"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "description": "The value on each path."
                                    }
                                  },
                                  "required": [
                                    "dimension",
                                    "values"
                                  ],
                                  "additionalProperties": false
                                }
                              ],
                              "description": "One thing the paths change: invite_note, follow_ups, emails, first_channel, wait_days or writer (template or AI)."
                            }
                          },
                          "started_at": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When the first lead entered (ISO 8601); null until then."
                          },
                          "checked_at": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When Bavlio last read the numbers (ISO 8601); null until then."
                          },
                          "decided_at": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When a path was kept (ISO 8601); null until then."
                          },
                          "applied_at": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "When the sequence moved to the kept path's steps (ISO 8601); null until then."
                          },
                          "winner": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "a",
                                  "b",
                                  "c",
                                  "d"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The kept path; null while the test runs."
                          },
                          "verdict": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "winner",
                                  "too_close",
                                  "harm",
                                  "picked"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Why that path was kept: winner, too_close (Path A stays), harm (the others did harm) or picked by hand."
                          },
                          "loss": {
                            "anyOf": [
                              {
                                "anyOf": [
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "string",
                                    "enum": [
                                      "Infinity",
                                      "-Infinity",
                                      "NaN"
                                    ]
                                  }
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "Goal conversions per lead a wrong pick would cost now; null before every path counts enough leads."
                          },
                          "limit": {
                            "anyOf": [
                              {
                                "anyOf": [
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "string",
                                    "enum": [
                                      "Infinity",
                                      "-Infinity",
                                      "NaN"
                                    ]
                                  }
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ],
                            "description": "The loss under which Bavlio keeps the leading path."
                          },
                          "lift": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "path": {
                                    "type": "string",
                                    "enum": [
                                      "a",
                                      "b",
                                      "c",
                                      "d"
                                    ],
                                    "description": "The path compared with Path A."
                                  },
                                  "estimate": {
                                    "anyOf": [
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "string",
                                        "enum": [
                                          "Infinity",
                                          "-Infinity",
                                          "NaN"
                                        ]
                                      }
                                    ]
                                  },
                                  "low": {
                                    "anyOf": [
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "string",
                                        "enum": [
                                          "Infinity",
                                          "-Infinity",
                                          "NaN"
                                        ]
                                      }
                                    ]
                                  },
                                  "high": {
                                    "anyOf": [
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "string",
                                        "enum": [
                                          "Infinity",
                                          "-Infinity",
                                          "NaN"
                                        ]
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "path",
                                  "estimate",
                                  "low",
                                  "high"
                                ],
                                "additionalProperties": false,
                                "description": "How the kept or strongest other path compares with Path A; the range stays valid however often it is read."
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "paths": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "path": {
                                  "type": "string",
                                  "enum": [
                                    "a",
                                    "b",
                                    "c",
                                    "d"
                                  ],
                                  "description": "Path letter."
                                },
                                "entered": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991,
                                  "allOf": [
                                    {
                                      "minimum": 0,
                                      "description": "Leads sent down the path."
                                    }
                                  ]
                                },
                                "people": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991,
                                  "allOf": [
                                    {
                                      "minimum": 0,
                                      "description": "Leads compared: their clock started and their message was not rewritten in review."
                                    }
                                  ]
                                },
                                "counted": {
                                  "anyOf": [
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "string",
                                      "enum": [
                                        "Infinity",
                                        "-Infinity",
                                        "NaN"
                                      ]
                                    }
                                  ]
                                },
                                "converted": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991,
                                  "allOf": [
                                    {
                                      "minimum": 0,
                                      "description": "Leads who reached the goal."
                                    }
                                  ]
                                },
                                "rate": {
                                  "anyOf": [
                                    {
                                      "anyOf": [
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "string",
                                          "enum": [
                                            "Infinity",
                                            "-Infinity",
                                            "NaN"
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ],
                                  "description": "converted over counted; null before anyone counts."
                                },
                                "chance_best": {
                                  "anyOf": [
                                    {
                                      "anyOf": [
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "string",
                                          "enum": [
                                            "Infinity",
                                            "-Infinity",
                                            "NaN"
                                          ]
                                        }
                                      ]
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ],
                                  "description": "Chance that this path has the best goal rate; null before anyone counts."
                                },
                                "share": {
                                  "anyOf": [
                                    {
                                      "type": "number"
                                    },
                                    {
                                      "type": "string",
                                      "enum": [
                                        "Infinity",
                                        "-Infinity",
                                        "NaN"
                                      ]
                                    }
                                  ]
                                },
                                "stopped": {
                                  "type": "boolean",
                                  "description": "True once the path stopped taking leads because it does harm."
                                },
                                "overridden": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991,
                                  "allOf": [
                                    {
                                      "minimum": 0,
                                      "description": "Leads left out of the comparison because their message was rewritten in review."
                                    }
                                  ]
                                },
                                "guardrails": {
                                  "type": "object",
                                  "properties": {
                                    "accepted": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991,
                                      "allOf": [
                                        {
                                          "minimum": 0,
                                          "description": "Leads on the path who accepted the invite."
                                        }
                                      ]
                                    },
                                    "negative": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991,
                                      "allOf": [
                                        {
                                          "minimum": 0,
                                          "description": "Leads who replied with a no."
                                        }
                                      ]
                                    },
                                    "unsubscribed": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991,
                                      "allOf": [
                                        {
                                          "minimum": 0,
                                          "description": "Leads who asked to stop."
                                        }
                                      ]
                                    },
                                    "bounced": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991,
                                      "allOf": [
                                        {
                                          "minimum": 0,
                                          "description": "Leads whose email bounced."
                                        }
                                      ]
                                    },
                                    "restricted": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991,
                                      "allOf": [
                                        {
                                          "minimum": 0,
                                          "description": "Leads after whom LinkedIn limited the account."
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "accepted",
                                    "negative",
                                    "unsubscribed",
                                    "bounced",
                                    "restricted"
                                  ],
                                  "additionalProperties": false,
                                  "description": "Signals that a path does harm; none of them decides the winner."
                                }
                              },
                              "required": [
                                "path",
                                "entered",
                                "people",
                                "counted",
                                "converted",
                                "rate",
                                "chance_best",
                                "share",
                                "stopped",
                                "overridden",
                                "guardrails"
                              ],
                              "additionalProperties": false,
                              "description": "One path's numbers."
                            }
                          },
                          "test": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64,
                                "description": "Bavlio's id of this A/B test."
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "ab_test"
                                ]
                              },
                              "goal": {
                                "type": "string",
                                "enum": [
                                  "replied",
                                  "positive_reply",
                                  "meeting"
                                ],
                                "description": "What counts as a win: replied, positive_reply or meeting."
                              },
                              "paths": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string",
                                      "enum": [
                                        "a",
                                        "b",
                                        "c",
                                        "d"
                                      ],
                                      "description": "Path letter: a, b, c or d, by the path's place."
                                    },
                                    "steps": {
                                      "type": "array",
                                      "items": {
                                        "$ref": "#/components/schemas/Union_"
                                      },
                                      "description": "Steps on this path; the paths must differ."
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "steps"
                                  ],
                                  "additionalProperties": false
                                },
                                "description": "The paths, 2 to 4, lettered a, b, c and d in order.",
                                "minItems": 2,
                                "maxItems": 4
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "goal",
                              "paths"
                            ],
                            "additionalProperties": false,
                            "description": "Send each lead who reaches this step down one path, then on to the steps after it. Bavlio shares leads between the paths, stops a path that does harm and keeps the winner."
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "goal",
                          "kind",
                          "changes",
                          "started_at",
                          "checked_at",
                          "decided_at",
                          "applied_at",
                          "winner",
                          "verdict",
                          "loss",
                          "limit",
                          "lift",
                          "paths",
                          "test"
                        ],
                        "additionalProperties": false,
                        "description": "An A/B test of the sequence and how it stands."
                      },
                      "description": "Every A/B test in the steps, then the finished ones the steps no longer hold."
                    },
                    "ab_test_numbers": {
                      "type": "object",
                      "properties": {
                        "source": {
                          "type": "string",
                          "enum": [
                            "campaign",
                            "bavlio",
                            "benchmark"
                          ],
                          "description": "Where the numbers come from: this campaign, all of Bavlio, or benchmarks when neither has enough data."
                        },
                        "leads_per_week": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "string",
                              "enum": [
                                "Infinity",
                                "-Infinity",
                                "NaN"
                              ]
                            }
                          ]
                        },
                        "acceptance": {
                          "anyOf": [
                            {
                              "type": "number"
                            },
                            {
                              "type": "string",
                              "enum": [
                                "Infinity",
                                "-Infinity",
                                "NaN"
                              ]
                            }
                          ]
                        },
                        "rates": {
                          "type": "object",
                          "properties": {
                            "replied": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "string",
                                  "enum": [
                                    "Infinity",
                                    "-Infinity",
                                    "NaN"
                                  ]
                                }
                              ]
                            },
                            "positive_reply": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "string",
                                  "enum": [
                                    "Infinity",
                                    "-Infinity",
                                    "NaN"
                                  ]
                                }
                              ]
                            },
                            "meeting": {
                              "anyOf": [
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "string",
                                  "enum": [
                                    "Infinity",
                                    "-Infinity",
                                    "NaN"
                                  ]
                                }
                              ]
                            }
                          },
                          "required": [
                            "replied",
                            "positive_reply",
                            "meeting"
                          ],
                          "additionalProperties": false,
                          "description": "Share of leads who reach each goal."
                        }
                      },
                      "required": [
                        "source",
                        "leads_per_week",
                        "acceptance",
                        "rates"
                      ],
                      "additionalProperties": false,
                      "description": "The rates and pace A/B test plans are made from."
                    },
                    "created_at": {
                      "type": "string",
                      "description": "When the version was saved (ISO 8601)."
                    }
                  },
                  "required": [
                    "campaign_id",
                    "version",
                    "steps",
                    "stats",
                    "warnings",
                    "ab_tests",
                    "ab_test_numbers",
                    "created_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "SequenceInvalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SequenceInvalidEncoded"
                }
              }
            }
          },
          "401": {
            "description": "AuthMissing | AuthInvalid",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/AuthMissingEncoded"
                    },
                    {
                      "$ref": "#/components/schemas/AuthInvalidEncoded"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "WorkspaceNotFound | CampaignNotFound | AbTestNotFound | AbTestPathNotFound",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/WorkspaceNotFoundEncoded"
                    },
                    {
                      "$ref": "#/components/schemas/CampaignNotFoundEncoded"
                    },
                    {
                      "$ref": "#/components/schemas/AbTestNotFoundEncoded"
                    },
                    {
                      "$ref": "#/components/schemas/AbTestPathNotFoundEncoded"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "CampaignArchived | AbTestDecided",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/CampaignArchivedEncoded"
                    },
                    {
                      "$ref": "#/components/schemas/AbTestDecidedEncoded"
                    }
                  ]
                }
              }
            }
          }
        },
        "description": "Ends the A/B test by hand: every new lead gets the path from now on, and once nobody is left on another path the sequence keeps only its steps. Keeping the path already kept changes nothing; keeping another one once the test is decided answers 409.",
        "summary": "Keep a path of an A/B test",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string",
                    "enum": [
                      "a",
                      "b",
                      "c",
                      "d"
                    ],
                    "description": "The path every new lead gets from now on."
                  }
                },
                "required": [
                  "path"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": true
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AuthInvalidEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "AuthInvalid"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              401
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "auth_invalid"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "Bearer credential rejected"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "AuthMissingEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "AuthMissing"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              401
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "auth_missing"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "Bearer credential required"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "WorkspaceNotFoundEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "WorkspaceNotFound"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              404
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "workspace_not_found"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "No such workspace for this account: save a company profile or pick a workspace you belong to"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "SequenceInvalidEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "SequenceInvalid"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              400
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "sequence_invalid"
            ]
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "AbTestDecidedEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "AbTestDecided"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              409
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "ab_test_decided"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "This A/B test already has a winner"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "CampaignArchivedEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "CampaignArchived"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              409
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "campaign_archived"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "The campaign is archived and takes no more changes"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "AbTestPathNotFoundEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "AbTestPathNotFound"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              404
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "ab_test_path_not_found"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "This A/B test has no path with this letter"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "AbTestNotFoundEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "AbTestNotFound"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              404
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "ab_test_not_found"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "The campaign's sequence has no A/B test with this id"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "CampaignNotFoundEncoded": {
        "type": "object",
        "properties": {
          "_tag": {
            "type": "string",
            "enum": [
              "CampaignNotFound"
            ]
          },
          "statusCode": {
            "type": "number",
            "enum": [
              404
            ]
          },
          "code": {
            "type": "string",
            "enum": [
              "campaign_not_found"
            ]
          },
          "message": {
            "type": "string",
            "enum": [
              "No campaign with this id belongs to the workspace"
            ]
          }
        },
        "required": [
          "_tag",
          "statusCode",
          "code",
          "message"
        ],
        "additionalProperties": false
      },
      "Union_": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Unique step id; leads stay on a step whose id a new version keeps."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "visit_profile"
                ]
              }
            },
            "required": [
              "id",
              "kind"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Unique step id; leads stay on a step whose id a new version keeps."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "like_post"
                ]
              }
            },
            "required": [
              "id",
              "kind"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Unique step id; leads stay on a step whose id a new version keeps."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "invite"
                ]
              },
              "note": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "Invite note; no links or {@booking_link}. Braces mark what is filled in per lead. Inside braces, an @ names a lead's value: @first_name, @company, @title, @moment, @booking_link, @lead_id, or a custom field from a file uploaded to the campaign, like @city. Options split by | are tried in order and the first whose @ values the lead has is used, like {@first_name|there} or {@age year olds|Gen Z}; an option without an @ is plain text. Braces with a custom field end with an option without one, because leads Bavlio finds have no custom fields. Braces without an @ hold choices, one picked per lead, like {Hi|Hello|Hey}. Everything else is sent as written, an @ outside braces included."
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "id",
              "kind",
              "note"
            ],
            "additionalProperties": false,
            "description": "Send a LinkedIn invite, with the note or, when null, without."
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Unique step id; leads stay on a step whose id a new version keeps."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "message"
                ]
              },
              "mode": {
                "type": "string",
                "enum": [
                  "template"
                ]
              },
              "template": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1900,
                    "description": "LinkedIn message. Braces mark what is filled in per lead. Inside braces, an @ names a lead's value: @first_name, @company, @title, @moment, @booking_link, @lead_id, or a custom field from a file uploaded to the campaign, like @city. Options split by | are tried in order and the first whose @ values the lead has is used, like {@first_name|there} or {@age year olds|Gen Z}; an option without an @ is plain text. Braces with a custom field end with an option without one, because leads Bavlio finds have no custom fields. Braces without an @ hold choices, one picked per lead, like {Hi|Hello|Hey}. Everything else is sent as written, an @ outside braces included."
                  }
                },
                "required": [
                  "body"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "kind",
              "mode",
              "template"
            ],
            "additionalProperties": false,
            "description": "Send a LinkedIn message filled in from the template."
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Unique step id; leads stay on a step whose id a new version keeps."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "message"
                ]
              },
              "mode": {
                "type": "string",
                "enum": [
                  "ai"
                ]
              },
              "ai": {
                "type": "object",
                "properties": {
                  "brief": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000,
                    "description": "Instructions the AI writes the text from, for each lead."
                  }
                },
                "required": [
                  "brief"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "kind",
              "mode",
              "ai"
            ],
            "additionalProperties": false,
            "description": "Send a LinkedIn message the AI writes from the brief."
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Unique step id; leads stay on a step whose id a new version keeps."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "email"
                ]
              },
              "subject": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 150,
                    "description": "Email subject. Braces mark what is filled in per lead. Inside braces, an @ names a lead's value: @first_name, @company, @title, @moment, @booking_link, @lead_id, or a custom field from a file uploaded to the campaign, like @city. Options split by | are tried in order and the first whose @ values the lead has is used, like {@first_name|there} or {@age year olds|Gen Z}; an option without an @ is plain text. Braces with a custom field end with an option without one, because leads Bavlio finds have no custom fields. Braces without an @ hold choices, one picked per lead, like {Hi|Hello|Hey}. Everything else is sent as written, an @ outside braces included."
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Subject; null replies in the thread of the lead's earlier email."
              },
              "mode": {
                "type": "string",
                "enum": [
                  "template"
                ]
              },
              "template": {
                "type": "object",
                "properties": {
                  "body": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 5000,
                    "description": "Email body. Braces mark what is filled in per lead. Inside braces, an @ names a lead's value: @first_name, @company, @title, @moment, @booking_link, @lead_id, or a custom field from a file uploaded to the campaign, like @city. Options split by | are tried in order and the first whose @ values the lead has is used, like {@first_name|there} or {@age year olds|Gen Z}; an option without an @ is plain text. Braces with a custom field end with an option without one, because leads Bavlio finds have no custom fields. Braces without an @ hold choices, one picked per lead, like {Hi|Hello|Hey}. Everything else is sent as written, an @ outside braces included."
                  }
                },
                "required": [
                  "body"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "kind",
              "subject",
              "mode",
              "template"
            ],
            "additionalProperties": false,
            "description": "Send an email filled in from the template."
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Unique step id; leads stay on a step whose id a new version keeps."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "email"
                ]
              },
              "subject": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 150,
                    "description": "Email subject. Braces mark what is filled in per lead. Inside braces, an @ names a lead's value: @first_name, @company, @title, @moment, @booking_link, @lead_id, or a custom field from a file uploaded to the campaign, like @city. Options split by | are tried in order and the first whose @ values the lead has is used, like {@first_name|there} or {@age year olds|Gen Z}; an option without an @ is plain text. Braces with a custom field end with an option without one, because leads Bavlio finds have no custom fields. Braces without an @ hold choices, one picked per lead, like {Hi|Hello|Hey}. Everything else is sent as written, an @ outside braces included."
                  },
                  {
                    "type": "null"
                  }
                ],
                "description": "Subject; null replies in the thread of the lead's earlier email."
              },
              "mode": {
                "type": "string",
                "enum": [
                  "ai"
                ]
              },
              "ai": {
                "type": "object",
                "properties": {
                  "brief": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000,
                    "description": "Instructions the AI writes the text from, for each lead."
                  }
                },
                "required": [
                  "brief"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "id",
              "kind",
              "subject",
              "mode",
              "ai"
            ],
            "additionalProperties": false,
            "description": "Send an email the AI writes from the brief."
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Unique step id; leads stay on a step whose id a new version keeps."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "wait"
                ]
              },
              "days": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Days before the next step.",
                "allOf": [
                  {
                    "minimum": 1,
                    "maximum": 30
                  }
                ]
              }
            },
            "required": [
              "id",
              "kind",
              "days"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Unique step id; leads stay on a step whose id a new version keeps."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "branch"
                ]
              },
              "condition": {
                "type": "string",
                "enum": [
                  "invite_accepted",
                  "replied"
                ]
              },
              "within_days": {
                "type": "integer",
                "minimum": -9007199254740991,
                "maximum": 9007199254740991,
                "description": "Days to wait for the condition before taking no.",
                "allOf": [
                  {
                    "minimum": 1,
                    "maximum": 30
                  }
                ]
              },
              "yes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Union_"
                },
                "description": "Steps once the condition is met."
              },
              "no": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Union_"
                },
                "description": "Steps when it is not met in time."
              }
            },
            "required": [
              "id",
              "kind",
              "condition",
              "within_days",
              "yes",
              "no"
            ],
            "additionalProperties": false,
            "description": "Wait for the condition, then take the yes or no steps."
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64,
                "description": "Bavlio's id of this A/B test."
              },
              "kind": {
                "type": "string",
                "enum": [
                  "ab_test"
                ]
              },
              "goal": {
                "type": "string",
                "enum": [
                  "replied",
                  "positive_reply",
                  "meeting"
                ],
                "description": "What counts as a win: replied, positive_reply or meeting."
              },
              "paths": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "enum": [
                        "a",
                        "b",
                        "c",
                        "d"
                      ],
                      "description": "Path letter: a, b, c or d, by the path's place."
                    },
                    "steps": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Union_"
                      },
                      "description": "Steps on this path; the paths must differ."
                    }
                  },
                  "required": [
                    "id",
                    "steps"
                  ],
                  "additionalProperties": false
                },
                "description": "The paths, 2 to 4, lettered a, b, c and d in order.",
                "minItems": 2,
                "maxItems": 4
              }
            },
            "required": [
              "id",
              "kind",
              "goal",
              "paths"
            ],
            "additionalProperties": false,
            "description": "Send each lead who reaches this step down one path, then on to the steps after it. Bavlio shares leads between the paths, stops a path that does harm and keeps the winner."
          }
        ],
        "description": "One step. visit_profile visits the lead's LinkedIn profile, like_post likes their latest post, wait pauses for the days given."
      }
    },
    "securitySchemes": {
      "bearer": {
        "description": "Send `Authorization: Bearer <token>`. The token is an API key, which starts with `bav_` and comes from creating an API key or starting a registration, or the access token of a Bavlio sign-in.",
        "type": "http",
        "scheme": "Bearer"
      }
    }
  },
  "security": [],
  "tags": [
    {
      "name": "Registration",
      "description": "Open a Bavlio account without signing in. Starting a registration returns an API key for a new ephemeral account, which becomes permanent once its email address is verified."
    },
    {
      "name": "Authentication",
      "description": "Identify the calling account, finish a registration and manage the account's API keys."
    },
    {
      "name": "Account",
      "description": "The account behind your sign-in, and deleting it."
    },
    {
      "name": "Workspaces",
      "description": "A workspace holds the company profile, outreach schedule, team, campaigns and billing Bavlio works with. Calls that act in a workspace use the one whose id is in the bavlio-workspace header, or the account's default workspace when the header is absent."
    },
    {
      "name": "Teams",
      "description": "Manage who belongs to a workspace: its members, their roles and the invitations to join it. Each workspace's plan sets how many team seats it has."
    },
    {
      "name": "Campaigns",
      "description": "A campaign finds leads that match an ideal customer profile (ICP) and buying signals, and reaches out to them through its sequence of LinkedIn and email steps."
    },
    {
      "name": "Lead imports",
      "description": "Bring your own leads: preview a CSV, confirm which column holds what, then import it into a campaign, where the leads go through the same sequence as the ones Bavlio finds."
    },
    {
      "name": "Sequences",
      "description": "A campaign's sequence is the steps Bavlio runs for each lead: profile visits, likes, invites, LinkedIn messages, emails, waits, conditions and A/B tests. Every message and email waits in the review queue for approval before it is sent."
    },
    {
      "name": "Inbox",
      "description": "Conversations with the people your campaigns reached and, for accounts that opt in, your other LinkedIn and email conversations: read them, reply to them and follow changes live."
    },
    {
      "name": "Reviews",
      "description": "Messages and emails go to a lead only after someone approves them. The review queue holds the replies Bavlio drafted for people who answered and the messages and emails it drafted for campaign sequences."
    },
    {
      "name": "Billing",
      "description": "The plans on offer and the workspace's subscription and usage. Plan changes, cancellation and the billing portal need the workspace owner or an admin."
    },
    {
      "name": "LinkedIn",
      "description": "Connect the LinkedIn accounts your campaigns send from, confirm their sign-ins, choose the country LinkedIn sees them from, and disconnect them."
    },
    {
      "name": "Meetings",
      "description": "Meetings booked through the workspace's calendar tool (Google Calendar, Calendly or Cal.com), and the calendar connection that imports them."
    },
    {
      "name": "Email",
      "description": "Connect a Bavimail account, add sending domains and tracking domains, and create the inboxes campaigns send email from."
    }
  ],
  "servers": [
    {
      "url": "https://api.bavlio.com"
    }
  ]
}
```
