> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developer.jelliu.co/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developer.jelliu.co/_mcp/server.

# List A/B variants

GET https://api.jelliu.co/api/agents/{agentId}/ab-tests

Lists the agent's live prompt variants, oldest first, with their raw counters. Deleted variants are
not returned. For conversion rates and confidence intervals use
`GET /api/agents/{agentId}/ab-tests/results`.

Returns an empty list — not `404` — when the agent does not exist in the workspace.

**Consistency.** Cached for up to 120 seconds; variant writes through this API clear it immediately,
but counters updated by finished calls can take up to 120 seconds to show.

**Access**

* **Required scope:** `read`.
* **Rate limit:** General API — 120 (Starter), 200 (Growth), 300 (Business) or 600 (Enterprise) requests/min per workspace; requests under this path are counted twice against it because two overlapping mounts apply the limiter. See [Rate limits](/rate-limits).
* **Plan:** A/B testing is gated by plan feature; every plan includes it today.

Reference: https://developer.jelliu.co/api-reference/agents/get-agents-by-agent-id-ab-tests

## Authentication

- `Authorization` header (bearer token, required) — Workspace API key: `jl_` followed by 64 lowercase hex characters, created by the workspace owner in the dashboard (**Settings → API Keys**) and sent as `Authorization: Bearer jl_...`. The plaintext is shown once, at creation; Jelliu stores only a SHA-256 hash. A workspace can hold up to 25 active keys. | Scope | GET / HEAD | POST / PUT / PATCH / DELETE | Admin-only routes | | --- | --- | --- | --- | | `read` | Yes | No | No | | `write` | Yes | Yes | No | | `full` | Yes | Yes | Yes | Operations restricted to admins or owners reject keys without the `full` scope with `403`, and say so in their description. No key, whatever its scope, can mint or revoke API keys or rotate a webhook secret — that requires a signed-in owner session. A revoked key stops authenticating within about 10 seconds. See [Authentication](/authentication).

## Request

### Path parameters

- `agentId` (string, required) — UUID of the agent. An unknown id or one from another workspace returns an empty list; a value that is not a UUID answers `400`.

## Response

### 200

Variants, oldest first.

- `data` (list of object, required) — Live variants of the agent. Empty when none exist or the agent is unknown.
  - `id` (string, optional) — Unique identifier of the variant.
  - `tenant_id` (string, optional) — Workspace that owns the variant.
  - `agent_id` (string, optional) — Agent the variant belongs to.
  - `name` (string, optional) — Label shown in results.
  - `system_prompt` (string, optional) — Prompt used instead of the agent's on calls that pick this variant.
  - `first_message` (string, optional, nullable) — Opening line for calls that pick this variant; `null` uses the agent's.
  - `weight` (integer, optional) — Relative traffic weight among active variants.
  - `is_active` (boolean, optional) — Whether the variant can be picked for new campaign calls.
  - `total_calls` (integer, optional) — Calls with an outcome recorded for this variant.
  - `total_conversions` (integer, optional) — Of those, calls whose outcome is a success outcome.
  - `total_duration_seconds` (integer, optional) — Sum of recorded call durations, in seconds.
  - `avg_sentiment` (double, optional, nullable) — Running average sentiment (-1 to 1) of calls that had a score; `null` when none had one.
  - `created_at` (datetime, optional) — Creation time (UTC).
  - `updated_at` (datetime, optional) — Last change, including counter updates (UTC).
  - `deleted_at` (any, optional) — Always `null` on returned variants.

## Errors

### 400 Bad Request Error

`agentId` is not a UUID.

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 401 Unauthorized Error

