TenanciTenanci

Central de ajudaReferência da APITestes A/B

Testes A/B

Testes de landing pages no mesmo endereço.

Listar testes A/B

GET/domains/{id}/split-testsdomains:readLanding+

runningLimit conta os testes rodando na organização inteira (todos os domínios) e traz o teto do plano em max (null = sem teto; o plano Landing permite 5). Passou do teto, POST …/start responde 409 split_limit.

Parâmetros

  • idpath · stringobrigatório

    Id do recurso (prj_…, dom_…)

Requisição

cURL
curl "https://api.tenanci.com/v2/domains/dom_4h7n1q/split-tests" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"

Resposta 200

{
  "items": [
    {
      "id": "lp-corte-de-outubro-k3x9",
      "name": "Corte de outubro",
      "path": "/oferta",
      "scope": "path",
      "status": "draft",
      "goal": "Lead",
      "variants": [
        {
          "key": "a",
          "name": "Original (A)",
          "url": "https://lp.agendafacil.com/barbearia-do-ze/",
          "weight": 50
        },
        {
          "key": "b",
          "name": "Com vídeo",
          "url": "https://lp.agendafacil.com/barbearia-do-ze-video/",
          "weight": 50
        }
      ],
      "winner": null,
      "autoStop": true,
      "mode": "fixed",
      "rebalancedAt": null,
      "startedAt": null,
      "endedAt": null,
      "createdAt": "2026-10-15T10:00:00.000Z",
      "url": "https://barbeariadoze.com.br/oferta"
    }
  ],
  "runningLimit": {
    "running": 2,
    "max": 5
  }
}

Criar teste A/B

POST/domains/{id}/split-testsdomains:writeLanding+

O edge sorteia cada visitante e serve a landing page dele no mesmo endereço do domínio. Nasce em rascunho (draft); inicie com POST …/start. Até 50 testes por domínio. Resultado: GET /domains/:id/analytics/experiments/:exp com o id do teste.

Parâmetros

  • idpath · stringobrigatório

    Id do recurso (prj_…, dom_…)

Corpo

  • namestringobrigatóriomax 80

    Nome do teste.

  • pathstringmax 300

    Endereço do domínio onde o teste roda (padrão /).

  • scope"host" | "path"

    path (padrão): só a entrada e o que ela carrega; host: o domínio inteiro passa a ser do teste.

  • goalstring | null

    Meta que decide o teste (nome usado em tenanci.track() ou numa meta por página). Obrigatória para iniciar.

  • variantsobject[]obrigatório≤ 4 itens

    De 2 a 4 landing pages; a primeira é o controle (a).

    • namestringmax 60

      Nome da variante (padrão: Original (A), Variante B…).

    • urlstringobrigatóriomax 2048

      Endereço da landing page (em outro host, não no próprio domínio do teste).

    • weightinteger≥ -9007199254740991, ≤ 9007199254740991

      Percentual do tráfego (0–100). Informados, precisam somar 100; sem pesos, divide igual.

  • autoStopboolean

    Encerrar sozinho quando houver vencedora segura (padrão true) e avisar por e-mail.

  • mode"fixed" | "bandit"

    fixed (padrão): percentuais fixos; bandit: redistribui o tráfego para a LP que está ganhando.

Requisição

cURL
curl -X POST "https://api.tenanci.com/v2/domains/dom_4h7n1q/split-tests" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"name":"Corte de outubro","path":"/oferta","goal":"Lead","variants":[{"url":"https://lp.agendafacil.com/barbearia-do-ze/"},{"name":"Com vídeo","url":"https://lp.agendafacil.com/barbearia-do-ze-video/"}]}'

Resposta 201

