/api/qmail/db/contacts/delete
GET DELETERemove a contact from your QMail address book by serial number.
GET /api/qmail/db/contacts/delete?serial_number={serial_number}
Description
The /api/qmail/db/contacts/delete endpoint permanently removes a contact from your address book. The contact is identified by its CloudCoin serial number. If no contact exists with the given serial number, the API returns a 404 error.
Permanent Deletion
This operation cannot be undone. Once a contact is deleted, you will need to add them again using the contacts/add endpoint if you want to restore them.
Parameters
Send parameters as form data or query string values:
| Parameter | Type | Required | Description |
|---|---|---|---|
serial_number |
string/int | Yes | CloudCoin serial number of the contact to delete (1 - 16,777,216). |
Response
Returns a JSON object indicating the result of the delete operation.
Success Response Properties
success
boolean
Always
true on success.
message
string
"Contact deleted".
serial_number
integer
The serial number of the deleted contact.
Example Success Response
{
"success": true,
"message": "Contact deleted",
"serial_number": 1234567
}
Error Response Properties
error
boolean
Always
true on error.
message
string
Human-readable error description.
code
integer
HTTP status code repeated in the JSON body.
detail
string
Optional internal result string returned on some server errors.
Example Error Response (400 Bad Request)
{
"error": true,
"message": "Missing required parameter: serial_number",
"code": 400
}
Example Error Response (404 Not Found)
{
"error": true,
"message": "Contact not found",
"code": 404
}
Try It Out
Examples
cURL
# Delete a contact by serial number (GET — easy browser/devtool testing)
curl "http://localhost:8081/api/qmail/db/contacts/delete?serial_number=1234567"
# Delete a contact by serial number (canonical DELETE)
curl -X DELETE "http://localhost:8081/api/qmail/db/contacts/delete?serial_number=1234567"
# Using form data (canonical DELETE)
curl -X DELETE "http://localhost:8081/api/qmail/db/contacts/delete" \
-d "serial_number=1234567"
JavaScript (fetch)
const API_BASE = 'http://localhost:8081/api';
async function deleteContact(serialNumber) {
try {
const params = new URLSearchParams({
serial_number: serialNumber
});
const response = await fetch(
`${API_BASE}/qmail/db/contacts/delete?${params}`,
{ method: 'DELETE' }
);
const result = await response.json();
if (result.success) {
console.log('Contact deleted successfully!');
console.log('Serial Number:', result.serial_number);
} else if (response.status === 404) {
console.error('Contact not found:', result.message);
} else {
console.error('Failed to delete contact:', result.message);
}
} catch (error) {
console.error('Error deleting contact:', error);
}
}
deleteContact('1234567');
Python
import requests
API_BASE = 'http://localhost:8081/api'
def delete_contact(serial_number):
try:
params = {'serial_number': serial_number}
response = requests.delete(
f'{API_BASE}/qmail/db/contacts/delete',
params=params
)
result = response.json()
if result.get('success'):
print('Contact deleted successfully!')
print(f'Serial Number: {result["serial_number"]}')
elif response.status_code == 404:
print(f'Contact not found: {result["message"]}')
else:
print(f'Failed to delete contact: {result["message"]}')
except Exception as e:
print(f'Error deleting contact: {str(e)}')
delete_contact('1234567')