Purge Stored Contacts

Permanently purge stored contacts and cached avatars from the Wawp cloud database for a specific instance or the entire user account.

POST
https://api.wawp.net/v2/contacts/purge?access_token=YOUR_ACCESS_TOKEN&delete_r2_avatars=true&instance_id=123456789&scope=instance&session_name=default

Authentication Required

Login to swap the placeholders with your real Instance ID and Access Token.

Log In
Test /v2/contacts/purge endpoint
POSTDELETEGET

No query parameters required

This endpoint doesn't expect data in the URL.

Best practices

  • Use scope='instance' to clear contacts for a single WhatsApp session, or scope='all' to clear the entire account.

Purging Cloud-Stored Contacts

The /v2/contacts/purge endpoint deletes synced contact records from the Wawp cloud database (wawp_contacts) and optionally removes cached avatar images from R2 cloud storage. It does not delete contacts from your mobile phone's address book.

Request Parameters

Configure the parameters required to interact with this endpoint. All query and body arguments are listed below with their details.

Query Parameters & Request Body

Supported in URL Query String or JSON Body
string

Your unique WhatsApp Instance ID.

Example:
string

Your API Access Token.

Example:
string—

Optional session name (alternative to instance_id).

Example:
string—

Purge scope: 'instance' (only this session) or 'all' (entire account).

Default: instanceExample:
boolean—

Whether to also delete cached contact profile pictures from cloud storage.

Default: trueExample:

Build with AI using Wawp MCP

MCP READY

Connect Wawp API directly to Cursor, Windsurf, or Claude Desktop. Let AI write, test, and execute your WhatsApp integration code automatically!

How to Connect

Request Samples

Use these ready-to-go code snippets to integrate our API into your project quickly and efficiently. Choose your preferred language and library.

1const baseUrl = "https://api.wawp.net";
2const endpoint = "/v2/contacts/purge";
3const params = new URLSearchParams({
4 "instance_id": "123456789",
5 "access_token": "YOUR_ACCESS_TOKEN"
6}).toString();
7const body = {
8 "session_name": "default",
9 "scope": "instance",
10 "delete_r2_avatars": "true"
11};
12
13fetch(`${baseUrl}${endpoint}${params ? '?' + params : ''}`, {
14 method: "POST",
15 headers: { "Content-Type": "application/json" },
16 body: JSON.stringify(body)
17})
18 .then(async (response) => {
19 if (response.ok) {
20 const data = await response.json();
21 console.log("Success:", data);
22 return data;
23 }
24
25 // Error Handling
26 if (response.status === 400) {
27 console.error("Error 400: Bad Request - Missing Required Parameter(s)");
28 }
29 if (response.status === 401) {
30 console.error("Error 401: Unauthorized - Invalid or Missing Access Token");
31 }
32 if (response.status === 404) {
33 console.error("Error 404: Not Found - Session Does Not Exist");
34 }
35 if (response.status === 500) {
36 console.error("Error 500: Internal Server Error - Unexpected Failure");
37 }
38
39 const errorText = await response.text();
40 console.error(`Error ${response.status}: ${errorText}`);
41 })
42 .catch((error) => console.error("Network Error:", error));
Interactive Samples
Ln 42, Col 1javascript

Expected Responses

Explore all possible responses and outcomes from the server. We have documented each status code with data examples to make success and error handling easier.

Contacts purged successfully
application/json
string *
string *
number *
string *

Example

{
"status": "success",
"message": "Contacts for instance 123456789 have been purged successfully.",
"deleted_count": 240,
"scope": "instance"
}
Bad Request - Missing Required Parameter(s)
Unauthorized - Invalid or Missing Access Token
Not Found - Session Does Not Exist
Internal Server Error - Unexpected Failure
Previous TopicGet Stored Contacts (CRM Database)
Next TopicGet Contact Info

Command Palette

Search for a command to run...