CLICommandsl4 recommendations

l4 rec accept

l4 rec accept records an accept decision on a savings recommendation. It moves the recommendation out of the Available bucket and into Pending, stamps who accepted it and when, and leaves it ready to execute. It does not start the change.

l4 rec accept <id> [flags]

rec is an alias for recommendations, so l4 recommendations accept and l4 recs accept do the same thing.

What it changes

The command posts to /api/v1/recommendations/{id}/decision with {"decision": "accepted"}. On the recommendation:

  • saving_acceptance becomes accepted
  • saving_accepted_by and saving_accepted_at are stamped from the credential
  • the raw status stays pending, so the dashboard shows the recommendation under Pending rather than Available
  • if a member had requested execution and left the recommendation awaiting approval, the accept clears that flag and records you as the approver

Nothing is applied in your cloud account. Use l4 rec execute for that.

Flags

FlagDescription
--yes / -ySkip the confirmation prompt

Global flags (--json, --jq, --template, --quiet, --token, --api) apply. See CLI overview.

Confirmation

By default the command prompts before sending:

Accept recommendation REC-1234? [y/N]:

Anything other than y or yes aborts, prints Aborted., and exits 0 without calling the API. When stdout is not a TTY (piped output, CI), the prompt is skipped and the write proceeds, so a scripted run never blocks on input that will not arrive. Pass --yes to skip it in an interactive shell too.

Requires a read-write key

The endpoint requires the read-write scope. l4 auth login mints a read-only key, so create a Read & write key in the dashboard under Settings > API Keys and pass it explicitly. See CLI authentication.

Each invocation sends its own Idempotency-Key, which lets the API discard a duplicate delivery of the same request. A deliberate re-run is a new request: it re-stamps the same decision fields and adds another entry to the recommendation's audit timeline.

Examples

l4 rec accept REC-1234
l4 rec accept REC-1234 --yes
l4 rec accept REC-1234 --json
LEVELFOUR_TOKEN=$L4_RW_KEY l4 rec accept REC-1234 --yes --quiet

Accept the available recommendations above a savings threshold, one page at a time:

l4 rec list --status available --page-size 100 --jq '.data.data.items[] | select(.monthly_savings > 500) | .recommendation_id' \
  | xargs -I{} l4 rec accept {} --yes

Output

Default output is a success line plus the fields the API returned:

Recommendation REC-1234 accepted
By    api-key:00000000-0000-0000-0000-000000000000
At    2026-08-22

An API key stamps saving_accepted_by as api-key:<key id>, the UUID of the key that made the call. The same decision made in the dashboard stamps the signed-in user's email instead.

With --json, the API envelope is printed as-is:

.success
.data.recommendation_id
.data.saving_acceptance          # "accepted"
.data.saving_accepted_by
.data.saving_accepted_at
.data.status                     # "pending"
.timestamp

Errors

ExitSymptomCause
4Authentication requiredNo token resolvable; run l4 auth login or set LEVELFOUR_TOKEN
1401 authentication failedToken revoked, expired, or from the wrong environment
1403 permission deniedThe key has the read scope, or your role lacks org:savings:execute
1404No recommendation with that id in this organization