# List Attachments

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

`GET /emails/:id/attachments`

List the attachments on an email your account has sent. Each entry returns the attachment metadata — `filename`, `size`, and MIME fields. SendPing does not retain the original file bytes for sent mail, so `download_url` and `expires_at` are **`null`** for sent-email attachments; binary retrieval is not guaranteed. (For received mail, attachment bytes are downloadable — see [List Received Attachments](https://www.sendping.co/docs/api/emails-received-list-attachments).)

> **Note:** This endpoint is **not** paginated. Every attachment on the email is returned in one `list` response, `has_more` is always `false`, and `limit` / `after` / `before` are ignored if you send them. (The received-mail sibling, [List Received Attachments](https://www.sendping.co/docs/api/emails-received-list-attachments), *is* paginated.)

## Path parameters

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

## Response fields

Each item in `data` is an attachment object:

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | No | The attachment id. |
| `filename` | string | No | The file name. |
| `size` | number | null | No | The file size in bytes, or `null` when the attachment was sent by hosted `path` URL — the size is derived from stored base64 `content`, which a URL-sent attachment does not have. |
| `content_type` | string | No | The MIME type (e.g. `image/png`). |
| `content_disposition` | string | No | `inline` or `attachment`. |
| `content_id` | string | No | The Content-ID, for inline images referenced by `cid:`. |
| `download_url` | string | null | No | A signed URL to download the file bytes. Always `null` for sent-email attachments — the original bytes are not retained. |
| `expires_at` | string | null | No | ISO 8601 time at which `download_url` expires. Always `null` for sent-email attachments. |

## Request

**Node.js**

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

const mb = new SendPing('mb_xxxxxxxxx');

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

**Ruby**

```ruby
require "sendping"

SendPing.api_key = "mb_xxxxxxxxx"

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

**PHP**

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

use SendPing\SendPing;

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

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

**Python**

```python
import sendping

sendping.api_key = "mb_xxxxxxxxx"

sendping.Emails.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.ListAttachments("4ef9a417-02e9-4d39-ad75-9611e0fcc33c")
```

**Rust**

```rust
use sendping::SendPing;

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

let _attachments = mb.emails.list_attachments("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().listAttachments("4ef9a417-02e9-4d39-ad75-9611e0fcc33c");
```

**.NET**

```csharp
using SendPing;

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

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

**cURL**

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

**CLI**

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

## Response

```json
{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "object": "attachment",
      "id": "2a0c9ce0-3112-4728-976e-47ddcd16a318",
      "filename": "avatar.png",
      "size": 4096,
      "content_type": "image/png",
      "content_disposition": "inline",
      "content_id": "img001",
      "download_url": null,
      "expires_at": null
    }
  ]
}
```

## Errors

Returns `not_found` (404) if no email with that id exists for your account. There are no pagination errors on this endpoint — it takes no query parameters. See the [error reference](https://www.sendping.co/docs/api/errors).
