Update an A/B variant

View as Markdown
Changes a variant's weight, active flag, prompt or first message. At least one field must be defined. Set `isActive: false` to stop a variant from being picked without losing its counters; set it back to `true` to resume. Counters are never reset by an update — create a new variant to measure a changed prompt from zero. **Side effects.** A changed prompt or first message is screened for fraud (LLM call). The new settings apply to the agent's next campaign dials. Writes an audit entry. **Idempotency.** Safe to retry: the same body sets the same values. **Webhook events.** `audit.log_recorded` (when subscribed). See [Webhooks](/webhooks). **Access** - **Required scope:** `write`. - **Rate limit:** Agent mutations — 10 requests/min per workspace, shared with every agent write; the request is also counted (twice) against the General API limit. See [Rate limits](/rate-limits). - **Plan:** A/B testing is gated by plan feature; every plan includes it today.

Authentication

AuthorizationBearer
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).

Path parameters

agentIdstringRequiredformat: "uuid"

UUID of the agent that owns the variant. A value that is not a UUID answers 400 Invalid params.

variantIdstringRequiredformat: "uuid"

UUID of the variant (id from GET /api/agents/{agentId}/ab-tests). A variant of another agent, another workspace or already deleted answers 404; a value that is not a UUID answers 400 Invalid params.

Request

This endpoint expects an object.
weightintegerOptional0-100

New relative traffic weight, 0-100. Stored as an integer — send whole numbers; a fractional value fails the request.

isActivebooleanOptional

false stops the variant from being picked for new calls; counters are kept.

systemPromptstringOptional10-8000 characters

New prompt, 10-8000 characters. Blank is treated as absent. Screened for fraud.

firstMessagestringOptional1-500 characters

New opening line. Trimmed; blank is treated as absent (it cannot be cleared to null here).

Response

The updated variant.
dataobject

A prompt variant row (snake_case), with its raw performance counters.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error