# List Received Attachments

> GET /emails/receiving/:id/attachments — list the attachments on a received email.

`GET /emails/receiving/:id/attachments`

List the attachments on a received email. Each entry carries its `filename`, `size`, and MIME metadata, plus a `download_url` for the file bytes when they were stored (`downloadable: true`). The URL is not a public link — fetch it with your API key like any other endpoint.

> **Note:** This endpoint is paginated. The `limit` parameter is optional — if you omit it, up to 1,000 attachments are returned in a single response, with `has_more` set to `true` in the unlikely event more exist. See [Pagination](https://www.senddart.com/docs/api/pagination).

## Path parameters

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

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | number | No | Number of attachments to retrieve per page. Optional. Maximum `100`, minimum `1`. |
| `after` | string | No | The attachment `id` **after** which more attachments are retrieved. The passed id is not included. Cannot be combined with `before`. |
| `before` | string | No | The attachment `id` **before** which more attachments are retrieved. The passed id is not included. Cannot be combined with `after`. |

## Request

**Node.js**

```js
import { SendDart } from 'senddart';

const mb = new SendDart('mb_xxxxxxxxx');

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

**Ruby**

```ruby
require "senddart"

SendDart.api_key = "mb_xxxxxxxxx"

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

**PHP**

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

use SendDart\SendDart;

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

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

**Python**

```python
import senddart

senddart.api_key = "mb_xxxxxxxxx"

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

**Go**

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

client := senddart.NewClient("mb_xxxxxxxxx")

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

**Rust**

```rust
use senddart::SendDart;

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

let _attachments = mb.emails.receiving.list_attachments("4ef9a417-02e9-4d39-ad75-9611e0fcc33c", None).await?;
```

**Java**

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

SendDart senddart = new SendDart("mb_xxxxxxxxx");

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

**.NET**

```csharp
using SendDart;

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

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

**cURL**

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

**CLI**

```bash
senddart emails receiving attachments 4ef9a417-02e9-4d39-ad75-9611e0fcc33c
```

## Response

```json
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318",
      "filename": "avatar.png",
      "size": 4096,
      "content_type": "image/png",
      "content_disposition": "inline",
      "content_id": "img001",
      "downloadable": true,
      "download_url": "https://www.senddart.com/api/emails/receiving/4ef9a417-02e9-4d39-ad75-9611e0fcc33c/attachments/2a0c9ce0-3112-4728-976e-47ddcd16a318"
    }
  ]
}
```

## Errors

Returns `not_found` (404) if no received email with that id exists for your account; `validation_error` for a bad cursor or out-of-range `limit`. See the [error reference](https://www.senddart.com/docs/api/errors).
