Delete campaign step
This endpoint lets you delete a campaign step. You can delete EMAIL
steps that haven't processed any prospects and are not the first EMAIL
step. Once a step is deleted, it cannot be restored.
Only campaigns with a status of DRAFT
or EDITED
can be updated. To change the campaign status to EDITED
use the /make_editable endpoint.
Request
Endpoint
DELETE https://api.woodpecker.co/rest/v2/campaigns/{campaign_id}/steps/{step_id}
You can fetch the step_id
using the GET /campaigns structure endpoint.
Headers
x-api-key: {YOUR_API_KEY}
For details on how to authenticate your requests, please see the authentication guide.
Request sample
Delete a campaign step
- cURL
- Python
- Java
- Node.js
curl --request DELETE \
--url "https://api.woodpecker.co/rest/v2/campaigns/{campaign_id}/steps/{step_id}" \
--header "x-api-key: {YOUR_API_KEY}"
import requests
def deleteCampaignStep(campaign_id, step_id):
url = f"https://api.woodpecker.co/rest/v2/campaigns/{campaign_id}/steps/{step_id}"
headers = {
"x-api-key": "{YOUR_API_KEY}"
}
response = requests.delete(url, headers=headers)
if response.status_code == 200:
print("DELETE successful:", response.json())
else:
print("DELETE failed with status:", response.status_code)
if __name__ == "__main__":
deleteCampaignStep(123, 456) # Example IDs
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class WoodpeckerApiClient {
private static final String API_KEY = "{YOUR_API_KEY}";
public static void main(String[] args) {
int campaignId = 123; // Example campaign ID
int stepId = 456; // Example step ID
deleteCampaignStep(campaignId, stepId);
}
public static void deleteCampaignStep(int campaignId, int stepId) {
try {
String url = "https://api.woodpecker.co/rest/v2/campaigns/" + campaignId + "/steps/" + stepId;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(url))
.header("x-api-key", API_KEY)
.DELETE()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 200) {
System.out.println("DELETE response: " + response.body());
} else {
System.err.println("DELETE request failed: " + response.statusCode());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
const axios = require("axios");
async function deleteCampaignStep(campaignId, stepId) {
const url = `https://api.woodpecker.co/rest/v2/campaigns/${campaignId}/steps/${stepId}`;
const headers = {
"x-api-key": "{YOUR_API_KEY}"
};
try {
const response = await axios.delete(url, { headers: headers });
if (response.status === 200) {
console.log("DELETE successful:", response.data);
} else {
console.error("DELETE failed with status:", response.status);
}
} catch (error) {
console.error("Request error:", error.response?.status || error.message);
}
}
deleteCampaignStep(123, 456); // Example IDs
Response
Response examples
- 200
- 401
- 404
- 409
- 500
The campaign has been deleted. A full campaign payload will be returned.
An issue with authorization. Please review the authorization guide
{
"title": "Unauthorized",
"status": 401,
"detail": "Invalid api key",
"timestamp": "2025-03-05 17:57:00"
}
Body schema
Field | Type | Description |
---|---|---|
title | string | A short title describing the error |
status | integer | The HTTP status code |
detail | string | A detailed message explaining the error |
timestamp | string | The timestamp when the error occurred, YYYY-MM-DD HH:MM:SS UTC |
The requested campaign or step doesn't exist.
{
"code": "CAMPAIGN_NOT_EXIST" | "BRANCH_NOT_FOUND",
"message": "Campaign not found" | "Step not found",
"details": null
}
Body schema
Field | Type | Description |
---|---|---|
code | string | Error code |
message | string | Descriptive error message |
details | string/null | Additional information. Currently always null |
The step has already processed some prospects, is the first EMAIL
step, is a START
step, or the campaign is in a status that prohibits edits.
{
"code": "BRANCH_NOT_DELETABLE" | "NOT_EDITABLE_STATUS",
"message": "Step is not allowed to be deleted" | "The campaign must be in DRAFT or EDITED status to be updated",
"details": null
}
Body schema
Field | Type | Description |
---|---|---|
code | string | Error code |
message | string | Descriptive error message |
details | string/null | Additional information. Currently always null |
An unknown error while deleting the campaign. Please try again later.
{
"type": "UNKNOWN",
"message": "Unknown error during delete campaign step call",
"details": null
}
Body schema
Field | Type | Description |
---|---|---|
code | string | Error code |
message | string | Descriptive error message |
details | string/null | Additional information. Currently always null |