l4 rec execute
l4 rec execute requests execution of a savings recommendation that has already been accepted. It records the implementation method and marks the rollout in progress. The rollout itself runs server-side.
l4 rec execute <id> [flags]rec and recs are aliases for recommendations.
l4 rec accept. The one-click methods apply the change through the connected Automated Savings grant, and connecting that grant happens in the dashboard, not from the CLI.What it changes
The command posts to /api/v1/recommendations/audit/execution-requests with the recommendation id and the chosen implementation_method. On the recommendation:
implementation_statusbecomesin_progress, whilestatusstayspending, so the dashboard keeps the recommendation under Pending with the Implementation column liveimplementation_methodis set to the value you passed- the dashboard's Triggered Via card records the method plus
saving_accepted_by, the identity that accepted the recommendation rather than the credential that ran this command
Flags
| Flag | Description |
|---|---|
--method <m> | one-click, iac, one-click-plus-iac, or manual. Defaults to one-click |
--yes / -y | Skip the confirmation prompt |
l4 rejects an unrecognized --method locally, before it sends anything. The API enforces the same set.
Global flags apply. See CLI overview.
Methods
| Method | Meaning |
|---|---|
one-click | LevelFour applies the change in your cloud account using the connected Automated Savings grant |
iac | LevelFour opens a pull request against your infrastructure-as-code repository |
one-click-plus-iac | Applies the change and then opens the pull request. Needs both a connected grant and a bound repository |
manual | You apply the change yourself. Records the method without triggering an automated rollout |
Confirmation
By default the command prompts before sending, and the prompt names the method:
Execute recommendation REC-1234 using the one-click method? [y/N]:Anything other than y or yes aborts, prints Aborted., and exits 0 without calling the API. Pass --yes to skip the prompt in an interactive shell.
--yes, and a stdout that is not a TTY. Check the recommendation id and the method before you put this in a pipeline or a CI job.Requires a read-write key
The endpoint requires the read-write scope, and l4 auth login mints a read-only key. See CLI authentication for how to create one that has it.
Re-running it
Each invocation sends its own Idempotency-Key, which lets the API discard a duplicate delivery of the same request. Re-running execute does not start a second rollout either: the server only sets implementation_status when it is not already set.
Examples
l4 rec execute REC-1234
l4 rec execute REC-1234 --method iac
l4 rec execute REC-1234 --method manual --yes
l4 rec execute REC-1234 --jsonAccept and execute in one step, with no prompt at either stage:
l4 rec accept REC-1234 --yes && l4 rec execute REC-1234 --method one-click --yesOutput
Default output is a success line plus the fields the API returned:
Execution requested for recommendation REC-1234
Status processing
Method one-clickWith --json the whole API envelope is printed. The fields it carries:
.success
.data.recommendation_id
.data.status # "processing"
.data.implementation_method
.timestampExecution requested for recommendation REC-1234 is the proof the request landed. The rollout runs server-side from there. Track it with l4 recommendations view <id>, or in the dashboard under Status & Logs.Errors
| Exit | Symptom | Cause |
|---|---|---|
4 | Authentication required | No token resolvable; run l4 auth login or set LEVELFOUR_TOKEN |
1 | invalid --method | The value is not one of the methods the API accepts |
1 | 401 authentication failed | Token revoked, expired, or from the wrong environment |
1 | 403 permission denied | The key has the read scope. The must-be-accepted-first gate applies to dashboard roles, not to API keys |
1 | 404 | No recommendation with that id in this organization |
Related
l4 rec accept: accept before executingl4 rec reject: reject insteadl4 recommendations: list and view recommendations- CLI authentication: read versus read-write keys
- Automated Savings: the grant the
one-clickmethods use - Webhooks: optimization lifecycle events