# Delete a contact

> Remove a contact from your project.

`DELETE https://api-connect.nxiom.com/api/v1/emails/contacts/{contactId}`

## Authorization

Requires `email.full_access`.

## Path parameters

| Field | Type | Description |
| --- | --- | --- |
| `contactId` | string · required | The contact's ID, starting with `con_`. |

## Request

### cURL

```shell
curl -X DELETE "https://api-connect.nxiom.com/api/v1/emails/contacts/YOUR_CONTACT_ID" \
  -H "Authorization: Bearer $NEXIOM_API_KEY"
```

### Node.js

```typescript
import { NexiomConnect } from '@nexiom/connect';

const apiKey = process.env.NEXIOM_API_KEY;
if (!apiKey) throw new Error('Set NEXIOM_API_KEY');

const nexiom = new NexiomConnect({ apiKey });

const { error } = await nexiom.contacts.delete('YOUR_CONTACT_ID');

if (error) throw new Error(`${error.code}: ${error.message}`);
console.log('Contact deleted');
```

### PHP

```php
<?php

use Nexiom\Connect\NexiomConnect;

$apiKey = getenv('NEXIOM_API_KEY');
if (!$apiKey) {
    throw new RuntimeException('Set NEXIOM_API_KEY');
}

$nexiom = new NexiomConnect($apiKey);

$nexiom->contacts->delete('YOUR_CONTACT_ID');
```

## Response

HTTP `200` with `success: true`. Deleting a contact sends a [`contact.deleted`](/docs/webhooks/contacts/deleted) webhook event. Past deliveries to the address remain in your [email logs](/docs/api/emails/list).

### 200 OK

To stop emailing someone but keep their history, unsubscribe them instead.

```json
{
  "success": true
}
```

### 401 Unauthorized

The API key is missing, malformed, revoked, or expired.

```json
{
  "error": "unauthorized",
  "message": "Invalid API key",
  "correlationId": "req_example"
}
```

### 403 Forbidden

The API key lacks a required permission, or its domain restriction does not allow this sender.

```json
{
  "error": "not_allowed",
  "message": "Missing required API key permissions: email.full_access",
  "correlationId": "req_example"
}
```

### 404 Not Found

No contact with this ID exists in the API key's project.

```json
{
  "error": "not_found",
  "message": "Contact not found",
  "correlationId": "req_example"
}
```

---

Source: https://connect.nxiom.com/docs/api/contacts/delete
