> ## Documentation Index
> Fetch the complete documentation index at: https://docs.contactship.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Contact

> Delete a contact from the organization

This endpoint allows you to permanently delete a contact from your organization's database. This action cannot be undone, so use it with caution.

## Use Cases

* Remove obsolete or duplicate contact records
* Comply with data retention policies
* Honor user requests to delete their personal information
* Clean up your contact database

## Path Parameters

<ParamField path="contactId" type="string" required>
  The unique identifier of the contact to delete. This is a UUID string that was generated when the contact was created.
</ParamField>

## Headers

<ParamField header="x-api-key" type="string" required>
  Your API key for authentication. You can find this in your dashboard under API settings.
</ParamField>

## Response

<ResponseField name="status code" type="number">
  204 on success (No Content)
</ResponseField>

<Info>
  This endpoint returns a 204 No Content response on successful deletion, with no response body.
</Info>

## Error Codes

* `400 Bad Request` - Invalid contact ID format
* `401 Unauthorized` - Invalid or missing API key
* `404 Not Found` - Contact not found
* `500 Internal Server Error` - Server-side error

## Code Examples

<RequestExample>
  ```bash cURL Example theme={null}
  # 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"
  ```

  ```javascript JavaScript Example theme={null}
  // 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 === 204) {
        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');
    }
  });
  ```

  ```python Python Example theme={null}
  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 == 204:
          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")
  ```
</RequestExample>

<ResponseExample>
  ```json Example Response theme={null}
  // 204 No Content - No response body
  ```
</ResponseExample>

## Notes and Best Practices

* Always confirm with the user before permanently 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
