# IAS Serial Key Manager — CLI Reference - **Plugin slug:** `ias-serial-keys` - **Version:** 1.1.15 - **CLI namespace:** `wp ias serial-keys` - **Tier:** Commercial (licence required) - **Summary:** Serial keys & redemption codes: list, generate, import/export, assign, redeem, revoke and delete. This reference is generated from the WP-CLI command docblocks (do not edit by hand). Every command accepts `--format=`. Every mutating command supports `--dry-run` (resolve + audit, no writes) and `--yes` (skip the confirmation prompt); destructive commands additionally prompt unless `--yes` is given, and any bulk-delete command refuses to run without an explicit scope argument — a required `--filter` on the record-deletion commands, or another mandatory bound such as `--max-age-days` — rather than defaulting to delete-all. **Authentication / trust model:** these commands run under WP-CLI, whose trust boundary is shell access — there is no separate capability check. Irreversible commands (flagged below) are guarded by `--dry-run`, a confirmation prompt (or `--yes`), a required scope argument on any bulk delete (a `--filter`, or another mandatory bound such as `--max-age-days`), and a before-state entry in the suite-wide CLI audit log. ## Commands ### `wp ias serial-keys assign` Assign a free-pool key to a specific customer (support tool). The serial-key schema binds a customer to a key through a WooCommerce order, so this creates a $0 order for the customer, binds the named key to it via IAS\SerialKeys\Database::assign_key(), and completes the order (mirroring the redemption fulfillment path). Completing the order fires the normal fulfillment hooks (key-delivery email, and licence/ownership grants if the product is otherwise configured). **Synopsis:** `wp ias serial-keys assign [--dry-run] [--yes] [--format=]` **Options:** - `` — The serial key string (must currently be in the available pool). - `` — Customer reference — numeric WP user ID or email. - `[--dry-run]` — Report what would happen without creating an order or assigning the key. - `[--yes]` — Skip the confirmation prompt. - `[--format=]` — Output format. **Examples:** ```bash wp ias serial-keys assign IAS-ABCD-1234-EFGH customer@example.com ``` **Related:** `wp ias serial-keys delete`, `wp ias serial-keys delete-bulk`, `wp ias serial-keys export`, `wp ias serial-keys generate`, `wp ias serial-keys import`, `wp ias serial-keys inspect`, `wp ias serial-keys list`, `wp ias serial-keys redeem` --- ### `wp ias serial-keys delete` > **⚠ Irreversible — `--dry-run` first.** This command permanently destroys data or applies a terminal state that cannot be undone from the CLI. Preview the exact effect with `--dry-run`, then re-run with `--yes` once you are certain. Permanently delete a single serial key. Resolves the key via IAS\SerialKeys\Database::get_key_by_serial() and removes the row with IAS\SerialKeys\Database::delete_key(). This is NON-RECOVERABLE: the key string and any pool/assignment record for it are gone. Use `revoke` instead if you want to retire a key while keeping the row for audit/history. Note on --keep-audit: serial keys keep NO per-key history table, so this flag has no database effect — there is no per-key log to retain. It is accepted for cross-plugin CLI parity and recorded in the audit context for transparency. **Synopsis:** `wp ias serial-keys delete [--keep-audit] [--dry-run] [--yes] [--format=]` **Options:** - `` — The serial key string to delete. - `[--keep-audit]` — No-op for serial keys (there is no per-key log to retain); recorded for cross-plugin CLI parity only. - `[--dry-run]` — Report what would be deleted without removing anything. - `[--yes]` — Skip the confirmation prompt. - `[--format=]` — Output format. **Returns:** A JSON object: { dry_run, action, key, product_id, status, keep_audit, deleted }. **Examples:** ```bash wp ias serial-keys delete IAS-ABCD-1234-EFGH --dry-run wp ias serial-keys delete IAS-ABCD-1234-EFGH --yes ``` **Related:** `wp ias serial-keys assign`, `wp ias serial-keys delete-bulk`, `wp ias serial-keys export`, `wp ias serial-keys generate`, `wp ias serial-keys import`, `wp ias serial-keys inspect`, `wp ias serial-keys list`, `wp ias serial-keys redeem` --- ### `wp ias serial-keys delete-bulk` > **⚠ Irreversible — `--dry-run` first.** This command permanently destroys data or applies a terminal state that cannot be undone from the CLI. Preview the exact effect with `--dry-run`, then re-run with `--yes` once you are certain. Permanently delete every serial key matching a JSON filter (bulk, destructive). This is a bulk destructive operation and therefore REQUIRES an explicit --filter= selector; it refuses to run without one and has no `--all` escape hatch. The filter is resolved with IAS\SerialKeys\Database::get_keys() and each matched row is removed with IAS\SerialKeys\Database::delete_key(). NON-RECOVERABLE. A single run processes at most 1000 keys. The true (uncapped) match count is reported as `total_matching` and, when it exceeds the per-run cap, `capped` is true and a warning is emitted — re-run the command after each batch to delete the remainder. **Synopsis:** `wp ias serial-keys delete-bulk --filter= [--dry-run] [--yes] [--format=]` **Options:** - `--filter=` — Required JSON selector. Recognised keys: product_id (int), status (available|sold|revoked), search (substring of the key). Must select at least one constraint. - `[--dry-run]` — Report how many keys match without deleting anything. - `[--yes]` — Skip the confirmation prompt. - `[--format=]` — Output format. **Returns:** A JSON object: { dry_run, action, filter, total_matching, matched, capped, deleted }. **Examples:** ```bash wp ias serial-keys delete-bulk --filter='{"status":"revoked"}' --dry-run wp ias serial-keys delete-bulk --filter='{"product_id":42,"status":"available"}' --yes ``` **Related:** `wp ias serial-keys assign`, `wp ias serial-keys delete`, `wp ias serial-keys export`, `wp ias serial-keys generate`, `wp ias serial-keys import`, `wp ias serial-keys inspect`, `wp ias serial-keys list`, `wp ias serial-keys redeem` --- ### `wp ias serial-keys export` Export serial keys to a CSV or JSON file. Reads keys via IAS\SerialKeys\Database::get_keys() (optionally filtered) and writes them to . This mutates the filesystem (not the database) but is audited so exports are traceable. Honours the licensed `ias_sk_can_export` gate for the actual write. CSV cells are neutralised against spreadsheet formula injection, matching the admin export. NOTE: unlike every other command, `export --format` selects the on-disk FILE format (csv|json) — not the suite-wide `--format=` output-rendering flag. The dry-run summary is always emitted as JSON. **Synopsis:** `wp ias serial-keys export --file= [--format=] [--product=] [--status=] [--dry-run]` **Options:** - `--file=` — Destination file path. - `[--format=]` — Export FILE format (csv or json) — see the note above; this overloads the conventional output-format flag. - `[--product=]` — Restrict to one product (numeric ID or SKU). - `[--status=]` — Restrict to keys with this status (available or sold). - `[--dry-run]` — Report how many keys would be exported without writing the file. **Examples:** ```bash wp ias serial-keys export --file=keys.csv --product=42 wp ias serial-keys export --file=keys.json --format=json --status=available ``` **Related:** `wp ias serial-keys assign`, `wp ias serial-keys delete`, `wp ias serial-keys delete-bulk`, `wp ias serial-keys generate`, `wp ias serial-keys import`, `wp ias serial-keys inspect`, `wp ias serial-keys list`, `wp ias serial-keys redeem` --- ### `wp ias serial-keys generate` Bulk-generate serial keys for a product. Mirrors the admin Generate screen: delegates to IAS\SerialKeys\Key_Generator::generate_keys(), which enforces the licensed batch ceiling (ias_sk_max_batch_size), pattern/prefix formatting and uniqueness. Keys land in the unassigned pool. With --customer the freshly generated keys are then assigned to that customer via a $0 order (mirroring the redemption fulfillment path). **Synopsis:** `wp ias serial-keys generate [--customer=] [--prefix=] [--dry-run] [--yes] [--format=]` **Options:** - `` — Product reference — numeric ID or SKU. - `` — Number of keys to generate. - `[--customer=]` — Assign the generated keys to this customer (numeric WP user ID or email). - `[--prefix=]` — Override the key prefix for this batch. - `[--dry-run]` — Validate and report what would be generated without writing anything. - `[--yes]` — Skip the confirmation prompt. - `[--format=]` — Output format. **Examples:** ```bash wp ias serial-keys generate 42 100 wp ias serial-keys generate SKU-PRO 5 --customer=customer@example.com --dry-run ``` **Related:** `wp ias serial-keys assign`, `wp ias serial-keys delete`, `wp ias serial-keys delete-bulk`, `wp ias serial-keys export`, `wp ias serial-keys import`, `wp ias serial-keys inspect`, `wp ias serial-keys list`, `wp ias serial-keys redeem` --- ### `wp ias serial-keys import` Import serial keys for a product from a CSV/TXT file (one key per line). Additive importer: delegates to IAS\SerialKeys\Database::import_keys(), which inserts new keys and skips any that already exist. The underlying importer is insert-only — there is no in-place update path — so --update-existing only affects how pre-existing keys are reported, not stored (existing keys are always skipped). Honours the licensed `ias_sk_can_import` gate for the actual write; the dry-run preview is always available. **Synopsis:** `wp ias serial-keys import --product= --file= [--update-existing] [--dry-run] [--format=]` **Options:** - `--product=` — Product the keys belong to (numeric ID or SKU). - `--file=` — Path to the import file (one key per line; first CSV column is used). - `[--update-existing]` — Reserved. The importer is insert-only, so existing keys are still skipped; this flag is recorded for traceability only. - `[--dry-run]` — Parse and classify each row (new vs already-present) without importing. - `[--format=]` — Output format. **Examples:** ```bash wp ias serial-keys import --product=42 --file=keys.csv --dry-run wp ias serial-keys import --product=42 --file=keys.csv ``` **Related:** `wp ias serial-keys assign`, `wp ias serial-keys delete`, `wp ias serial-keys delete-bulk`, `wp ias serial-keys export`, `wp ias serial-keys generate`, `wp ias serial-keys inspect`, `wp ias serial-keys list`, `wp ias serial-keys redeem` --- ### `wp ias serial-keys inspect` Report the plugin slug, version and CLI environment. **Synopsis:** `wp ias serial-keys inspect [--format=]` **Options:** - `[--format=]` — Output format. **Examples:** ```bash wp ias serial-keys inspect ``` **Related:** `wp ias serial-keys assign`, `wp ias serial-keys delete`, `wp ias serial-keys delete-bulk`, `wp ias serial-keys export`, `wp ias serial-keys generate`, `wp ias serial-keys import`, `wp ias serial-keys list`, `wp ias serial-keys redeem` --- ### `wp ias serial-keys list` List serial keys with optional filters and pagination. **Synopsis:** `wp ias serial-keys list [--customer=] [--status=] [--product=] [--page=] [--per-page=] [--format=]` **Options:** - `[--customer=]` — Restrict to keys assigned to this customer (numeric WP user ID or email). - `[--status=]` — Filter by status. - `[--product=]` — Filter by product (numeric ID or SKU). - `[--page=]` — Page of results (1-based). - `[--per-page=]` — Results per page (capped at 1000). - `[--format=]` — Output format. **Examples:** ```bash wp ias serial-keys list --status=available --product=42 wp ias serial-keys list --customer=customer@example.com --format=json ``` **Related:** `wp ias serial-keys assign`, `wp ias serial-keys delete`, `wp ias serial-keys delete-bulk`, `wp ias serial-keys export`, `wp ias serial-keys generate`, `wp ias serial-keys import`, `wp ias serial-keys inspect`, `wp ias serial-keys redeem` --- ### `wp ias serial-keys redeem` Redeem a redemption code on a customer's behalf (support tool). Delegates to IAS\SerialKeys\Database::redeem_code(), the exact two-phase atomic path the storefront uses: it claims the code, creates a $0 order, assigns a key, and completes the order. **Synopsis:** `wp ias serial-keys redeem [--customer=] [--email=] [--dry-run] [--yes] [--format=]` **Options:** - `` — The redemption code. - `[--customer=]` — Redeem on behalf of this account (numeric WP user ID or email). Omit to redeem as a guest, in which case --email is required. - `[--email=]` — Guest email for the redemption when no --customer account is given. - `[--dry-run]` — Validate the code without redeeming it. - `[--yes]` — Skip the confirmation prompt. - `[--format=]` — Output format. **Examples:** ```bash wp ias serial-keys redeem WELCOME-2026 --customer=42 wp ias serial-keys redeem WELCOME-2026 --email=guest@example.com --dry-run ``` **Related:** `wp ias serial-keys assign`, `wp ias serial-keys delete`, `wp ias serial-keys delete-bulk`, `wp ias serial-keys export`, `wp ias serial-keys generate`, `wp ias serial-keys import`, `wp ias serial-keys inspect`, `wp ias serial-keys list` --- ### `wp ias serial-keys revoke` > **⚠ Irreversible — `--dry-run` first.** This command permanently destroys data or applies a terminal state that cannot be undone from the CLI. Preview the exact effect with `--dry-run`, then re-run with `--yes` once you are certain. Retire a serial key by setting a terminal `revoked` status. Serial keys natively use only the `available` and `sold` statuses, and there is no public status setter, so this updates the row directly to a terminal `revoked` status. A revoked key is neither resold (the available pool query filters status='available') nor validated as sold, but the row is preserved (unlike `delete`). The product's available-pool cache is invalidated so the change takes effect immediately. **Synopsis:** `wp ias serial-keys revoke [--reason=] [--dry-run] [--yes] [--format=]` **Options:** - `` — The serial key string to revoke. - `[--reason=]` — Optional free-text reason, recorded in the audit context. - `[--dry-run]` — Report what would be revoked without changing anything. - `[--yes]` — Skip the confirmation prompt. - `[--format=]` — Output format. **Returns:** A JSON object: { dry_run, action, key, product_id, status_before, status_after, reason, revoked, already_applied }. `already_applied` is true when the key was already revoked (a no-op re-run); `revoked` is then false. **Examples:** ```bash wp ias serial-keys revoke IAS-ABCD-1234-EFGH --dry-run wp ias serial-keys revoke IAS-ABCD-1234-EFGH --reason="chargeback" --yes ``` **Related:** `wp ias serial-keys assign`, `wp ias serial-keys delete`, `wp ias serial-keys delete-bulk`, `wp ias serial-keys export`, `wp ias serial-keys generate`, `wp ias serial-keys import`, `wp ias serial-keys inspect`, `wp ias serial-keys list` --- ### `wp ias serial-keys show` Show the full state of one serial key. **Synopsis:** `wp ias serial-keys show [--format=]` **Options:** - `` — The serial key string. - `[--format=]` — Output format. **Examples:** ```bash wp ias serial-keys show IAS-ABCD-1234-EFGH --format=json ``` **Related:** `wp ias serial-keys assign`, `wp ias serial-keys delete`, `wp ias serial-keys delete-bulk`, `wp ias serial-keys export`, `wp ias serial-keys generate`, `wp ias serial-keys import`, `wp ias serial-keys inspect`, `wp ias serial-keys list` --- ### `wp ias serial-keys stock` Report unassigned / assigned key counts per product. **Synopsis:** `wp ias serial-keys stock [--product=] [--format=]` **Options:** - `[--product=]` — Restrict the report to one product (numeric ID or SKU). - `[--format=]` — Output format. **Examples:** ```bash wp ias serial-keys stock wp ias serial-keys stock --product=42 --format=json ``` **Related:** `wp ias serial-keys assign`, `wp ias serial-keys delete`, `wp ias serial-keys delete-bulk`, `wp ias serial-keys export`, `wp ias serial-keys generate`, `wp ias serial-keys import`, `wp ias serial-keys inspect`, `wp ias serial-keys list` --- ### `wp ias serial-keys whose` Resolve a serial key to its owning order and customer. **Synopsis:** `wp ias serial-keys whose [--format=]` **Options:** - `` — The serial key string. - `[--format=]` — Output format. **Examples:** ```bash wp ias serial-keys whose IAS-ABCD-1234-EFGH ``` **Related:** `wp ias serial-keys assign`, `wp ias serial-keys delete`, `wp ias serial-keys delete-bulk`, `wp ias serial-keys export`, `wp ias serial-keys generate`, `wp ias serial-keys import`, `wp ias serial-keys inspect`, `wp ias serial-keys list` ---