# 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 { SendDart } from 'senddart';

const mb = new SendDart('mb_xxxxxxxxx');

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

**Ruby**

```ruby
require "senddart"

SendDart.api_key = "mb_xxxxxxxxx"

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

**PHP**

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

use SendDart\SendDart;

$senddart = SendDart::client('mb_xxxxxxxxx');

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

**Python**

```python
import senddart

senddart.api_key = "mb_xxxxxxxxx"

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

**Go**

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

client := senddart.NewClient("mb_xxxxxxxxx")

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

**Rust**

```rust
use senddart::SendDart;

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

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

**Java**

```java
import com.senddart.SendDart;
import com.senddart.SendDartResponse;

SendDart senddart = new SendDart("mb_xxxxxxxxx");

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

**.NET**

```csharp
using SendDart;

ISendDart senddart = SendDartClient.Create("mb_xxxxxxxxx");

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

**cURL**

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

**CLI**

```bash
senddart 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.senddart.com/docs/api/errors).
