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
- Base URLhttps://enterprise.knak.io/api/published/v1
- Authnone declared
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
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.