{
  "id": "lp-corte-de-outubro-k3x9",
  "name": "Corte de outubro",
  "path": "/oferta",
  "scope": "path",
  "status": "draft",
  "goal": "Lead",
  "variants": [
    {
      "key": "a",
      "name": "Original (A)",
      "url": "https://lp.agendafacil.com/barbearia-do-ze/",
      "weight": 50
    },
    {
      "key": "b",
      "name": "Com vídeo",
      "url": "https://lp.agendafacil.com/barbearia-do-ze-video/",
      "weight": 50
    }
  ],
  "winner": null,
  "autoStop": true,
  "mode": "fixed",
  "rebalancedAt": null,
  "startedAt": null,
  "endedAt": null,
  "createdAt": "2026-10-15T10:00:00.000Z",
  "url": "https://barbeariadoze.com.br/oferta"
}

Checar uma landing page

POST/domains/{id}/split-tests/check-urldomains:writeLanding+

Abre a URL como o edge vai abrir e avisa o que pode dar errado: erro, não é HTML, redireciona para outro domínio, <base href> absoluto ou script que confere o próprio endereço.

Parâmetros

  • idpath · stringobrigatório

    Id do recurso (prj_…, dom_…)

Corpo

  • urlstringobrigatóriomax 2048

    Endereço da landing page.

Requisição

cURL
curl -X POST "https://api.tenanci.com/v2/domains/dom_4h7n1q/split-tests/check-url" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://lp.agendafacil.com/barbearia-do-ze-video/"}'

Resposta 200

{
  "ok": true,
  "status": 200,
  "finalUrl": "https://lp.agendafacil.com/barbearia-do-ze-video/",
  "title": "Barbearia do Zé | Agende seu corte",
  "warnings": []
}

Ver teste A/B

GET/domains/{id}/split-tests/{testId}domains:readLanding+

Parâmetros

  • idpath · stringobrigatório

    Id do recurso (prj_…, dom_…)

  • testIdpath · stringobrigatório

    Id do teste (lp-…)

Requisição

cURL
curl "https://api.tenanci.com/v2/domains/dom_4h7n1q/split-tests/<testId>" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"

Resposta 200

{
  "id": "lp-corte-de-outubro-k3x9",
  "name": "Corte de outubro",
  "path": "/oferta",
  "scope": "path",
  "status": "draft",
  "goal": "Lead",
  "variants": [
    {
      "key": "a",
      "name": "Original (A)",
      "url": "https://lp.agendafacil.com/barbearia-do-ze/",
      "weight": 50
    },
    {
      "key": "b",
      "name": "Com vídeo",
      "url": "https://lp.agendafacil.com/barbearia-do-ze-video/",
      "weight": 50
    }
  ],
  "winner": null,
  "autoStop": true,
  "mode": "fixed",
  "rebalancedAt": null,
  "startedAt": null,
  "endedAt": null,
  "createdAt": "2026-10-15T10:00:00.000Z",
  "url": "https://barbeariadoze.com.br/oferta"
}

Alterar teste A/B

PATCH/domains/{id}/split-tests/{testId}domains:writeLanding+

Os mesmos campos da criação, todos opcionais. Landing pages, endereço e escopo só mudam em rascunho ou pausado (e, pausado, sem mudar a quantidade de LPs). A meta não muda depois de encerrado.

Parâmetros

  • idpath · stringobrigatório

    Id do recurso (prj_…, dom_…)

  • testIdpath · stringobrigatório

    Id do teste (lp-…)

Corpo

  • namestringmax 80

    Nome do teste.

  • pathstringmax 300

    Endereço do domínio onde o teste roda (padrão /).

  • scope"host" | "path"

    path (padrão): só a entrada e o que ela carrega; host: o domínio inteiro passa a ser do teste.

  • goalstring | null

    Meta que decide o teste (nome usado em tenanci.track() ou numa meta por página). Obrigatória para iniciar.

  • variantsobject[]≤ 4 itens

    De 2 a 4 landing pages; a primeira é o controle (a).

    • namestringmax 60

      Nome da variante (padrão: Original (A), Variante B…).

    • urlstringobrigatóriomax 2048

      Endereço da landing page (em outro host, não no próprio domínio do teste).

    • weightinteger≥ -9007199254740991, ≤ 9007199254740991

      Percentual do tráfego (0–100). Informados, precisam somar 100; sem pesos, divide igual.

  • autoStopboolean

    Encerrar sozinho quando houver vencedora segura (padrão true) e avisar por e-mail.

  • mode"fixed" | "bandit"

    fixed (padrão): percentuais fixos; bandit: redistribui o tráfego para a LP que está ganhando.

