Skip to content

Delete Contact

DELETE /api/contacts/:id

Section titled “ /api/contacts/”

Permanently deletes a contact from the database.

ParameterTypeRequiredDescription
idstringYesUnique ID of the contact to delete
{
"message": "Contact successfully deleted",
"deletedContactId": "contact-uuid-123"
}
CodeDescription
400Invalid contact ID
401Missing or invalid API Key
404Contact not found
409Contact cannot be deleted (has pending messages)
500Internal server error
Ventana de terminal
curl -X DELETE "https://app.sendme123.com/api/contacts/contact-uuid-123" \
-H "api-key: your-api-key-here" \
-H "Content-Type: application/json"
const safeDeleteContact = async (contactId) => {
try {
// First verify the contact exists
const contact = await axios.get(`https://app.sendme123.com/api/contacts/${contactId}`, {
headers: { 'api-key': 'your-api-key-here' }
});
console.log(`Deleting contact: ${contact.data.name} ${contact.data.lastName || ''}`);
// Proceed with deletion
const response = await axios.delete(`https://app.sendme123.com/api/contacts/${contactId}`, {
headers: {
'api-key': 'your-api-key-here',
'Content-Type': 'application/json'
}
});
console.log('Contact successfully deleted:', response.data);
return response.data;
} catch (error) {
if (error.response?.status === 404) {
throw new Error('Contact not found');
}
console.error('Error deleting contact:', error.response?.data || error.message);
throw error;
}
};
const deleteMutlipleContacts = async (contactIds) => {
const results = [];
for (const contactId of contactIds) {
try {
const response = await axios.delete(`https://app.sendme123.com/api/contacts/${contactId}`, {
headers: {
'api-key': 'your-api-key-here',
'Content-Type': 'application/json'
}
});
results.push({
contactId,
success: true,
data: response.data
});
} catch (error) {
results.push({
contactId,
success: false,
error: error.response?.data || error.message
});
}
}
return results;
};
  • Irreversible action: Deleted contacts cannot be recovered
  • Message dependencies: If the contact has pending or recent messages, deletion might be prevented
  • Cascade effects: Associated message history might be affected
  • Best practice: Consider deactivating contacts instead of deleting them for better data integrity