# Delete a specific contact by ID
curl -X DELETE "https://api.contactship.ai/v1/contacts/c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6" \
-H "x-api-key: your-api-key"
// Using Fetch API to delete a contact
const deleteContact = async (contactId) => {
try {
const response = await fetch(`https://api.contactship.ai/v1/contacts/${contactId}`, {
method: 'DELETE',
headers: {
'x-api-key': 'your-api-key'
}
});
if (response.status === 200) {
console.log('Contact deleted successfully');
return true;
} else if (response.status === 404) {
console.error('Contact not found');
return false;
} else {
const errorData = await response.json().catch(() => null);
throw new Error(`HTTP error! Status: ${response.status}, Message: ${errorData?.message || 'Unknown error'}`);
}
} catch (error) {
console.error('Error deleting contact:', error);
return false;
}
};
// Call the function with a contact ID
const contactId = 'c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6';
deleteContact(contactId).then(success => {
if (success) {
// Update your UI or take next steps after successful deletion
console.log('Contact has been removed from the system');
}
});
import requests
# Replace with your actual API key
api_key = "your-api-key"
# Base URL for the API
base_url = "https://api.contactship.ai"
# Contact ID to delete
contact_id = "c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6"
# Headers
headers = {
"x-api-key": api_key
}
# Function to delete a contact
def delete_contact(contact_id):
# Make the DELETE request
response = requests.delete(
f"{base_url}/v1/contacts/{contact_id}",
headers=headers
)
# Check if the request was successful
if response.status_code == 200:
print(f"Contact {contact_id} deleted successfully")
return True
elif response.status_code == 404:
print("Error: Contact not found")
return False
else:
print(f"Error: {response.status_code}")
try:
print(response.json())
except:
print(response.text)
return False
# Delete the contact
delete_successful = delete_contact(contact_id)
# Take action based on the result
if delete_successful:
# Update your application's state or UI
print("Contact has been removed from the database")
{ "statusCode": 200, "data": true }
Contactos
Delete Contact
Delete a contact from the organization
DELETE
/
v1
/
contacts
/
{contactId}
# Delete a specific contact by ID
curl -X DELETE "https://api.contactship.ai/v1/contacts/c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6" \
-H "x-api-key: your-api-key"
// Using Fetch API to delete a contact
const deleteContact = async (contactId) => {
try {
const response = await fetch(`https://api.contactship.ai/v1/contacts/${contactId}`, {
method: 'DELETE',
headers: {
'x-api-key': 'your-api-key'
}
});
if (response.status === 200) {
console.log('Contact deleted successfully');
return true;
} else if (response.status === 404) {
console.error('Contact not found');
return false;
} else {
const errorData = await response.json().catch(() => null);
throw new Error(`HTTP error! Status: ${response.status}, Message: ${errorData?.message || 'Unknown error'}`);
}
} catch (error) {
console.error('Error deleting contact:', error);
return false;
}
};
// Call the function with a contact ID
const contactId = 'c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6';
deleteContact(contactId).then(success => {
if (success) {
// Update your UI or take next steps after successful deletion
console.log('Contact has been removed from the system');
}
});
import requests
# Replace with your actual API key
api_key = "your-api-key"
# Base URL for the API
base_url = "https://api.contactship.ai"
# Contact ID to delete
contact_id = "c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6"
# Headers
headers = {
"x-api-key": api_key
}
# Function to delete a contact
def delete_contact(contact_id):
# Make the DELETE request
response = requests.delete(
f"{base_url}/v1/contacts/{contact_id}",
headers=headers
)
# Check if the request was successful
if response.status_code == 200:
print(f"Contact {contact_id} deleted successfully")
return True
elif response.status_code == 404:
print("Error: Contact not found")
return False
else:
print(f"Error: {response.status_code}")
try:
print(response.json())
except:
print(response.text)
return False
# Delete the contact
delete_successful = delete_contact(contact_id)
# Take action based on the result
if delete_successful:
# Update your application's state or UI
print("Contact has been removed from the database")
{ "statusCode": 200, "data": true }
This endpoint allows you to delete a contact from your organization. Review the contact ID before making the request.
Use Cases
- Remove obsolete or duplicate contact records
- Comply with data retention policies
- Clean up your contact database
Path Parameters
string
requerido
The unique identifier of the contact to delete. This is a UUID string that was generated when the contact was created.
Headers
string
requerido
Your API key for authentication. You can find this in your dashboard under API settings.
Response
number
200 on success.
boolean
true when deletion is accepted.Error Codes
400 Bad Request- Invalid contact ID format401 Unauthorized- Invalid or missing API key404 Not Found- Contact not found500 Internal Server Error- Server-side error
Code Examples
# Delete a specific contact by ID
curl -X DELETE "https://api.contactship.ai/v1/contacts/c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6" \
-H "x-api-key: your-api-key"
// Using Fetch API to delete a contact
const deleteContact = async (contactId) => {
try {
const response = await fetch(`https://api.contactship.ai/v1/contacts/${contactId}`, {
method: 'DELETE',
headers: {
'x-api-key': 'your-api-key'
}
});
if (response.status === 200) {
console.log('Contact deleted successfully');
return true;
} else if (response.status === 404) {
console.error('Contact not found');
return false;
} else {
const errorData = await response.json().catch(() => null);
throw new Error(`HTTP error! Status: ${response.status}, Message: ${errorData?.message || 'Unknown error'}`);
}
} catch (error) {
console.error('Error deleting contact:', error);
return false;
}
};
// Call the function with a contact ID
const contactId = 'c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6';
deleteContact(contactId).then(success => {
if (success) {
// Update your UI or take next steps after successful deletion
console.log('Contact has been removed from the system');
}
});
import requests
# Replace with your actual API key
api_key = "your-api-key"
# Base URL for the API
base_url = "https://api.contactship.ai"
# Contact ID to delete
contact_id = "c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6"
# Headers
headers = {
"x-api-key": api_key
}
# Function to delete a contact
def delete_contact(contact_id):
# Make the DELETE request
response = requests.delete(
f"{base_url}/v1/contacts/{contact_id}",
headers=headers
)
# Check if the request was successful
if response.status_code == 200:
print(f"Contact {contact_id} deleted successfully")
return True
elif response.status_code == 404:
print("Error: Contact not found")
return False
else:
print(f"Error: {response.status_code}")
try:
print(response.json())
except:
print(response.text)
return False
# Delete the contact
delete_successful = delete_contact(contact_id)
# Take action based on the result
if delete_successful:
# Update your application's state or UI
print("Contact has been removed from the database")
{ "statusCode": 200, "data": true }
Notes and Best Practices
- Confirm the contact ID before deleting a contact
- Consider implementing a “soft delete” in your application by flagging contacts as inactive instead of permanently deleting them
- Keep audit logs of deleted contacts for compliance purposes
- Ensure you have proper error handling for failed deletion attempts
- If you’re deleting contacts as part of a bulk operation, implement rate limiting to avoid API throttling
