> ## Documentation Index
> Fetch the complete documentation index at: https://ahasend.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> AhaSend stores all message data in the EU. See /facts.
> The API base URL is https://api.ahasend.com. Send the API key in the Authorization: Bearer header. See /api-reference/authentication.
> Use send.ahasend.com for SMTP. Ports 25, 587 and 2525 use STARTTLS. Port 465 is not supported. See /smtp.
> For send-only integrations, create an API Key v2 under Credentials → Add and scope it to messages:send:{your-domain}. See /send-api/credentials and /api-reference/scopes.

# Inline Images

> Show images inside the body of your emails by attaching them with a Content-ID and referring to them from your HTML with cid, through the API or over SMTP.

An inline image is an attachment that shows inside the message instead of as a download, for example a logo or a product photo. You attach the image with a Content-ID and refer to that ID from your HTML.

Available on Free, Pro and Max. See [plans and features](https://ahasend.com/docs/facts.md#plans-and-features).

## How do I embed an image with the API?

Give the attachment a `content_id` wrapped in angle brackets, and use the same value without the brackets after `cid:` in your HTML:

```json theme={null}
{
  "sandbox": true,
  "from": { "email": "orders@yourdomain.com", "name": "Your Store" },
  "recipients": [{ "email": "customer@example.com" }],
  "subject": "Thanks for your order",
  "html_content": "<p>Thanks for your order.</p><img src=\"cid:logo@yourdomain.com\" alt=\"Your Store\" width=\"120\">",
  "attachments": [
    {
      "file_name": "logo.png",
      "content_type": "image/png",
      "base64": true,
      "content_id": "<logo@yourdomain.com>",
      "data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg=="
    }
  ]
}
```

> [!WARNING]
>
> The angle brackets in `content_id` are required. Without them the image is delivered as a regular downloadable attachment and doesn't show in the message.

The same works with [transactional templates](https://ahasend.com/docs/send-api/templates.md): attach the image in the send request and refer to it from the template's HTML with `cid:`.

## Should I embed images or link to them?

| | Embedded with `cid:` | Linked from your website |
| - | - | - |
| Shows without the recipient allowing remote images | Yes, in most clients | Often not until the recipient allows it |
| Message size | Grows with every image | Stays small |
| Change an image after sending | No | Yes |

Embed small images that must always show, such as a logo. Link larger images and anything you might want to change later.

## How do I embed an image over SMTP?

Add the image as a MIME part with a `Content-ID` header inside a `multipart/related` part, and refer to it with `cid:` in the HTML. Most mail libraries have a helper for this, often called an embedded or inline attachment.

## Related guides

* [Attachments](https://ahasend.com/docs/send-api/attachments.md), [Send email](https://ahasend.com/docs/send-api/send-email.md), [Transactional templates](https://ahasend.com/docs/send-api/templates.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.