# Delete Received Email

> DELETE /emails/receiving/:id — permanently delete a received email and its stored objects.

`DELETE /emails/receiving/:id`

Permanently deletes a received email and all of its associated storage objects — the raw `.eml` file and every attachment stored for that email. This action cannot be undone. Requires a **write-scoped** API key.

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The id of the received email to delete. |

**Node.js**

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

const mb = new SendPing('mb_xxxxxxxxx');

const { data, error } = await mb.emails.receiving.remove('4ef9a417-02e9-4d39-ad75-9611e0fcc33c');
console.log({ data, error });
```

**Ruby**

```ruby
require "sendping"

SendPing.api_key = "mb_xxxxxxxxx"

SendPing::Emails::Receiving.delete("4ef9a417-02e9-4d39-ad75-9611e0fcc33c")
```

**PHP**

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

use SendPing\SendPing;

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

$sendping->emails->receiving->remove('4ef9a417-02e9-4d39-ad75-9611e0fcc33c');
```

**Python**

```python
import sendping

sendping.api_key = "mb_xxxxxxxxx"

sendping.Emails.Receiving.remove("4ef9a417-02e9-4d39-ad75-9611e0fcc33c")
```

**Go**

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

client := sendping.NewClient("mb_xxxxxxxxx")

removed, err := client.Emails.Receiving.Remove("4ef9a417-02e9-4d39-ad75-9611e0fcc33c")
```

**Rust**

```rust
use sendping::SendPing;

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

let _removed = mb.emails.receiving.remove("4ef9a417-02e9-4d39-ad75-9611e0fcc33c").await?;
```

**Java**

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

SendPing sendping = new SendPing("mb_xxxxxxxxx");

SendPingResponse response = sendping.emails().receiving().remove("4ef9a417-02e9-4d39-ad75-9611e0fcc33c");
```

**.NET**

```csharp
using SendPing;

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

var resp = await sendping.ReceivedEmailDeleteAsync("4ef9a417-02e9-4d39-ad75-9611e0fcc33c");
```

**cURL**

```bash
curl -X DELETE 'https://www.sendping.co/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c' \
  -H 'Authorization: Bearer mb_xxxxxxxxx'
```

**CLI**

```bash
sendping emails receiving delete 4ef9a417-02e9-4d39-ad75-9611e0fcc33c
```

## Response

```json
{
  "object": "received_email",
  "id": "4ef9a417-02e9-4d39-ad75-9611e0fcc33c",
  "deleted": true
}
```

Returns `not_found` (404) if the received email does not exist for your account. See the [error reference](https://www.sendping.co/docs/api/errors).
