---
title: "Export a design to an ESP"
method: POST
path: "/v1/emails/{emailId}/export"
tags: ["Emails"]
---

# Export a design to an ESP

`POST /v1/emails/{emailId}/export`

Export a finished email DESIGN to a connected third-party ESP (Klaviyo, Mailchimp, HubSpot, Braze, Iterable, Postmark, OneSignal, SendGrid, Mailgun) as a reusable TEMPLATE. This is NOT a Brew send — it creates a template in the destination platform and does NOT deliver to recipients, and is unrelated to Brew sending domains or audiences. The `provider` must already be connected for the brand (connect ESPs in the Brew app). The exported HTML is automatically made ESP-portable. Pass `dry_run: true` to validate the design, brand ownership, and ESP connection without creating a template. Free (no credits).

## Path parameters

- `emailId` string, required — Design id returned by `POST /v1/emails` and listed by `GET /v1/emails`.

## Headers

- `Idempotency-Key` string

## Request body

- EmailExportRequest
  - `provider` 'braze' | 'hubspot' | 'klaviyo' | 'mailchimp' | 'iterable' | 'postmark' | 'onesignal' | 'mailgun' | 'sendgrid', required — The connected ESP to export the design to as a template.
  - `templateName` string — Template name in the ESP. Defaults to the email title.
  - `dry_run` boolean — Validate the design, brand ownership, and ESP connection without creating a template.

## Response `200`

Dry run — the design + ESP connection were validated without creating a template.

- EmailExportResponse
  - `emailId` string, required
  - `provider` 'braze' | 'hubspot' | 'klaviyo' | 'mailchimp' | 'iterable' | 'postmark' | 'onesignal' | 'mailgun' | 'sendgrid', required
  - `providerName` string, required
  - `templateName` string, required
  - `templateId` string
  - `dryRun` boolean, required

## Other responses

- `201` — The design was exported to the ESP as a new template.
- `400` — The requested ESP is not connected for this brand.
- `401` — The API key was missing, invalid, or revoked.
- `403` — The caller does not have the required `emails` permission.
- `404` — Email design not found in the API-key brand. Cross-brand ids intentionally surface as 404 (never 403) so the API does not leak cross-brand existence.
- `409` — The same `Idempotency-Key` was reused with a different request body.
- `429` — The request hit the rolling rate limit window.
- `500` — Unexpected internal error.
- `502` — The ESP rejected the export or is temporarily unavailable.

---

[API](https://skmtc.net/brew/apis/brew-public-api-v1.md) · [All operations](https://skmtc.net/brew/apis/brew-public-api-v1/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/brew/brew-public-api-v1/versions/db96cfedc6c5/schema)