Requisição

cURL
curl -X PATCH "https://api.tenanci.com/v2/domains/dom_4h7n1q/split-tests/<testId>" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"mode":"bandit","autoStop":false}'

Resposta 200

{
  "id": "lp-corte-de-outubro-k3x9",
  "name": "Corte de outubro",
  "path": "/oferta",
  "scope": "path",
  "status": "draft",
  "goal": "Lead",
  "variants": [
    {
      "key": "a",
      "name": "Original (A)",
      "url": "https://lp.agendafacil.com/barbearia-do-ze/",
      "weight": 50
    },
    {
      "key": "b",
      "name": "Com vídeo",
      "url": "https://lp.agendafacil.com/barbearia-do-ze-video/",
      "weight": 50
    }
  ],
  "winner": null,
  "autoStop": false,
  "mode": "bandit",
  "rebalancedAt": null,
  "startedAt": null,
  "endedAt": null,
  "createdAt": "2026-10-15T10:00:00.000Z",
  "url": "https://barbeariadoze.com.br/oferta"
}

Apagar teste A/B

DELETE/domains/{id}/split-tests/{testId}domains:writeLanding+

Parâmetros

  • idpath · stringobrigatório

    Id do recurso (prj_…, dom_…)

  • testIdpath · stringobrigatório

    Id do teste (lp-…)

Requisição

cURL
curl -X DELETE "https://api.tenanci.com/v2/domains/dom_4h7n1q/split-tests/<testId>" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx"

Resposta 204

Sucesso

Iniciar, pausar, retomar, encerrar ou arquivar

POST/domains/{id}/split-tests/{testId}/{action}domains:writeLanding+

draft → running ⇄ paused → ended → archived. start exige a meta; start/resume dão 409 se outro teste ativo usa o mesmo endereço (split_overlap) ou o plano chegou ao limite de testes rodando (split_limit). end exige winner e passa todos os visitantes para a vencedora; archive tira o teste do ar. O corpo só é usado em end.

Parâmetros

  • idpath · stringobrigatório

    Id do recurso (prj_…, dom_…)

  • testIdpath · stringobrigatório

    Id do teste (lp-…)

  • actionpath · stringobrigatório

    start, pause, resume, end ou archive

Corpo

  • winner"a" | "b" | "c" | "d"

    Variante vencedora (só em end).

Requisição

cURL
curl -X POST "https://api.tenanci.com/v2/domains/dom_4h7n1q/split-tests/<testId>/<action>" \
  -H "Authorization: Bearer tnc_live_xxxxxxxx_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"winner":"b"}'

Resposta 200

{
  "id": "lp-corte-de-outubro-k3x9",
  "name": "Corte de outubro",
  "path": "/oferta",
  "scope": "path",
  "status": "ended",
  "goal": "Lead",
  "variants": [
    {
      "key": "a",
      "name": "Original (A)",
      "url": "https://lp.agendafacil.com/barbearia-do-ze/",
      "weight": 50
    },
    {
      "key": "b",
      "name": "Com vídeo",
      "url": "https://lp.agendafacil.com/barbearia-do-ze-video/",
      "weight": 50
    }
  ],
  "winner": "b",
  "autoStop": true,
  "mode": "fixed",
  "rebalancedAt": null,
  "startedAt": "2026-10-15T10:05:00.000Z",
  "endedAt": "2026-10-22T09:00:00.000Z",
  "createdAt": "2026-10-15T10:00:00.000Z",
  "url": "https://barbeariadoze.com.br/oferta"
}