Assets

Generate an AI email asset

Generate an AI-powered email asset from a text prompt. The asset is created immediately and returned in the response with ai_generation_status: started. AI content generation runs asynchronously in the background. Poll GET /assets/{asset_id} to check when ai_generation_status changes to completed or failed.

The asset must be associated with a campaign (asset folder). The brand is automatically resolved from the campaign.

post/assets/generate

Request

Request body

promptstring required

Text instructions describing the email to generate. This is the main input for the AI generation.

type'email' required

The type of asset to generate. Currently only email is supported.

campaign_idstring required

The ID of the campaign (asset folder) where the asset will be created. The brand is automatically resolved from the campaign.

namestring nullable

Optional name for the asset. If not provided, a name may be auto-generated.

theme_idstring nullable

Optional theme ID to base the generated email on. Must belong to your company.

subjectstring nullable

Optional subject line for the email. If not provided, the AI will generate a subject line automatically.

from_namestring nullable

Sender name for the email.

from_emailstring nullable

Sender email address.

reply_emailstring nullable

Reply-to email address.

tagsstring[] nullable

Tags to apply to the generated asset.

asset_idstring nullable

Optional. When provided, overwrites the target email asset's content with a new version instead of creating a new asset. Must reference an email asset in your company, and you must have save permission on that asset. campaign_id is still required and its brand is used for the regenerated content.

module_idsstring[] nullable

Optional module IDs to use as building blocks for the generated email. Each module must belong to your company. Only the latest published version of each module is used; modules without a published version are ignored. Maximum 10 modules.

module_variationsobject nullable

Optional variation choices for the modules in module_ids, keyed by module ID. Each value maps a variation id from GET /modules to true (show it) or false (hide it), overriding the variation's enabled_by_default. Variations you leave out keep their defaults, and an empty object keeps all of that module's defaults. Every module listed here must also be in module_ids.

skip_editor_restrictionsboolean nullable

When true, admin-configured editor restrictions are bypassed during generation so the AI can produce content that locked or hidden restrictions would otherwise forbid. Only takes effect when the authenticated user has the "bypass editor restrictions" permission; otherwise it is ignored and restrictions still apply.

Example request

{
  "prompt": "Create a promotional email for our spring sale with 20% off all items",
  "type": "email",
  "campaign_id": "609d7ce223411",
  "name": "Spring Sale Promo",
  "theme_id": "609d7ce223411",
  "subject": "Spring Sale - 20% Off Everything",
  "from_name": "Marketing Team",
  "from_email": "marketing@example.com",
  "reply_email": "replies@example.com",
  "tags": [
    "spring-sale",
    "promo"
  ],
  "images": [
    {
      "url": "https://example.com/images/hero.png",
      "filename": "hero.png"
    }
  ],
  "files": [
    {
      "url": "https://example.com/files/brand-guide.pdf",
      "filename": "brand-guide.pdf"
    }
  ],
  "asset_id": "609d7ce223411",
  "module_ids": [
    "63eff78889f21"
  ],
  "module_variations": {
    "63eff78889f21": {
      "05283c93-3855-4810-a927-ff30aa3d4805": false,
      "9b1f6c2e-4d7a-4f3b-8e21-7c5d0a9e3f12": true
    }
  }
}

Response

Asset created successfully. AI content generation is running asynchronously. Poll GET /assets/{asset_id} to check generation status.

Example response

{
  "data": {
    "type": "asset",
    "id": "609d7ce223411",
    "attributes": {
      "id": "609d7ce223411",
      "creator_id": "611e7cf243412",
      "subject": "Spring Newsletter",
      "from_name": "John Doe",
      "from_email": "john.doe@email.com",
      "reply_email": "john.doe@email.com",
      "type": "email",
      "name": "Spring Newsletter",
      "folder_path": "Sample Brand/Folder 1/Folder 2/Sample Campaign",
      "campaign": "Sample Campaign",
      "brand": "Sample Brand",
      "language_code": "es",
      "version": "1.0",
      "parent_asset_id": "609d7ce22341c",
      "approval_status": "approved"
    }
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.