---
title: "Asset domain, MailKaro Docs"
description: "Serve your uploaded files from your own domain. The pictures in your emails read https://assets.yourbrand.com/..."
---

# Asset domain

Files and assets

# Asset domain

Serve your uploaded files from your own domain. The pictures in your emails read `https://assets.yourbrand.com/...` instead of an S3 address, and keep working if you move storage.

## Turn it on

Tell the editor which storage address to replace, and your domain:

tsx Studio.tsx

```
<EmailEditor
 token={token}
 onImageUpload={uploadToS3}
 assetDomain={{
 from: "https://my-bucket.s3.eu-north-1.amazonaws.com",
 to: "https://assets.yourbrand.com"
 }}
/>
```

That is all. A new upload is stored with your domain, the link under the upload box shows it, files you pick from your S3 library hand it out too, and the exported HTML has it, also for pictures that were uploaded before you turned it on.

## What your domain has to do

It has to serve the same paths as your storage: a CDN, or a CNAME in front of the bucket. The editor does not host files and does not set up the domain. Before it uses your domain for a new upload it checks that the file loads from there. When it does not (the CDN is not ready, DNS has not spread), the original storage address is kept, so an email never ships a broken picture. Pass `onFallback` to be told, or `verify: false` to skip the check.

## Rendering on your server

The same option works anywhere you render, so what you send matches what the editor shows:

ts send.ts

```
import { renderDesign } from "email-craft-sdk";

const html = renderDesign(design, {
 fullDocument: true,
 assetDomain: { from: "https://my-bucket.s3.eu-north-1.amazonaws.com", to: "https://assets.yourbrand.com" }
});
```

The Cloud API takes it too, as `asset_domain` on `POST /v3/render` and `POST /v3/emails`. Your backend can also declare it with the other capabilities, as `assetDomain`.

## The rules

|Property |Controls |Default |
|`from` |The storage address or addresses to replace (http or https origins) |A look-alike host such as bucket.s3.x.com.evil.test is never replaced |
|`to` |Your address. Must be https; a path is allowed (https://cdn.yourbrand.com/files) |No credentials, query or fragment |
|`verify` |Check that your domain serves a new upload (default true) |Pictures are loaded as pictures; other files only have to be reachable |

ℹ Only addresses that start with `from` change. Your links, other sites' pictures and everything else stay as they are. An invalid domain is ignored in the editor and refused by the API, never half applied.

Source: https://docs.mailkaro.com/asset-domain
