CLI commands, JSON, and exit codes
Every registered Apex CLI command, the stable JSON envelope, exit-code meanings, and headless agent usage rules.
Use this page as the command map before scripting the CLI. The source of truth is the live apex schema --json command.
Global behavior
apexis the canonical binary.dripis a compatibility alias.--jsonis available globally and on every registered command.- Piped stdout automatically uses JSON mode even when
--jsonis omitted. - Human progress, prompts, diagnostics, and update notices go to stderr.
CLI version floor
Every v1 API response includes X-Apex-Cli-Minimum and, when known at build time,
X-Apex-Cli-Latest. The minimum is advisory until server-side enforcement is enabled.
When enforcement is enabled, a write from an older Apex CLI returns HTTP 426 with code
cli_upgrade_required and the exact upgrade command. Read commands continue to work so
agents can inspect state and recover safely.
apex pushandapex experiments applywrite one hosted asset upload line to stderr for each inline image above 4,096 characters and each referenced local image file. Pass--no-asset-uploadto keep inline and local image references unchanged.- Do not parse human tables. Use
apex schema --jsonto discover commands and flags. apex --version --jsonreturns the standard envelope with the package name and version indata;apex --versionremains a bare version string for compatibility, including in pipes.
JSON output uses this stable top-level envelope:
{
"ok": true,
"version": "0.1.1",
"command": "apex experiments list",
"data": {}
}Errors use the same envelope shape with ok: false and an error object:
{
"ok": false,
"version": "0.1.1",
"command": "apex experiments apply",
"error": {
"message": "Applying these changes revokes the QA approval from 2026-10-01T12:00:00.000Z; pass --accept-qa-invalidation to confirm.",
"code": 4,
"details": {
"reason": "qa_approval_present",
"qa_approved_at": "2026-10-01T12:00:00.000Z",
"required_acknowledgment": "accept-qa-invalidation",
"retry": "apex experiments apply ./my-test --accept-qa-invalidation"
}
}
}When filesystem apply would replace authored URL rules with a Page attachment, it returns exit 4; review the change and retry with --confirm-targeting-replace.
With --json, stdout carries exactly one JSON document and nothing else.
For
commands backed by one API request, data is the API response body exactly as
the API returned it: lists keep { "data": [...], "pagination": {...} }, so rows
are at .data.data[], and single resources are at .data. apex experiments get
adds only dashboard_url. Commands that combine several requests or local files,
such as experiments create, pull, plan and apply, print a documented
CLI-composed object. When an API response caused a failure, error.api carries
{ "status", "body" } with the API error body verbatim; error.code stays the
CLI exit code. CLI 0.13.0 introduced this mirroring; earlier releases nested
bodies under keys such as .data.experiment.
Headless and agent usage
DRIP_API_KEY=apx_your_key_here apex schema --json
apex experiments plan ./my-test --json
apex experiments apply ./my-test --jsonIn headless mode:
-
Do not wait for prompts.
-
Prefer explicit
--json. -
If a command returns exit code
4, inspecterror.details.retryand rerun with the exact flag only after checking the planned destructive or QA-invalidating action. -
Never commit
~/.drip/credentials.json, API keys, or preview tokens. -
Note: CLI experiment readback for the v1 experiment format now guarantees the presence of lifecycle timestamp fields (
started_at,scheduled_start_at, andqa_approved_at) inapex experiments get/apex experiments list --full --jsonoutputs when those fields are applicable. Integrations should read those fields from the JSON envelope to determine scheduling and QA state.
Exit codes
| Code | Meaning | Typical recovery |
|---|---|---|
0 | Success. | Continue. |
1 | General failure. | Read error.message and command-specific details. |
2 | Auth or permission failure. | Run apex login, set DRIP_API_KEY, or check API-key permissions. |
3 | Validation failure. | Fix arguments, JSON, config, or unsupported file content. |
4 | Confirmation required. | Inspect error.details.retry; rerun with the named flag only when intended. |
5 | Conflict, including stale filesystem state where detected. | Pull fresh state, reapply edits, and plan again. |
6 | A check command reported a failing verdict (apex install check, apex install steps, apex shops doctor). | Read error.details.failed_checks (install check), error.details.steps (install steps) or the FAIL checks; fix the storefront or configuration, then rerun. |
Login and context
apex login authenticates your account once: the browser flow mints an
expiring, account-scoped user key that covers every organization and shop
your account can access, then lets you pick an org/shop context. Inspect the
credential and everything it can reach with apex whoami; switch the stored
context with apex use <org>[/<shop>] or apex use --org <org> --shop <shop>;
override per invocation with --org/--shop or the DRIP_ORG/DRIP_SHOP
environment variables. An environment-key run cannot persist apex use; it returns
context_not_persistable with the exact DRIP_ORG/DRIP_SHOP values to export. Every
JSON envelope echoes the effective context (org, shop, credential kind).
Automation keeps injecting a narrow shop key per process with DRIP_API_KEY;
shop and user credentials can coexist. apex login --user is a deprecated
alias. Use apex logout --user to remove only the user credential; plain
apex logout removes both.
Command index
The command names in this index are checked against apex schema --json by the CLI CI lane.
| Command | Purpose |
|---|---|
apex login | Authenticate your account and pick an org/shop context. |
apex logout | Remove stored credentials. |
apex whoami | Show your identity, credential, and available org/shop context. |
apex use | Set the current Apex organization and shop context. |
apex account | Manage your Apex account. |
apex account profile | Show the current account profile. |
apex account profile set | Update the current account profile. |
apex keys | Manage shop API keys with a user credential. |
apex keys list | List API-key metadata for a shop. |
apex keys create | Create a shop API key and print its secret once. |
apex keys revoke | Revoke a shop API key. |
apex webhooks | Manage shop webhooks. |
apex webhooks list | List webhooks. |
apex webhooks create | Create a webhook. |
apex webhooks update | Update a webhook URL, events, or active state. |
apex webhooks delete | Delete a webhook. |
apex webhooks deliveries | List webhook deliveries including failure and disabled state. |
apex webhooks test | Send a signed test event to a webhook. |
apex simulate | Simulate data-layer triggers without emitting events. |
apex forms | Form and checkout analytics: tracked forms, field drop-off, errors and sessions. Needs the shop's form analytics switch. |
apex forms list | List tracked forms with status and coverage; the Shopify checkout is listed first and tracked automatically. |
apex forms add | Track a storefront form: <key> --url <page> --selector <css> and exactly one of --complete-on-goal, --complete-on-page or --complete-on-call. |
apex forms remove | Stop tracking a storefront form; its history stays readable for 30 days. The checkout cannot be removed. |
apex forms summary | Views, starters, completions, abandons, checkout steps and lost revenue with its basis; filter with --range, --split, --device, --country. |
apex forms fields | Per-field time, returns, error share and drop-off; --format takes csv, json or table. |
apex forms errors | Validation errors by field and type with sessions and the share abandoned after; text shows only once seen in 20 sessions. |
apex forms sessions | Recent form sessions as field paths (never typed values); filter with --outcome, --with-replay, page with --cursor. |
apex forms field | One field's daily trend, time histogram, devices and errors. |
apex forms label | Give a field identity a readable label, or --clear it. |
apex forms merge | Report a retired field identity under the field that replaced it. |
apex forms unmerge | Undo a field merge. |
apex forms detect | Find the forms on one of the shop's pages (field metadata only) to pick a selector for apex forms add. |
apex surveys | Manage surveys. |
apex surveys list | List surveys; filter with --status <s>. |
apex surveys get | Get a survey by ID. |
apex surveys create | Create a survey from inline JSON, @file, a file path, or --file <path>; use one input form. See the survey body example below. |
apex surveys update | Update a survey by ID from inline JSON, @file, a file path, or --file <path>; use one input form. See the survey body example below. |
apex surveys start | Start a survey; publication warnings print to stderr. |
apex surveys pause | Pause a survey. |
apex surveys complete | Complete a survey. |
apex surveys duplicate | Duplicate a survey. |
apex surveys delete | Delete a draft or completed survey; live and paused surveys return conflict exit code 5. |
apex experiments | Manage experiments. |
apex experiments list | List code-free summaries by default; filter effective targeting server-side with --url <absolute-url>, use --fields <list> for selected columns, or --full for full details. |
apex experiments get | Get experiment details by ID or slug. JSON readback always carries started_at, scheduled_start_at and qa_approved_at as ISO-8601 UTC timestamps or null (all null on a fresh draft). |
apex experiments results | Read experiment results and timeseries by ID or slug. |
apex experiments update | Update an experiment |
apex experiments create | Create a complete experiment with page targeting, audiences, goals, and an optional QA preview URL. JSON readback always carries started_at, scheduled_start_at and qa_approved_at as ISO-8601 UTC timestamps or null (all null on a fresh draft). |
apex experiments attach-idea | Attach an experiment to an idea. |
apex experiments detach-idea | Detach an experiment from its idea. |
apex experiments pause | Pause a running experiment. |
apex experiments complete | Complete or stop an experiment. |
apex experiments delete | Delete an experiment. |
apex experiments pull | Pull the complete versioned experiment filesystem and its local receipt. |
apex experiments status | Read context, versions, QA, and handover next steps without writing. |
apex experiments plan | Plan experiment filesystem changes. |
apex experiments apply | Apply experiment filesystem changes to Apex; receipt files include submitted and stored digests and the named normalisation list. |
apex experiments screenshots | Force-assign every capture, including control, to its variation server-side, attach before/after QA evidence, and download files with before- / after- prefixes. Use --no-label-pairs for legacy filenames. |
apex experiments qa | Manage experiment QA runs from the CLI. |
apex experiments qa status | Show the latest experiment QA run (creates one only when none exists; reads never change updatedAt). |
apex experiments qa probe | Run saved commerce QA probes, or read evidence with --saved. |
apex experiments qa events | List QA-tagged goal and custom events for a QA session. |
apex experiments qa check | Update one QA checklist item with status, notes, and evidence. |
apex experiments qa notes | Update QA run notes or acceptance criteria summary. |
apex experiments qa approve | Approve QA and move to ready_to_launch; qa reopen returns it to QA. |
apex experiments qa reopen | Reopen QA and clear scheduled launch state. |
apex experiments qa evidence | Attach screenshot jobs or upload typed QA evidence. |
apex results | Import and read past test results. |
apex results import | Inspect, preview, and import CSV or JSON result files. |
apex results list | List imported and native past results, with source filters and pagination. |
apex results get | Read one past result by legacy ID or UUID. |
apex results delete | Permanently remove one imported past result after confirmation. |
apex commerce | Commerce catalog and price tools. |
apex commerce catalog | Look up products for commerce drafts. |
apex commerce catalog search | Search the commerce product catalog. |
apex commerce catalog get | Get one product and its variants. |
apex commerce price | Read and bulk-edit selection prices. |
apex commerce price export | Export effective prices as CSV. |
apex commerce price import | Import price overrides with revision checks. |
apex commerce definition | Read and save the canonical commerce definition. |
apex commerce definition get | Read a commerce.json definition envelope. |
apex commerce definition put | Save a commerce.json definition with revision checking. |
apex push | Push experiment definitions from config to the API. |
apex preview | Open a QA preview URL for an experiment variation; proxy previews return a QA run receipt. |
apex roadmap | Work with approved roadmap ideas and build handoffs. |
apex roadmap approved | List approved roadmap ideas ready to build in Apex. |
apex roadmap handoff | Get apex.roadmap_handoff.v1 JSON: contract, schema_version, item, experiment, instructions, goals, mockups, acceptance_criteria, harness, scoring, source, metadata. |
apex harness | Develop AB Test Harness projects through Apex live QA sessions. |
apex harness init | Create apex.harness.json for a harness folder. |
apex harness dev | Build, upload, preview, and watch a harness folder. |
apex harness publish | Verify, build, upload, and publish a harness artifact. |
apex workspace | Check out, preview, and publish Apex draft workspace files. |
apex workspace checkout | Check out an Operator workspace for one variation. |
apex workspace status | Show changed local workspace files. |
apex workspace dev | Upload one preview version or watch workspace files. |
apex workspace publish | Build and publish changed workspace files back to Apex. |
apex tracking | Create tracking ingestion manifests and QA handoffs. |
apex tracking health | Read the shop's tracking-health checks (install, events, orders linked, currency, exposure, SRM by device, selectors, snippet size, settings changes); exits 0 for pass, 1 for warn or fail, 3 for unknown. |
apex tracking inspect | Create a local tracking manifest from funnel URLs; its output path is relative to the current directory. |
apex tracking plan | Print the implementation plan from a tracking manifest path relative to the current directory. |
apex tracking qa | Print the QA checklist for a tracking manifest path relative to the current directory. |
apex tracking verify | Verify live tracking events, filter by --event-type, and preview event properties. |
apex tracking latency | Compare forced-preview and natural page-load decision latency before launch (init events only, excluding route changes); accepts an experiment ID or key, --days (1–30), and --qa-session. |
apex tracking manifest | Print the shop's tracking manifest, including its tracked forms (key, type, selector, completion rule). |
apex events | Export raw tracking events. |
apex events export | Export every raw event in a window of at most 31 days that does not end in the future, with automatic pagination. |
apex goals | Manage conversion and revenue goals. |
apex goals list | List goals. |
apex goals create | Create a goal. |
apex goals update | Update a goal. |
apex goals test | Dry run a goal URL pattern against traffic. |
apex goals suggest | Suggest goals and funnels from analytics. |
apex funnels | Manage analytics funnels. |
apex funnels list | List funnels. |
apex funnels create | Create a funnel. |
apex funnels update | Replace a funnel's steps. |
apex funnels delete | Delete a funnel. |
apex funnels run | Run funnel analysis. |
apex funnels validate | Validate funnel steps without writing. |
apex environments | Manage runtime environments and domain mappings. |
apex environments list | List runtime environments and mapped domains. |
apex environments set-domain | Map a domain to a runtime environment. |
apex environments remove-domain | Remove a domain mapping. |
apex consent | Manage consent gating. |
apex consent get | Show consent settings. |
apex consent set | Enable and configure consent gating. |
apex consent off | Disable consent gating. |
apex triggers | Manage data-layer triggers and temporary setup capture. |
apex triggers get | Read the shop's runtime triggers. |
apex triggers set | Replace the shop's runtime triggers from a JSON file. |
apex triggers propose | Propose candidate triggers from a discovery report. |
apex triggers apply-recipe | Apply a server-owned trigger recipe. |
apex triggers enable-capture | Enable temporary setup capture. |
apex triggers disable-capture | Disable setup capture and clear its expiry. |
apex project-code | Inspect and safely change shop project code. |
apex project-code get | Read complete code and its opaque version. |
apex project-code diff | Preview a partial JSON change without writing. |
apex project-code set | Create a backup before a version-checked write. |
apex domains | Manage install domains and landing-page domains. |
apex domains list | List install domains. |
apex domains add | Add install domains. |
apex domains remove | Remove install domains. |
apex domains set | Replace install domains. |
apex domains claim | Claim a client hostname for landing pages; prints the CNAME to the Apex edge (--wait checks for up to two minutes). |
apex domains register | Register a new domain on the Drip Cloudflare account after a price confirmation (--confirm-price without a terminal). |
apex domains status | List landing-page domains, or check one hostname now. |
apex domains unclaim | Remove a landing-page domain from Apex; a registered domain stays on the Drip account. |
apex handover | Manage cross-domain identity handover. |
apex handover get | Show cross-domain handover settings. |
apex handover set | Enable cross-domain identity handover. |
apex handover off | Disable cross-domain handover. |
apex handover qa | Check static link/form handover parameter carriage. |
apex analytics | Read shop analytics with a secret API key. |
apex analytics order-journey | Inspect bounded, read-only order evidence and attributed-goal eligibility. |
apex analytics stats | Show dashboard analytics stats. |
apex analytics timeseries | Show analytics timeseries. |
apex analytics traffic | Show traffic sources. |
apex analytics pages | Show page analytics. |
apex analytics geo | Show geography and device analytics. |
apex analytics sessions | Show session analytics. |
apex analytics realtime | Show realtime analytics. |
apex analytics entry-exit | Show entry and exit page analytics. |
apex analytics consent-rate | Estimate analytics consent acceptance from visitor series. |
apex analytics urls | Show storefront URL inventory from pageview analytics. |
apex install | Check Apex storefront installation. |
apex install assess | Assess a public storefront URL and draft an installation assessment and client guide. --shop <id> fills the snippet shop ID; --format selects text, Markdown or JSON. |
apex install kit | Generate a ready-to-send installation guide as Markdown or JSON. |
apex install check | Verify snippet, served config (including purchase triggers), and recent tracking. --shop-id also selects the shop for API requests; otherwise the selected shop or DRIP_SHOP_ID is used. |
apex install steps | Show each installation step (script, consent, test environments, orders, firewall access) with when Apex first and last saw it; exits 6 while a step is waiting. --live also checks the storefront page and firewall access. |
apex flags | Manage flags. |
apex flags list | List flags. |
apex flags get | Get a flag. |
apex flags status | Check whether a flag publication is live at the edge. |
apex flags create | Create a flag. |
apex flags update | Update a flag. |
apex flags update-code | Edit On variant JS/CSS from files with an optimistic version check. |
apex flags rules | Replace or reorder audiences. |
apex flags rules set | Replace the live audience list and archive omissions. |
apex flags rules reorder | Reorder all live audiences with a parent version check. |
apex flags experiences | Manage rule experiences. |
apex flags experiences create | Create a rule experience from JSON. |
apex flags experiences update | Update a rule experience from JSON. |
apex flags experiences delete | Delete an experience when no active or historical rule references it. |
apex flags activate | Activate a flag. |
apex flags pause | Pause a flag. |
apex flags archive | Archive a flag. |
apex backlog | Manage backlog. |
apex backlog list | List backlog items identified as apex.backlog_item.v1. |
apex backlog get | Get a backlog item identified as apex.backlog_item.v1. |
apex backlog create | Create a backlog item. |
apex backlog update | Update a backlog item. |
apex backlog archive | Archive a backlog item with a decline reason. |
apex backlog restore | Restore an archived backlog item. |
apex backlog delete | Permanently delete a backlog item after confirmation. |
apex backlog fields | Manage the shop's own idea fields. |
apex backlog fields list | List the shop's idea fields. |
apex backlog fields create | Add an idea field. |
apex backlog fields update | Update an idea field. |
apex backlog fields archive | Archive an idea field; values already on ideas are kept. |
apex signals | Manage signals. |
apex signals list | List signals; pass --include-archived to include archived signals. |
apex signals get | Get a signal. |
apex signals create | Create a signal. |
apex signals update | Update a signal. |
apex signals delete | Delete or archive a signal. |
apex personalizations | Manage personalizations. |
apex personalizations list | List personalizations. |
apex personalizations get | Get a personalization. |
apex personalizations create | Create a personalization. |
apex personalizations update | Update a personalization. |
apex personalizations activate | Activate a personalization. |
apex personalizations pause | Pause a personalization. |
apex personalizations archive | Archive a personalization. |
apex external-pixels | Manage external pixel integrations. |
apex external-pixels snippet | Generate an external purchase pixel snippet. |
apex assets | Manage assets. |
apex assets list | List assets. |
apex assets get | Get an asset. |
apex assets upload | Upload an asset file. |
apex assets delete | Delete an asset. |
apex landing-pages | Build landing pages with your own tools, then deploy, track and test them with Apex. |
apex landing-pages list | List landing pages. |
apex landing-pages get | Get a landing page. |
apex landing-pages create | Create a landing page to build outside Apex. |
apex landing-pages pull | Pull a landing page into a checkout folder. |
apex landing-pages plan | Show what applying a checkout would change. |
apex landing-pages apply | Apply a checkout as a new version. |
apex landing-pages preview | Print a signed preview link (valid 24 hours). |
apex landing-pages deploy | Deploy a version to the shop's apex-page.com address or a domain it holds. |
apex landing-pages versions | List versions. |
apex landing-pages rollback | Deploy an earlier version to the page's current address. |
apex landing-pages experiment | Create a draft experiment that splits the live page between two versions. |
apex landing-pages open | Print the page's dashboard URL. |
apex pages | Manage pages. |
apex pages list | List pages. |
apex pages create | Create a page; --help lists body keys, pattern shapes contradicting match_type fail with match_type_mismatch unless --literal is passed, and apex schema --json carries the body schema. |
apex pages update | Update a page; --help lists body keys, pattern shapes contradicting match_type fail with match_type_mismatch unless --literal is passed, and apex schema --json carries the body schema. |
apex pages delete | Delete a page. |
apex segments | Manage segments. |
apex segments list | List segments. |
apex segments create | Create a segment. |
apex segments update | Update a segment. |
apex segments delete | Delete a segment. |
apex exclusion-groups | Manage exclusion groups. |
apex exclusion-groups list | List exclusion groups. |
apex exclusion-groups get | Get an exclusion group. |
apex exclusion-groups create | Create an exclusion group; --help shows the request body and apex schema --json exposes it under the command's body key. |
apex exclusion-groups update | Update an exclusion group with the same documented body shapes. |
apex exclusion-groups delete | Delete an exclusion group after confirmation; use --force in non-interactive environments. |
apex exclusion-groups replace-members | Replace exclusion group members. |
apex brand | Print shop brand context for external agents. |
apex targeting | Test experiment targeting. |
apex targeting test | Evaluate experiment URL targeting for a page. |
apex audit-log | Inspect sensitive audit logs. |
apex audit-log list | List audit logs with entity filters and offset pagination. |
apex inbox | Read and send inbox messages. |
apex inbox list | List account or experiment inbox messages. |
apex inbox send | Send an account or experiment inbox message. |
apex inbox mark-read | Mark one inbox channel, or all channels, read. |
apex shops | Manage organization shops. |
apex shops list | List organization shops. |
apex shops get | Get a shop. |
apex shops create | Create a shop. |
apex shops update | Update a shop. |
apex shops doctor | Check shop configuration and the three-state purchase-capture battery against observed analytics. |
apex shops auto-stop | Read or update auto-stop defaults. |
apex shops testing-defaults | Read or update testing defaults. |
apex shops guardian | Read or update guardian defaults. |
apex shops store-profile | Read and review a store profile. |
apex shops store-profile get | Read the store profile. |
apex shops store-profile review-fact | Review a store-profile fact. |
apex shops store-profile review-finding | Review a semantic finding. |
apex shops store-profile start-learning-run | Start a store-profile learning run. |
apex shops shopware | Manage Shopware bindings. |
apex shops shopware prebind | Bind a Shopware store URL before installation. |
apex discover | Read observed tracking shapes and optionally mine a public GTM container. |
apex schema | Print the CLI command, flag, and mandatory-option schema and the bundled experiment filesystem file contract. |
apex skills | Print or install Apex CLI agent skill files. |
apex org | Manage the organization bound to the user credential (apex orgs is an alias). |
apex org get | Get organization details. |
apex org update | Update organization settings. |
apex org members | List organization members. |
apex org invite | Invite an organization member; the default shop role is editor (workspace defaults are internal roles). |
apex org revoke-invite | Revoke an organization invitation. |
apex org set-role | Change an organization member role. |
apex org suspend-member | Suspend an organization member immediately; accepts --reason and requires confirmation unless --force is passed. |
apex org reinstate-member | Reinstate a suspended organization member; requires confirmation unless --force is passed. |
apex org remove-member | Remove an organization member after confirmation. |
apex team | Manage shop-scoped team membership (apex teams is an alias). |
apex team members | List members for --shop or the selected shop. |
apex team invite | Invite a member to --shop or the selected shop as editor or client_viewer (Viewer). --design-approver also lets them sign off designs once they accept (a Viewer with it is a Client approver); it needs store owner or admin rights. |
apex team revoke-invite | Revoke a shop invitation. |
apex team set-role | Change a shop member role to editor or client_viewer (Viewer). |
apex team remove | Remove a shop member after confirmation. |
apex notifications | Manage notification settings. |
apex notifications ready | Configure Ready to launch email recipients and the existing Slack event switch. |
apex notifications ready get | Read email and Slack settings for --shop or the selected shop. |
apex notifications ready email | Choose current shop members to receive ready emails. |
apex notifications ready email set | Replace recipients using --recipients a@example.com,b@example.com. |
apex notifications ready email add | Add current shop members by email. |
apex notifications ready email remove | Remove current shop members by email. |
apex notifications ready email off | Clear the email recipient list. |
apex notifications ready slack | Select the ready event on an existing Slack destination. |
apex notifications ready slack on | Enable the ready event; preserve other events and the destination pause state. |
apex notifications ready slack off | Disable only the ready event. |
apex upgrade | Install the latest Apex CLI (--dry-run prints the command). |
Survey body example
Save this body as survey.json, then use apex surveys create --file survey.json
or apex surveys update <id> --file survey.json. Both commands also accept the
body as inline JSON, @survey.json, or a positional file path. Providing a
positional body together with --file is an error.
{
"name": "Product feedback",
"questions": [{
"type": "single_choice",
"prompt": "What would help you decide?",
"options": [{"label": "More details"}, {"label": "Reviews"}, {"label": "Delivery info"}]
}],
"targeting": {"url": [{"type": "simple", "pattern": "/products/", "matchType": "contains"}]},
"sampling_rate": 0.5,
"frequency_cap": "once_per_visitor",
"card_style": "quiet",
"answer_goal": 100
}On create, name is required. Server defaults: questions: [] (each question's
required: true), targeting: null (all pages/visitors), sampling_rate: 1,
frequency_cap: "once_per_visitor", card_style: "quiet", answer_goal: null,
environment_key: "production", placement: "sdk_page", active_from: null,
and active_to: null. Update accepts a partial body and keeps omitted fields
unchanged. Run apex surveys create --help or apex surveys update --help for
field limits and supported values.
Platform administrator commands
These commands require a platform user API key and are intentionally excluded from the public command index.
| Command | Purpose |
|---|---|
apex admin shops archive <shopId> | Archive a shop and disable Apex delivery; use --force in non-interactive environments. |
apex admin shops restore <shopId> | Restore an archived shop while leaving its runtime kill switch unchanged. |
apex admin shops settings list --shop <uuid-or-domain> | Read every registered per-shop setting, value, override and group with a platform user API key. |
apex admin shops settings get --shop <uuid-or-domain> --key <key> | Read one setting; unknown keys list the available registry keys. |
apex admin shops settings set --shop <uuid-or-domain> --key <key> --value <value> | Resolve and pin the shop, then make an audited write. Booleans accept on/off/true/false; numbers must be finite; null clears nullable settings. Sensitive writes require --confirm; optional --reason and --expected-version preserve audit context and concurrency. |
Analytics reads
apex analytics requires a secret API key with analytics:read (or analytics:*). Publishable keys cannot access shop analytics. Windowed commands accept --days; pages also accepts --limit. All commands support the standard --json envelope.
Related pages
- Install and authenticate the Apex CLI
- Experiment lifecycle commands
- Agent tools: SOS, brand, schema, and skills
Project code
apex project-code get --shop example.com --json
apex project-code diff --file project-code.json --shop example.com --json
apex project-code set --file project-code.json --shop example.com --backup previous-code.json --jsonThe input is a partial projectCode object, for example { "css": "body { color: red; }" }.
Supported fields are enabled (boolean) and css, helperJs, and js (strings or null).
Each code field permits at most 20,000 characters. Omitted fields remain unchanged.
Null or blank code clears that field. Unknown fields and empty objects are rejected.
GET returns complete code, shop identity, and an opaque version. DIFF returns effective
before/after values and changed fields without writing. SET creates a new backup file
with complete previous code, identity, capture time, and the exact version before PATCH.
It never replaces an existing backup. Backup failures prevent the write. An effective
no-op returns unchanged, without a PATCH or backup file.
The backed-up version becomes expectedVersion unchanged. A conflict returns exit 5,
keeps the backup, and does not retry. Read the latest state and preview it before a new
attempt with a new backup path. Authentication uses exit 2; invalid input uses exit 3.
A successful write returns saved, its diff, backup path, current version, writtenVersion,
and precompile result. A failed precompile is a saved-write warning. All warnings remain
in JSON and are also written to stderr. User keys resolve domains or pin UUID context;
shop keys must match the requested identity before any backup or write.
Order journey diagnostics
apex analytics order-journey --platform shopware --order-id <id> --environment production --from <iso> --to <iso> requires a secret or authorized user key with analytics:read. Use --order-number instead of --order-id, never both. The interval is at most 31 days. --include-qa includes QA in eligibility; bots remain excluded.
--json retains the sanitized report, every represented assignment, source availability, coverage and the integration verdict. Exit 0 means the diagnostic was fetched, even when its verdict is fail or inconclusive. Eligibility means only eligible_for_attributed_goal_read, with basis attributed_goal_counts. Final statistical contribution is not_evaluated. Unknown consent, freshness, missing evidence and failed reads never mean zero or healthy. No proof file is saved.
Order journey diagnostics report current, stale, or unknown freshness for each retained receipt and assignment. Present attributed-goal reads identify their evaluated snapshot; they do not establish historical contribution or repair missing producer evidence.
Error recovery and update notices
JSON errors keep the numeric error.code exit code and add error.reason,
error.next_steps (an array of { command, why }), and optional error.request_id.
The request ID comes from x-request-id, falling back to x-vercel-id (the Apex app) and then cf-ray; include it
when reporting an API failure. API-provided reason codes are preserved verbatim.
Otherwise reasons are auth_required, auth_forbidden, shop_context_required, shop_context_mismatch, install_check_failed,
validation_failed, feature_disabled, confirmation_required, conflict, not_found,
rate_limited, network_timeout, network_connect_timeout, network_dns,
network_refused, network_reset, network_tls, network_unknown,
local_file_error, or internal_error.
Inspect next_steps for login, key permissions, shop selection, network settings,
folder validation, disabled-feature contacts, request-field issues, or rate-limit recovery.
Body validation failures carry per-field issues in error.details.issues; disabled
features name their shop setting. Steps are suggestions, never automatic
approval to retry a write. Confirmation errors retain error.details.retry.
Human output prints recovery steps as Next: lines on stderr and request IDs
on the error line. Trigger commands now follow the same exit codes as every other
command: authentication failures exit 2 (previously 4), invalid local input exits
3 (previously 2), and other API failures follow their HTTP status (validation
3, conflict 5, anything else 1). The TRIGGERS_AUTH, TRIGGERS_CONFIG_ABSENT and TRIGGERS_NO_DATA
verdict prefixes are unchanged, so scripts can key on them instead of exit codes.
Every JSON envelope may carry update and warnings. The update object includes
current, latest, optional minimum, required, breaking, command, and
notes_url; warnings use { code, message }. The exact install command is
npm install -g @drip-apex/apex-cli@latest, and apex upgrade runs it (--dry-run
only prints it). Set APEX_NPM_BIN to choose the npm binary.
The npm latest version is cached for 24 hours (failed lookups for one hour). Server
latest/minimum policy is cached for seven days, so offline commands still enforce a
known floor. APEX_NO_UPDATE_CHECK=1 disables the npm lookup and optional update
notice, but never hides a required server-floor upgrade.
Tracking verification limits
apex tracking verify reads at most 200 of the newest events from a window of at most 7 days. When the limit is reached, truncated is true and totals describe that sample only. The response includes the exact from, to, minutes, and limit window.
Commerce catalog
apex commerce catalog search [query] [--cursor <cursor>] [--limit <1-10>]apex commerce catalog get <handle> [--cursor <cursor>]apex commerce catalog get --product-id <id> [--cursor <cursor>]
Use --json for the complete API envelope. Human output lists variant GID, title, SKU, price, cost (unknown when absent), and price-test exclusion.
Commerce results output
Human-readable experiment results show a Profit per visitor (CM1) section
for commerce tests and checkout-owned tests with attributed orders. Null money prints as -; degraded reads
print their reason and never imply measured zeroes. JSON output preserves the
API's commerce_results field unchanged, including pending_days, plane,
decision_grade, and confidence_visible.
Checkout-owned tests measure orders from visitors who saw the checkout message and receive the supplementary CM1 section when they have attributed orders. Other non-commerce tests return commerce_results: null. An unavailable supplementary section on a checkout-owned test does not mark the analytics as degraded.
Import past test results
apex results import --file <path> uploads one or more CSV or JSON files, inspects their columns, and prints a deterministic preview before confirmation. Use --dry-run to stop after preview and --yes for non-interactive confirmation. --json preserves full learning text and returns the preview envelope for dry runs or merged { imported, skipped, test_results } totals after import.
Read past test results
apex results list [--source import|native|all] [--limit <n>] [--all] [--json] lists past results for the selected shop (default source all, page size 50, maximum 200). Use --all to follow every page. The table shows legacy ID (or UUID), title, outcome, metric, lift, sample size, dates, and source. Empty lists print No test results.
apex results get <legacy-id-or-id> [--json] opens a result by legacy ID, test key, or UUID, including its full learning, confidence, dates, page, and device. Missing results exit with code 1 through the existing API failure path. Both commands use shop or user keys with experiments:read and verify each row belongs to the selected shop. Imports show their source name and original date range, falling back to import time; native results show source apex and creation time.
apex results delete <legacy-id-or-id> [--yes] [--json] permanently removes one imported result with experiments:write. It first reads and previews the title, outcome, dates, source, and legacy ID. Native results are refused locally (exit 3). Confirm the prompt or pass --yes; non-TTY callers without --yes receive exit 4 with the exact rerun hint. Removed results cannot be restored in Apex; the full record remains in the audit log. JSON output wraps the API { data } response and verifies the echoed shop.
JSON uses the standard CLI envelope: its data contains { data, pagination } for lists (merged rows and final pagination with --all) or { data: result } for a single result. Invalid --source or --limit exits 3 before an HTTP request.
Asset delivery URLs
apex assets upload <file> returns delivery_url; embed that permanent URL in variation code. The public_url is a signed read URL for the API caller and expires after 300 seconds. Never embed it. Delivery is anonymous once the referencing experiment or snippet is published, and resolves through the owning shop's dashboard session or a QA preview before that. Only the absolute https form is recognized as an owned reference; protocol-relative or http forms are not granted at publication.
See Commerce prices for CSV export, import, and revision semantics.