Get Bounce Shield threshold
Retrieve the Bounce Shield Monitor bounce rate threshold configured for a campaign. The response returns an integer representing the percentage threshold, for example 10 for 10%, or null if no threshold is set for the campaign.
Request
Endpoint
GET https://api.woodpecker.co/rest/v2/campaigns/{campaign_id}/bounce_shield/threshold
Headers
x-api-key: {YOUR_API_KEY}
For details on how to authenticate your requests, please see the authentication guide.
Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
campaign_id | Yes | integer | Campaign ID |
Request samples
Retrieve the threshold
- cURL
- Python
- Java
- Node.js
- PHP
curl --request GET \
--url "https://api.woodpecker.co/rest/v2/campaigns/{campaign_id}/bounce_shield/threshold" \
--header "x-api-key: {YOUR_API_KEY}"
import requests
def get_bounce_shield_threshold(campaign_id):
url = f"https://api.woodpecker.co/rest/v2/campaigns/{campaign_id}/bounce_shield/threshold"
headers = {
"x-api-key": "{YOUR_API_KEY}"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
print(response.json())
else:
print("GET failed with status:", response.status_code, response.text)
if __name__ == "__main__":
get_bounce_shield_threshold(123)
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) {
getBounceShieldThreshold(123);
}
public static void getBounceShieldThreshold(int campaignId) {
try {
String url = "https://api.woodpecker.co/rest/v2/campaigns/" + campaignId + "/bounce_shield/threshold";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI(url))
.header("x-api-key", API_KEY)
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 200) {
System.out.println(response.body());
} else {
System.err.println("GET request failed: " + response.statusCode());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
const axios = require("axios");
async function getBounceShieldThreshold(campaignId) {
const url = `https://api.woodpecker.co/rest/v2/campaigns/${campaignId}/bounce_shield/threshold`;
const headers = {
"x-api-key": "{YOUR_API_KEY}"
};
try {
const response = await axios.get(url, { headers });
if (response.status === 200) {
console.log(response.data);
} else {
console.error("GET failed with status:", response.status);
}
} catch (error) {
console.error("Request error:", error.response?.status || error.message);
}
}
getBounceShieldThreshold(123);
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
$client = new Client([
'base_uri' => 'https://api.woodpecker.co/rest/v2/',
'headers' => [
'x-api-key' => getenv('WOODPECKER_API_KEY'),
],
]);
$campaignId = '{campaign_id}';
try {
$response = $client->get("campaigns/{$campaignId}/bounce_shield/threshold");
echo $response->getStatusCode(), "\n";
echo $response->getBody(), "\n";
} catch (RequestException $e) {
echo "Error: ", $e->getMessage(), "\n";
if ($e->hasResponse()) {
echo $e->getResponse()->getBody(), "\n";
}
}
Response
Response examples
- 200
- 401
- 404
- 500
Request processed successfully.
{
"bounce_rate_threshold": 12
}
Body schema
| Field | Type | Description |
|---|---|---|
bounce_rate_threshold | integer/null | Bounce rate threshold percentage configured for the campaign. Returns null when no threshold is set |
An issue with authorization. Please review the authentication 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 does not exist, was deleted, or belongs to another account.
{
"code": "CAMPAIGN_NOT_EXIST",
"message": "Campaign not found",
"details": null
}
Body schema
| Field | Type | Description |
|---|---|---|
code | string | Error code |
message | string | Error message |
details | string/null | Additional information |
An unknown error occurred while retrieving the threshold. Please try again later.
{
"code": "UNKNOWN",
"message": "Unknown error during campaign call",
"details": null
}
Body schema
| Field | Type | Description |
|---|---|---|
code | string | Error code |
message | string | Error message |
details | string/null | Additional information |