# Delete audience

> DELETE /audiences/:id — delete an audience and its contacts.

`DELETE /audiences/:id`

Delete an audience by `id`. This also removes the contacts belonging to it.

**Node.js**

```js
import { SendPing } from 'sendping';

const mb = new SendPing('mb_xxxxxxxxx');

const { data, error } = await mb.audiences.remove('AUDIENCE_ID');
console.log({ data, error });
```

**Ruby**

```ruby
require "sendping"

SendPing.api_key = "mb_xxxxxxxxx"

SendPing::Audiences.delete("AUDIENCE_ID")
```

**PHP**

```php
<?php
require 'vendor/autoload.php';

use SendPing\SendPing;

$sendping = SendPing::client('mb_xxxxxxxxx');

$sendping->audiences->remove('AUDIENCE_ID');
```

**Python**

```python
import sendping

sendping.api_key = "mb_xxxxxxxxx"

sendping.Audiences.remove("AUDIENCE_ID")
```

**Go**

```go
import "github.com/shekhu10/sendping-sdks/sendping-go"

client := sendping.NewClient("mb_xxxxxxxxx")

removed, err := client.Audiences.Remove("AUDIENCE_ID")
```

**Rust**

```rust
use sendping::SendPing;

let mb = SendPing::new("mb_xxxxxxxxx");

let _removed = mb.audiences.remove("AUDIENCE_ID").await?;
```

**Java**

```java
import co.sendping.SendPing;
import co.sendping.SendPingResponse;

SendPing sendping = new SendPing("mb_xxxxxxxxx");

SendPingResponse response = sendping.audiences().remove("AUDIENCE_ID");
```

**.NET**

```csharp
using SendPing;

ISendPing sendping = SendPingClient.Create("mb_xxxxxxxxx");

var resp = await sendping.AudienceDeleteAsync("AUDIENCE_ID");
```

**cURL**

```bash
curl -X DELETE 'https://www.sendping.co/api/audiences/AUDIENCE_ID' \
  -H 'Authorization: Bearer mb_xxxxxxxxx'
```

**CLI**

```bash
sendping audiences delete AUDIENCE_ID
```

**Response (200)**

```json
{
  "object": "audience",
  "id": "78261eea-8f8b-4381-83c6-79fa7120f1cf",
  "deleted": true
}
```

> **Warning:** Deletion is blocked while a campaign still references the audience — you get `422 validation_error` asking you to delete the campaign(s) first. An unknown id returns `404 not_found`.
