Delete a campaign
DELETE/campaigns/:id
Deletes a campaign and every creative in it, and returns the campaign with deletedAt set. Nothing is destroyed: POST /campaigns/{campaignId}/undelete restores the campaign and the creatives that went with it, and ?showDeleted=true still reads it. A campaign holding a creative that is QUEUED or GENERATING cannot be deleted yet. Deleting spends and refunds no credits and never cancels a run.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 409
- 412
- 429
- 503
OK. The deleted campaign, deletedAt set (or the replay of an earlier delete with this key).
Response Headers
Strong hash of this response body.
Bad Request. The Idempotency-Key header is malformed (INVALID_IDEMPOTENCY_KEY).
Unauthorized. Missing, malformed, unknown, revoked, or expired bearer token — or the token owner no longer holds the required entitlement (ENTITLEMENT_LOST). A uniform problem body is returned with a distinct code; no owner/condition detail (no-leak).
Forbidden. The key lacks the campaigns:write scope (API_TOKEN_SCOPE_DENIED), or the account's plan does not include campaigns (TIER_REQUIRED).
Not Found (CAMPAIGN_NOT_FOUND). No campaign with this id belongs to the key's account — a campaign of another account returns this SAME uniform 404 (no-leak).
Conflict. The campaign holds creatives that are QUEUED or GENERATING (CAMPAIGN_NOT_DELETABLE, how many in generatingCount), or is still being created (the same code, reason still_being_created); or its previous change is still finishing (CAMPAIGN_CASCADE_PENDING, retry after Retry-After); or a request under this key is still in progress (IDEMPOTENCY_IN_PROGRESS, retry after Retry-After); or the key was already used for a different request (IDEMPOTENCY_KEY_REUSED).
Response Headers
Seconds to wait before retrying — on an in-progress or cascade-pending conflict only.
Precondition Failed (PRECONDITION_FAILED). If-Match no longer matches the campaign. Nothing was changed; read it again and retry.
Too Many Requests. The per-token sliding window of 60 requests/minute was exceeded. The body is express-rate-limit's DEFAULT plain-text message (NOT the JSON problem+json envelope).
Response Headers
IETF draft-7 rate-limit policy/state (limit, remaining, reset).
Seconds to wait before retrying.
Service Unavailable (WRITES_PAUSED). Writes are paused for this account right now — nothing was changed and the Idempotency-Key was not consumed, so retry the SAME request after Retry-After. Reads are unaffected.
Response Headers
Seconds to wait before retrying.