# 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.sendping.co/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 { SendPing } from 'sendping';

const mb = new SendPing('mb_xxxxxxxxx');

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

**Ruby**

```ruby
require "sendping"

SendPing.api_key = "mb_xxxxxxxxx"

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

**PHP**

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

use SendPing\SendPing;

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

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

**Python**

```python
import sendping

sendping.api_key = "mb_xxxxxxxxx"

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

**Go**

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

client := sendping.NewClient("mb_xxxxxxxxx")

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

**Rust**

```rust
use sendping::SendPing;

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

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

**Java**

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

SendPing sendping = new SendPing("mb_xxxxxxxxx");

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

**.NET**

```csharp
using SendPing;

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

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

**cURL**

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

**CLI**

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