lads_archive_campaign
LinkedIn Ads write medium risk
Part of the LinkedIn Campaign Manager Agent.
What it does
Archives a campaign by PATCHing status -> ARCHIVED, marking it inactive and hidden in the UI while preserving all configuration and historical performance data (reversible by un-archiving to PAUSED/ACTIVE). Commit logs the reason. Accuracy notes: ARCHIVED stops serving but is NOT deletion — data remains; use lads_delete_campaign for permanent removal. Archiving is for cleanup/decluttering completed campaigns. 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 ARCHIVED 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 to declutter the account by hiding finished or unneeded campaigns while keeping their data and the ability to restore them later. Preview to confirm the right campaign. If the user wants permanent removal instead, use lads_delete_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 archiving (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
Confirmation required; log the reason. Archiving hides and stops the campaign but preserves data (not deletion). Strict per-account isolation.
Reminder
Confirm and log; archiving is reversible and preserves history (it is not a delete).
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
INVALID_ARGUMENT | Invalid transition to ARCHIVED from the current state (e.g., CANCELED/REMOVED). | Check current status via lads_get_campaign; surface the platform 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; PATCH is idempotent. | yes |
Edge cases
- Already ARCHIVED -> success with changed: false and the current status; no preview_id is issued and nothing is sent.
- ARCHIVED preserves config + performance history; un-archive to PAUSED/ACTIVE to restore.
- Distinct from deletion — clarify to the user it can be undone.
- CANCELED/REMOVED can't be archived -> INVALID_ARGUMENT.
- PATCH idempotent (204) -> safe retry after transient 5xx.