> This page is for Mailchimp Marketing API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://mailchimp.com/developer/llms.txt.

# Delete a contact

DELETE https://api.mailchimp.com/3.0/audiences/{audience_id}/contacts/{contact_id}

Deletes a contact from the specified audience. This action is permanent and cannot be undone. Before calling this endpoint, you are responsible for exporting any contact or audience data you may need to retain. A successful request returns 204 No Content with an empty body. This endpoint removes the contact from the audience but is not designed to address data subject erasure requests, and the contact can be added or imported again later. If you need to permanently delete a contact's personal data and prevent the contact from being re-imported, use Delete list member (POST /3.0/lists/\{list\_id}/members/\{subscriber\_hash}/actions/delete-permanent).

Reference: https://mailchimp.com/developer/marketing/api/audiences/delete-audience-contact

## Authentication

- `Authorization` header (bearer token, required) — The legacy Mailchimp OAuth 2.0 provider, as described in our developer documentation at [Legacy OAuth 2 apps](https://mailchimp.com/developer/marketing/api-concepts/authentication/legacy-oauth-2).
- `Authorization` header (bearer token, required) — A legacy Mailchimp API key, as described in our developer documentation at [API keys](https://mailchimp.com/developer/marketing/api-concepts/authentication/api-keys).
- `Authorization` header (bearer token, required) — The Mailchimp OAuth 2.0 provider, as described in our developer documentation at [OAuth 2](https://mailchimp.com/developer/marketing/api-concepts/authentication/oauth-2). This OAuth 2.0 provider requires [PKCE](https://www.rfc-editor.org/info/rfc7636/).
- `Authorization` header (bearer token, required) — A scoped Mailchimp API key, as described in our developer documentation at [API keys](https://mailchimp.com/developer/marketing/api-concepts/authentication/api-keys).

## Request

### Path parameters

- `audience_id` (string, required) — The unique ID for the audience.
- `contact_id` (string, required) — A unique identifier for the contact, which can be a Mailchimp contact ID or a channel hash. A channel hash must follow the format email:[md5_hash] (where the hash is the MD5 of the lowercased email address) or sms:[sha256_hash] (where the hash is the SHA256 of the E.164-formatted phone number).

## Response

### 204

Empty Response

## Examples

**SDK Code**

```python
import requests

url = "https://api.mailchimp.com/3.0/audiences/audience_id/contacts/contact_id"

headers = {"Authorization": "Bearer <token>"}

response = requests.delete(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.mailchimp.com/3.0/audiences/audience_id/contacts/contact_id';
const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.mailchimp.com/3.0/audiences/audience_id/contacts/contact_id"

	req, _ := http.NewRequest("DELETE", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.mailchimp.com/3.0/audiences/audience_id/contacts/contact_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.delete("https://api.mailchimp.com/3.0/audiences/audience_id/contacts/contact_id")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://api.mailchimp.com/3.0/audiences/audience_id/contacts/contact_id', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.mailchimp.com/3.0/audiences/audience_id/contacts/contact_id");
var request = new RestRequest(Method.DELETE);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.mailchimp.com/3.0/audiences/audience_id/contacts/contact_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```