Experiment lifecycle commands
Create, list, inspect, read results, pause, complete, and delete Apex experiments from the CLI.
The experiments group covers experiment CRUD and lifecycle actions. Use IDs or slugs for reads and lifecycle commands. The alias apex exp is available for the group, and apex experiments list also has the ls alias.
List and inspect
apex experiments list --status draft --limit 20
apex experiments get homepage-hero-test
apex experiments results homepage-hero-test --currency EUR| Command | Arguments | Flags | Notes |
|---|---|---|---|
apex experiments list | None | --status <status>, --limit <n> | Status filter accepts draft, running, paused, or completed values. |
apex experiments get | <id-or-slug> | None beyond global flags | A plain slug and slug:<slug> both resolve by slug. |
apex experiments results | <id-or-slug> | --currency <code> | Returns experiment totals, arms, decision, metrics, series, and warnings when the API provides them. |
Use JSON mode for scripts:
apex experiments results homepage-hero-test --currency EUR --jsonCreate a draft
apex experiments create \
--name "Homepage hero trust copy" \
--slug homepage-hero-trust-copy \
--description "Tests clearer proof copy in the homepage hero." \
--traffic 25| Flag | Required | Behavior |
|---|---|---|
--name <name> | Yes | Experiment display name. |
--slug <slug> | No | URL-safe slug for GitOps and slug-based lookup. |
--description <desc> | No | Draft description. |
--type <type> | No | mutation (default) or flag-gated redirect. |
--source-url <pattern> | Redirect: yes | Positive source URL targeting rule. Repeat for multiple exact URLs, paths, or wildcard patterns. The first absolute HTTP(S) value also becomes the preview/store URL. |
--destination <url> | Redirect: yes | HTTP(S) destination for one treatment variation. Repeat to create multiple equally weighted treatments. Invalid or missing redirect destinations fail validation. |
--traffic <pct> | No | Percentage input converted to API traffic allocation. Defaults to 100. |
The command creates the experiment through the API. Configure variations, metrics, targeting, and QA before launching traffic in the dashboard.
Create a redirect experiment with a control on the source page and one treatment on the destination:
apex experiments create \
--name "Product page split URL" \
--type redirect \
--source-url "https://shop.example/products/source" \
--destination "https://landing.example/products/treatment"Redirect creation preserves the public v1 gates: the shop must have redirect
tests enabled, at least one positive source rule and treatment destination are
required, and destinations must be HTTP(S). A destination must not match the
source targeting unless it is the same page with added or changed query
parameters, such as ?view=alternate. API gate failures use the standard JSON
error envelope and exit codes.
The filesystem and public v1 contracts permit a redirect treatment to retain mutations, CSS, or JavaScript. Those artifacts are source-page-only; Apex keeps the assignment active on the destination for attribution but does not apply the source-authored artifacts there. Filesystem plans warn when a treatment mixes these artifacts with a destination.
Lifecycle verbs
apex experiments pause homepage-hero-trust-copy
apex experiments complete homepage-hero-trust-copy| Command | Arguments | Behavior |
|---|---|---|
apex experiments pause | <id-or-slug> | Requests the API to pause a running experiment. |
apex experiments complete | <id-or-slug> | Requests the API to complete or stop the experiment. |
Starting traffic is dashboard-only so the approval gates remain visible. Lifecycle validation for pause and complete is owned by Apex; if the API rejects a state transition, the CLI reports the API error and exits non-zero.
Delete
apex experiments delete homepage-hero-trust-copy
apex experiments delete homepage-hero-trust-copy --force --jsonapex experiments delete prompts before deleting in an interactive terminal. In non-TTY mode, deletion returns confirmation-required exit code 4 unless you pass --force.
Launch in the dashboard
The CLI has no experiments start command. Launch is dashboard-only so Apex can keep approval and readiness gates visible; CLI lifecycle commands cannot bypass QA or business approval.
Troubleshooting
- Experiment not found: check whether you passed an ID, slug, or
slug:<slug>. - Lifecycle action rejected: inspect the API error in JSON mode for readiness, status, or permission details.
- Delete fails in automation: rerun with
--forceonly after confirming the target experiment.