Update, Delete & Branch

ReferenceUpdated June 14, 2026

Update, Delete & Branch

Manage existing campaigns: rename them, delete them (with a data-preserving cascade), and branch a new campaign from an existing one at a chosen step.

All endpoints require the campaigns:write scope and operate only on campaigns in the API key's workspace.


Rename a campaign

PATCH /api/v1/campaigns/:id · scope campaigns:write

Updates a campaign's display name.

Path parameters

ParameterTypeDescription
idstring (UUID)Campaign ID.

Request body

FieldTypeRequiredDescription
namestringYesNew campaign name (1–200 characters, trimmed).

Example request

curl -X PATCH "https://app.machfive.io/api/v1/campaigns/CAMPAIGN_ID" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Q2 Enterprise Outreach" }'

Response (200 OK)

{
  "id": "uuid",
  "name": "Q2 Enterprise Outreach",
  "created_at": "2025-01-15T12:00:00.000Z"
}

Error responses

StatusErrorDescription
400BAD_REQUESTMissing or invalid name.
401UNAUTHORIZEDMissing or invalid API key.
403FORBIDDENKey missing the campaigns:write scope.
404NOT_FOUNDCampaign not found or not in this workspace.
500INTERNAL_ERRORServer error.

Delete a campaign

DELETE /api/v1/campaigns/:id · scope campaigns:write

Deletes a campaign and its regenerable artifacts (configuration, system prompts, asset selections, previews, generated documents, conversations, etc.).

Your lead data is preserved. Lists that belonged to this campaign are detached and retained — their rows and uploaded/processed CSV files in storage are not deleted. After deletion, those lists have campaign_id: null and remain accessible via the Lists endpoints (and exportable). Credit usage history is also retained for auditing.

In-flight guard: If any list in the campaign is currently processing, the request returns 409 CONFLICT. Wait until those lists complete or fail, then retry.

Path parameters

ParameterTypeDescription
idstring (UUID)Campaign ID.

Example request

curl -X DELETE "https://app.machfive.io/api/v1/campaigns/CAMPAIGN_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response (200 OK)

{ "id": "uuid", "deleted": true }

Error responses

StatusErrorDescription
401UNAUTHORIZEDMissing or invalid API key.
403FORBIDDENKey missing the campaigns:write scope.
404NOT_FOUNDCampaign not found or not in this workspace.
409CONFLICTA list in this campaign is currently processing. detail.processing_status shows the current status.
500INTERNAL_ERRORServer error.

Branch a campaign

POST /api/v1/campaigns/:id/branch · scope campaigns:write

Creates a new campaign that reuses the source campaign's configuration up to a chosen step. Everything from the branch step onward is left for you to (re)configure on the new campaign. This is synchronous and does not consume credits.

Path parameters

ParameterTypeDescription
idstring (UUID)Source campaign ID to branch from.

Headers

HeaderRequiredDescription
AuthorizationYesBearer <API_KEY> (or X-API-Key).
Content-TypeYesapplication/json.
Idempotency-KeyNoA unique key to safely retry. A replayed key returns the originally created campaign id; a failed run releases the key so you can retry.

Request body

FieldTypeRequiredDescription
namestringYesName for the new (branched) campaign (1–200 characters).
branch_from_stepstringYesThe step to branch from. One of: target-audience, social-proof, lead-magnets, risk-reversal, value-propositions. Config from earlier steps is copied; this step and later are left open.
target_audienceobjectConditionalRequired only when branch_from_step is target-audience. The target-audience segment to seed the branch with (see below).
is_custom_target_audiencebooleanNoWhether target_audience is a custom (user-defined) segment. Default false.

target_audience object:

FieldTypeRequiredDescription
idstring (UUID)ConditionalRequired when is_custom_target_audience is false (selecting an existing segment). Omit for a custom segment. Branching from target-audience without an id for a non-custom segment returns 422 UNPROCESSABLE.
segment_namestringYesName of the target segment.
industry_verticalstringNoIndustry / vertical.
company_sizestringNoCompany size descriptor.
annual_revenuestringNoAnnual revenue descriptor.
geographic_locationstringNoGeographic location.
decision_makersstring | string[]NoDecision-maker title(s).
additional_detailsstringNoExtra context.

Example request

curl -X POST "https://app.machfive.io/api/v1/campaigns/CAMPAIGN_ID/branch" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme – Mid-Market Variant",
    "branch_from_step": "social-proof"
  }'

Response (201 Created)

{
  "id": "new-campaign-uuid",
  "source_campaign_id": "uuid"
}
FieldTypeDescription
idstring (UUID)The newly created campaign.
source_campaign_idstring (UUID)The campaign it was branched from.

Error responses

StatusErrorDescription
400BAD_REQUESTInvalid body (bad branch_from_step, or missing target_audience when branching from target-audience).
401UNAUTHORIZEDMissing or invalid API key.
403FORBIDDENKey missing the campaigns:write scope.
404NOT_FOUNDSource campaign not found or not in this workspace.
409CONFLICTAn Idempotency-Key was reused with a different body, or a request with the same key is still in flight.
422UNPROCESSABLENo active configuration found to branch from, or branching from target-audience without a target_audience.id for a non-custom segment.
500INTERNAL_ERRORServer error.