No usable credential. Either the `Authorization` header is missing or is not a well-formed `Bearer jl_…` key, or the key is unknown, revoked or expired. Do not retry with the same key. See [Authentication](/authentication#401-unauthorized).

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 403 Forbidden Error

API-key scope, suspended workspace, or (not reachable on current plans) A/B testing missing from the plan.

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

### 429 Too Many Requests Error

Rate limit exceeded for the current 60-second window (`RATE_LIMIT_EXCEEDED`). Wait `Retry-After` seconds, then retry. The `message` differs per limiter; the code does not. See [Rate limits](/rate-limits).

- `error` (object, required) — The error object. Always has `code` and `message`.
  - `code` (string, required) — Stable machine-readable error code (for example `VALIDATION_FAILED`, `UNAUTHORIZED`, `FORBIDDEN`, `NOT_FOUND`, `BILLING_ERROR`, `COMPLIANCE_BLOCKED`, `RATE_LIMIT_EXCEEDED`, `INTERNAL_ERROR`). Switch on this, not on `message`. See [Errors](/errors).
  - `message` (string, required) — Human-readable explanation. English or Spanish depending on the route; may change without notice.
  - `details` (object or list of object, optional) — Present on `VALIDATION_FAILED` only. Its shape depends on how the route validates: * a field map, either Zod's `flatten()` output (`{ "formErrors": [], "fieldErrors": { "name": ["..."] } }`) or just its `fieldErrors` part (`{ "name": ["..."] }`); * an issue list, where each issue has at least `path`, `message` and `code`. `path` is a dot-separated string on routes that let the schema throw, and an array of keys on routes that forward Zod's raw issues (those also carry Zod's extra issue fields).
    - Field map
      - `formErrors` (list of string, optional)
      - `fieldErrors` (map from string to list of string, optional)
  - `metadata` (map from string to any, optional) — Structured detail exposed for a small allowlist of codes only — for example `BILLING_ERROR` carries `limit`, `current` and `tier` (resource caps) or `tier` and `feature` (feature gates).

## Examples

**Response**

```json
{
  "data": [
    {
      "id": "1d2c3b4a-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
      "tenant_id": "2d9f6c1e-3b4a-4c5d-9e8f-7a6b5c4d3e2f",
      "agent_id": "7c1e4b2a-9d3f-4e8a-b5c6-2f1a0d9e8b7c",
      "name": "Variante A — consultiva",
      "system_prompt": "Eres Sofía, asesora de Cafés del Huila. Pregunta primero cuánto café consume el cliente al mes antes de recomendar un plan.",
      "first_message": null,
      "weight": 50,
      "is_active": true,
      "total_calls": 47,
      "total_conversions": 6,
      "total_duration_seconds": 7285,
      "avg_sentiment": 0.18,
      "created_at": "2026-09-02T10:15:00.000Z",
      "updated_at": "2026-09-14T21:40:12.000Z"
    },
    {
      "id": "8e7f6a5b-4c3d-4e2f-9a1b-0c9d8e7f6a5b",
      "tenant_id": "2d9f6c1e-3b4a-4c5d-9e8f-7a6b5c4d3e2f",
      "agent_id": "7c1e4b2a-9d3f-4e8a-b5c6-2f1a0d9e8b7c",
      "name": "Variante B — oferta directa",
      "system_prompt": "Eres Sofía, asesora de Cafés del Huila. Presenta la oferta del plan anual en la primera respuesta.",
      "first_message": "Hola, le habla Sofía de Cafés del Huila. Este mes el plan anual tiene dos meses gratis.",
      "weight": 50,
      "is_active": true,
      "total_calls": 42,
      "total_conversions": 9,
      "total_duration_seconds": 5796,
      "avg_sentiment": 0.31,
      "created_at": "2026-09-02T10:16:30.000Z",
      "updated_at": "2026-09-14T21:52:03.000Z"
    }
  ]
}
```

**SDK Code**

```python Agents_getAgentsByAgentIdAbTests_example
import requests

url = "https://api.jelliu.co/api/agents/7c1e4b2a-9d3f-4e8a-b5c6-2f1a0d9e8b7c/ab-tests"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript Agents_getAgentsByAgentIdAbTests_example
const url = 'https://api.jelliu.co/api/agents/7c1e4b2a-9d3f-4e8a-b5c6-2f1a0d9e8b7c/ab-tests';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Agents_getAgentsByAgentIdAbTests_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.jelliu.co/api/agents/7c1e4b2a-9d3f-4e8a-b5c6-2f1a0d9e8b7c/ab-tests"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Agents_getAgentsByAgentIdAbTests_example
require 'uri'
require 'net/http'

url = URI("https://api.jelliu.co/api/agents/7c1e4b2a-9d3f-4e8a-b5c6-2f1a0d9e8b7c/ab-tests")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Agents_getAgentsByAgentIdAbTests_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.jelliu.co/api/agents/7c1e4b2a-9d3f-4e8a-b5c6-2f1a0d9e8b7c/ab-tests")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Agents_getAgentsByAgentIdAbTests_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.jelliu.co/api/agents/7c1e4b2a-9d3f-4e8a-b5c6-2f1a0d9e8b7c/ab-tests', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Agents_getAgentsByAgentIdAbTests_example
using RestSharp;

var client = new RestClient("https://api.jelliu.co/api/agents/7c1e4b2a-9d3f-4e8a-b5c6-2f1a0d9e8b7c/ab-tests");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Agents_getAgentsByAgentIdAbTests_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.jelliu.co/api/agents/7c1e4b2a-9d3f-4e8a-b5c6-2f1a0d9e8b7c/ab-tests")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```