# Retrieve Attachment

`GET https://api.inboxjot.com/v1/emails/{email_id}/attachments/{attachment_id}`

Retrieves one attachment of an email. Needs a Full key. A key limited to one domain sees only the emails of that domain, and answers 404 for the others.

## Path Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `email_id` | string | Yes | The email id, such as `eml_06d2mfk8r4tq9xv2bnc7s`. |
| `attachment_id` | string | Yes | The attachment id, such as `att_06d2mfk8r3hv8kc6pq1nd`. |

## Response

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | No | The attachment id. |
| `filename` | string | No | The file name. |
| `content_type` | string | No | The MIME type. |
| `size` | integer | No | Size in bytes. |
| `content_id` | string \| null | No | The content id of an inline image. |
| `content_disposition` | string | No | `inline` when the file has a content id, otherwise `attachment`. |
| `deleted_at` | string \| null | No | When data retention deleted the file. |
| `download_url` | string \| null | No | A link to download the file. It works for 10 minutes. `null` after data retention deleted the file. |
| `expires_at` | string \| null | No | When the download link stops working. |

## Request

cURL:

```bash
curl -X GET https://api.inboxjot.com/v1/emails/eml_06d2mfk8r4tq9xv2bnc7s/attachments/att_06d2mfk8r3hv8kc6pq1nd \
  -H "Authorization: Bearer $INBOXJOT_API_KEY"
```

Node.js:

```javascript
import { Inboxjot } from 'inboxjot';

const inboxjot = new Inboxjot();

const attachment = await inboxjot.emails.getAttachment(
  'eml_06d2mfk8r4tq9xv2bnc7s',
  'att_06d2mfk8r3hv8kc6pq1nd',
);
```

Rust:

```rust
use inboxjot::Inboxjot;

let client = Inboxjot::from_env()?;

let attachment = client
    .emails()
    .get_attachment("eml_06d2mfk8r4tq9xv2bnc7s", "att_06d2mfk8r3hv8kc6pq1nd")
    .await?;
```

Go:

```go
client := inboxjot.NewClient("")

attachment, err := client.Emails.GetAttachment(ctx, "eml_06d2mfk8r4tq9xv2bnc7s", "att_06d2mfk8r3hv8kc6pq1nd")
```

Python:

```python
from inboxjot import Inboxjot

inboxjot = Inboxjot()

attachment = inboxjot.emails.get_attachment(
    "eml_06d2mfk8r4tq9xv2bnc7s", "att_06d2mfk8r3hv8kc6pq1nd"
)
```

## Responses

| Status | Description |
| --- | --- |
| 200 | Returns the attachment. |
| 400 | A path parameter is invalid. |
| 401 | The API key is missing, revoked or expired. |
| 403 | The key is a Sending key, or the request comes from outside its IP allowlist. |
| 404 | The email or the attachment does not exist in this workspace. |
| 429 | Too many requests for this key. Wait for the seconds in the Retry-After header. |
| 500 | Something failed on our side. Retry later. |

200:

```json
{
  "id": "att_06d2mfk8r3hv8kc6pq1nd",
  "filename": "receipt-4821.pdf",
  "content_type": "application/pdf",
  "size": 48213,
  "content_id": null,
  "content_disposition": "attachment",
  "deleted_at": null,
  "download_url": "https://<account>.r2.cloudflarestorage.com/…",
  "expires_at": "2026-10-15T15:02:33.000Z"
}
```

400:

```json
{
  "name": "validation_error",
  "status": 400,
  "message": "length is greater than 100",
  "errors": [
    {
      "message": "length is greater than 100",
      "location": "email_id"
    }
  ],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

401:

```json
{
  "name": "unauthorized",
  "status": 401,
  "message": "Unauthorized",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

403:

```json
{
  "name": "forbidden",
  "status": 403,
  "message": "This key cannot be used from 203.0.113.7",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

404:

```json
{
  "name": "not_found",
  "status": 404,
  "message": "Attachment not found",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

429:

```json
{
  "name": "rate_limit_exceeded",
  "status": 429,
  "message": "Too many attempts. Try again later.",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```

500:

```json
{
  "name": "unknown_error",
  "status": 500,
  "message": "Something went wrong. Please try again later.",
  "errors": [],
  "request_id": "5f0c6a2e-8d1b-4c7a-9e3f-2b6d4a1c8e90"
}
```
