Pause campaign
This request will change the campaign status to PAUSED
and will halt any further contact with prospects until the status is changed back to RUNNING
. To resume a campaign, use the /run endpoint.
Request
Endpoint
POST https://api.woodpecker.co/rest/v2/campaigns/{campaign_id}/pause
Headers
x-api-key: {YOUR_API_KEY}
For details on how to authenticate your requests, please see the authentication guide.
Request sample
Pause a campaign
- cURL
- Java
- Node.js
curl --request POST \
--url "https://api.woodpecker.co/rest/v2/campaigns/{campaign_id}/pause" \
--header "x-api-key: {YOUR_API_KEY}"
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.io.IOException;
import java.net.URISyntaxException;
HttpClient client = HttpClient.newHttpClient();
long campaignId = 12345;
String apiKey = "YOUR_API_KEY";
String url = "https://api.woodpecker.co/rest/v2/campaigns/" + campaignId + "/pause";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("x-api-key", apiKey)
.POST(HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
const pauseCampaign = async (campaignId, apiKey) => {
const url = `https://api.woodpecker.co/rest/v2/campaigns/${campaignId}/pause`;
const response = await fetch(url, {
method: "POST",
headers: {
"x-api-key": apiKey,
},
});
return await response.json();
};
try {
const result = await pauseCampaign(12345, "YOUR_API_KEY");
console.log(result);
} catch (error) {
console.error("Error:", error);
}
Response
Response examples
- 200
- 400
- 401
- 404
- 500
The campaign has been paused.
Status: 200
Body: none
Invalid request or malformed syntax. Please review the request
{
"title": "Bad Request",
"status": 400,
"detail": "Value of campaign_id is incorrect.",
"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 |
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 doesn't exist.
{
"code": "CAMPAIGN_NOT_EXIST",
"message": "Campaign 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 |
Unknown error, please try again later.
{
"type": "UNKNOWN",
"message": "Unknown error during pause campaign call",
"details": null
}