lads_delete_campaign
LinkedIn Ads write high risk
Part of the LinkedIn Campaign Manager Agent.
What it does
Deletes a campaign. A DRAFT campaign is deleted outright (HTTP DELETE); any other campaign is soft-deleted (status -> PENDING_DELETION); a campaign with spend becomes read-only REMOVED but keeps its billing/performance history. The preview includes a warning that the delete cannot be undone; commit is irreversible and logs the reason. Accuracy notes: this is permanent; campaigns with spend never truly vanish (REMOVED keeps history); prefer lads_archive_campaign when the user only wants to hide a campaign. Two-phase (parity with Google, ADR-028/029): the first call (no preview_id) reads the campaign from LinkedIn (a nonexistent id is refused), builds the request locally and returns a preview_id — nothing is changed on LinkedIn (a campaign already PENDING_DELETION or REMOVED gets changed: false and no preview_id); re-call with that preview_id and identical arguments to COMMIT (single-use, 30-min; a changed/forged/replayed token fails closed).
When to use it
Use only when the user explicitly wants permanent removal. Determine status first: DRAFT -> hard DELETE; otherwise PENDING_DELETION (soft, kept as REMOVED for billing). Preview the irreversibility and capture a reason. If they only want it out of view, recommend lads_archive_campaign.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
account_id | string | yes | Numeric ad account ID (digits only). |
campaign_id | string | yes | Numeric campaign ID (digits only). |
reason | string | no | Reason for deletion (audit log). |
preview_id | string | no | Omit it to preview: nothing is applied, and the call returns a preview_id bound to this exact request. Pass it only after the user approves that preview in a later message, with the same arguments (leave out validate_only, and add any confirmation flag the preview names). Single-use, expires in 30 minutes; changed arguments need a fresh preview. |
Safeguards
A change in two steps. The first call previews and changes nothing; Claude shows you the preview and applies it only after you approve, within 30 minutes and with the same arguments. Every applied change goes to the audit log. How changes are approved.
Policy
Irreversible: require explicit confirmation and log the reason. Use HTTP DELETE only for DRAFT; non-DRAFT must transition to PENDING_DELETION (never DELETE a serving campaign). Strict per-account isolation.
Reminder
Confirm and log; deletion is permanent (campaigns with spend remain as REMOVED for billing); consider archiving instead if reversibility matters.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
INVALID_ARGUMENT | Tried to HTTP DELETE a non-DRAFT campaign (must use PENDING_DELETION) or invalid status transition. | Read status via lads_get_campaign; route DRAFT->DELETE else PATCH PENDING_DELETION; surface the message. | no |
PERMISSION_DENIED | Missing rw_ads / insufficient role / out of scope (403). | Confirm CAMPAIGN_MANAGER+ and rw_ads. | no |
CUSTOMER_NOT_FOUND | Campaign/account not found or out of scope (404). | Verify IDs. | no |
PREVIEW_EXPIRED | preview_id unknown/expired. | Re-preview before committing. | no |
TOKEN_REVOKED | Token expired/revoked (401). | needs_reauth — refresh once and retry; else reconnect. | yes |
RESOURCE_EXHAUSTED | Rate/quota limit (429). | Backoff 5/10/20s cap 60s. | yes |
PLATFORM_UNAVAILABLE | LinkedIn 5xx. | Retry with backoff; both ops are idempotent. | yes |
Edge cases
- DRAFT -> immediate hard DELETE; non-DRAFT -> PENDING_DELETION (then REMOVED if it has spend data).
- REMOVED campaigns remain fetchable for billing/performance — deletion is not erasure.
- Already PENDING_DELETION/REMOVED -> success with changed: false and the current status; no preview_id is issued and nothing is sent.
- Recommend lads_archive_campaign when the user wants reversibility.
- Both DELETE and PATCH return 204 and are idempotent -> safe retry after transient 5xx.
- Status changed after preview -> re-preview (hard-vs-soft routing may flip).