Skip to main content
PUT
Save AI Style
Save an independent appearance snapshot from an email you can access. Requires emails:write. Marketers can save marketing email styles; transactional sources remain protected. Existing emails, source content and your company theme stay unchanged. Get the current style first. Pass its revisionId as expectedStyleId; use null only when no style is stored.
emailId is the underlying email ID, including a campaign, sequence or transactional email’s content row. It is not a campaign ID or transactional slug. The API captures the stored blocks and resolves the email’s theme/font overrides before company defaults. Subsequent source edits or deletion do not change your saved style. To capture an unsaved design, provide canvas with all four fields: blocks, theme, fontFamily and emailPreset (branded or minimal). theme is a complete editor theme with presetId, colors, typography and layout; use the schema above for required fields. Canvas validation is shared with the editor. Blocks are limited to 500 and 500,000 serialized characters. Empty content or footer/logo scaffolding cannot define a style. Imported HTML supports inline typography and colors, not an exact stylesheet/layout clone.

Layout habits and notes

Saving also detects layout habits in the source: the block it opens with (for example a video) and content-free companions that consistently frame a block type (for example a dotted divider above and below every button). Every detected habit is kept unless you narrow them. The response lists them under style.layout.rules, each with a stable id such as around|button|divider:dots, and style.layout.outline records the source section order.
  • layoutRuleIds: IDs of the habits to keep. Omit to keep all; pass [] to keep none. Unknown IDs are ignored.
  • notes: up to 500 characters of design guidance for future generations, such as “always open with a short video”. Notes are never treated as email content.
Generation follows the confirmed habits in its prompt and inserts the captured dividers or spacers deterministically around matching blocks. Opening habits that need content, such as a video, are prompt guidance only. To review before committing, save once, inspect style.layout.rules, then save again with the subset you want and the new revisionId.
MCP save_email_ai_style accepts emailId, expectedStyleId, optional canvas, optional layoutRuleIds, optional notes and optional companyId. CLI --company selects the company for a personal key. The response returns success, the new style, its new revisionId and canManage. New AI generation across dashboard/API/CLI/MCP uses this appearance and its confirmed habits. Explicit style instructions and plain-text choices take precedence. See Email Themes. Errors: 400 for invalid/oversized canvas, empty content or notes over 500 characters; 401 for missing/invalid auth; 403 for missing scope, denied company access or a non-writing role; 404 for an inaccessible/missing source; 422 for missing or malformed required fields. 409 AI_STYLE_CONFLICT means another write won: get the current style, review it and explicitly retry using its revision. Never retry with a newly fetched revision automatically.