Delete client's prospects
Remove prospects from a specific company within your agency account.
This endpoint allows you to DELETE
prospects from the company, updating the company's prospect database accordingly.
It provides a response with the deletion request ID and the number of prospects removed.
This functionality is essential for managing the prospects associated with a company and ensuring accurate records.
For further actions, such as adding, refer to the related /companies endpoints.
Request
Endpoint
POST https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/prospects/delete
Headers
x-api-key: {YOUR_API_KEY}
Content-Type: application/json
For details on how to authenticate your requests, please see the authentication guide.
Parameters
Parameter | Required | Description |
---|---|---|
company_id | Yes | Company ID |
company_id parameter is required
Body
The request body is a JSON object with the property `type' holding types of prospects to delete within the company ID.
{
"type": "ALL"
}
Request body is required
This action is irreversible!
Request sample
Remove prospects from the specific client's account
- cURL
- Python
- Java
- Node.js
curl --request POST \
--url "https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/prospects/delete" \
--header "x-api-key: {YOUR_API_KEY}" \
--header "Content-Type: application/json" \
--data '{
"type": "ALL"
}'
import requests
def delete_prospects(company_id):
url = f"https://api.woodpecker.co/rest/v2/agency/companies/{company_id}/prospects/delete"
headers = {
"x-api-key": "{YOUR_API_KEY}",
"Content-Type": "application/json"
}
data = {
"type": "ALL"
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 202:
return response.json()
else:
raise Exception(f"POST request failed: {response.status_code}, {response.text}")
if __name__ == "__main__":
try:
company_id = 123 # Example company ID
data = delete_prospects(company_id)
print("POST response:", data)
except Exception as e:
print("Error:", e)
public class WoodpeckerApiClient {
private static final String API_KEY = "{YOUR_API_KEY}";
public static void main(String[] args) {
int companyId = 123; // Example company ID
deleteProspects(companyId);
}
public static void deleteProspects(int companyId) {
try {
String url = "https://api.woodpecker.co/rest/v2/agency/companies/" + companyId + "/prospects/delete";
String jsonData = "{ \"type\": \"ALL\" }";
java.net.http.HttpClient client = java.net.http.HttpClient.newHttpClient();
java.net.http.HttpRequest request = java.net.http.HttpRequest.newBuilder()
.uri(new java.net.URI(url))
.header("x-api-key", API_KEY)
.header("Content-Type", "application/json")
.POST(java.net.http.HttpRequest.BodyPublishers.ofString(jsonData))
.build();
java.net.http.HttpResponse<String> response = client.send(request, java.net.http.HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 202) {
System.out.println("POST response: " + response.body());
} else {
System.err.println("POST request failed: " + response.statusCode());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
const axios = require('axios');
async function deleteProspects(companyId) {
const url = `https://api.woodpecker.co/rest/v2/agency/companies/${companyId}/prospects/delete`;
const headers = {
'x-api-key': '{YOUR_API_KEY}',
'Content-Type': 'application/json'
};
const data = { type: "ALL" };
try {
const response = await axios.post(url, data, { headers });
if (response.status === 202) {
console.log('POST response:', response.data);
} else {
console.error('POST request failed:', response.status);
}
} catch (error) {
console.error('POST request failed:', error.response ? error.response.status : error.message);
}
}
(async () => {
const companyId = 123; // Example company ID
await deleteProspects(companyId);
})();
Response
Response examples
- 202
- 400
- 401
- 404
- 500
{
"deletion_request_id": 0,
"count": 0
}
Body schema
Field | Type | Description |
---|---|---|
deletion_request_id | integer | Request ID |
count | integer | Number of removed prospects |
Invalid request parameters or malformed request syntax.
{
"title": "Bad request",
"status": 400,
"detail": "string",
"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 |
Please review the request URL.
{
"title": "Not Found",
"status": 404,
"detail": "Requested resource does not exist",
"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 |
Unknown error, please try again later
{
"title": "Internal server error",
"status": 500,
"detail": "An unexpected error has occurred. Please try again later.",
"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 |