AI Generation
Generate sequences, landing pages, lead statuses, and opportunity stages from natural language prompts using OpenAI-compatible APIs. All endpoints gracefully fall back to built-in templates when no API key is configured.
Sequence Generation
Complete workflow sequences with triggers, emails, conditions, and actions
Landing Page Generation
Page structures with sections, styling, SEO, and HTML content
Lead Status Generation
Status definitions tailored to your industry and pipeline
Opportunity Stage Generation
Pipeline stages with probabilities and close indicators
Generate Sequence
AI-generate a complete email workflow sequence from a natural language prompt. The output uses the same node/edge format as the Workflow Definition API and can be directly imported into the visual editor.
Body Parameters
| Parameter | Type | Description |
|---|---|---|
promptreq | string | Natural language description of the desired email sequence |
industry | string | Industry context (e.g. B2B SaaS, Real Estate) |
tone | string | Tone of the emails (e.g. professional, casual, friendly) |
emailCount | string | Approximate number of emails (e.g. 3-5, 5-7) |
POST https://api.leadron.io/v1/campaigns/ai/generate-sequence
Content-Type: application/json
X-Tenant-Id: acme-corp
Authorization: Bearer <token>{
"prompt": "A 5-email cold outreach sequence for B2B SaaS targeting CTOs. Include follow-ups based on email engagement.",
"industry": "B2B SaaS",
"tone": "professional and friendly",
"emailCount": "5"
}{
"success": true,
"data": {
"name": "CTO Outreach Sequence",
"description": "Cold outreach sequence targeting B2B SaaS CTOs",
"nodes": [
{
"nodeId": "trigger-1",
"type": "trigger",
"position": {
"x": 300,
"y": 50
},
"data": {
"label": "Manual Trigger",
"triggerType": "manual"
}
},
{
"nodeId": "email-1",
"type": "email",
"position": {
"x": 300,
"y": 200
},
"data": {
"label": "Introduction Email",
"subjectLine": "Quick question about..."
}
},
{
"nodeId": "wait-1",
"type": "wait",
"position": {
"x": 300,
"y": 350
},
"data": {
"label": "Wait 2 days",
"duration": 2,
"durationUnit": "days"
}
},
{
"nodeId": "cond-1",
"type": "condition",
"position": {
"x": 300,
"y": 500
},
"data": {
"label": "Email opened?",
"conditionField": "email_opened"
}
}
],
"edges": [
{
"edgeId": "e-1",
"source": "trigger-1",
"target": "email-1"
},
{
"edgeId": "e-2",
"source": "email-1",
"target": "wait-1"
},
{
"edgeId": "e-3",
"source": "wait-1",
"target": "cond-1"
}
]
},
"message": "Sequence generated"
}Info
POST /v1/workflows to create the workflow.Generate Landing Page
AI-generate a landing page with sections, styles, SEO settings, and HTML content.
Body Parameters
| Parameter | Type | Description |
|---|---|---|
promptreq | string | Natural language description of the desired landing page |
industry | string | Industry context |
goal | string | Page conversion goal (e.g. lead generation, signup) |
tone | string | Design tone (e.g. professional, modern, playful) |
POST https://api.leadron.io/v1/campaigns/ai/generate-landing-page
Content-Type: application/json
X-Tenant-Id: acme-corp
Authorization: Bearer <token>{
"prompt": "A webinar registration page for a product demo. Include hero, features, speaker bio, and registration form.",
"industry": "B2B SaaS",
"goal": "webinar registration"
}{
"success": true,
"data": {
"name": "Product Demo Webinar",
"description": "Webinar registration landing page",
"slug": "product-demo-webinar",
"sections": [
{
"sectionId": "hero-1",
"type": "hero",
"label": "Hero",
"visible": true,
"order": 0
},
{
"sectionId": "features-1",
"type": "features",
"label": "What You'll Learn",
"visible": true,
"order": 1
},
{
"sectionId": "form-1",
"type": "form",
"label": "Register Now",
"visible": true,
"order": 2
}
],
"seo": {
"title": "Product Demo Webinar",
"metaDescription": "Join our live product demo..."
},
"style": {
"primaryColor": "#4f46e5",
"backgroundColor": "#ffffff",
"fontFamily": "Inter"
},
"content": "<div>...generated HTML...</div>"
},
"message": "Landing page generated"
}Generate Lead Statuses
AI-generate a set of lead status definitions tailored to your industry. The generated statuses can be directly created via POST /v1/config/statuses.
Body Parameters
| Parameter | Type | Description |
|---|---|---|
promptreq | string | Natural language description of your business/pipeline context |
POST https://api.leadron.io/v1/config/ai/generate-statuses
Content-Type: application/json
X-Tenant-Id: acme-corp
Authorization: Bearer <token>{
"prompt": "We're a B2B SaaS company. Leads come from website forms, events, and referrals. We qualify, demo, and close."
}{
"success": true,
"data": {
"statuses": [
{
"code": "new",
"name": "New",
"description": "Freshly created lead",
"color": "blue",
"sortOrder": 0,
"isDefault": true
},
{
"code": "contacted",
"name": "Contacted",
"description": "Initial outreach made",
"color": "cyan",
"sortOrder": 1,
"isDefault": false
},
{
"code": "qualified",
"name": "Qualified",
"description": "Meets qualification criteria",
"color": "green",
"sortOrder": 2,
"isDefault": false
},
{
"code": "demo_scheduled",
"name": "Demo Scheduled",
"description": "Demo booked",
"color": "indigo",
"sortOrder": 3,
"isDefault": false
},
{
"code": "won",
"name": "Won",
"description": "Converted to customer",
"color": "emerald",
"sortOrder": 5,
"isDefault": false
},
{
"code": "lost",
"name": "Lost",
"description": "Did not convert",
"color": "red",
"sortOrder": 6,
"isDefault": false
}
]
},
"message": "Lead statuses generated"
}Generate Opportunity Stages
AI-generate deal pipeline stages with probabilities and close/win indicators. The generated stages can be directly created via POST /v1/config/statuses with entityType: "opportunity".
Body Parameters
| Parameter | Type | Description |
|---|---|---|
promptreq | string | Natural language description of your sales process |
POST https://api.leadron.io/v1/config/ai/generate-opportunity-stages
Content-Type: application/json
X-Tenant-Id: acme-corp
Authorization: Bearer <token>{
"prompt": "Enterprise software sales with a 60-day average cycle. We do discovery, demo, POC, proposal, and negotiation."
}{
"success": true,
"data": {
"stages": [
{
"code": "discovery",
"name": "Discovery",
"description": "Initial qualification",
"color": "blue",
"sortOrder": 0,
"isDefault": true,
"isClosed": false,
"isWon": false,
"defaultProbability": 10
},
{
"code": "demo",
"name": "Demo",
"description": "Product demonstration",
"color": "cyan",
"sortOrder": 1,
"isDefault": false,
"isClosed": false,
"isWon": false,
"defaultProbability": 25
},
{
"code": "poc",
"name": "POC",
"description": "Proof of concept",
"color": "indigo",
"sortOrder": 2,
"isDefault": false,
"isClosed": false,
"isWon": false,
"defaultProbability": 40
},
{
"code": "proposal",
"name": "Proposal",
"description": "Commercial proposal sent",
"color": "violet",
"sortOrder": 3,
"isDefault": false,
"isClosed": false,
"isWon": false,
"defaultProbability": 60
},
{
"code": "closed_won",
"name": "Closed Won",
"description": "Deal won",
"color": "green",
"sortOrder": 5,
"isDefault": false,
"isClosed": true,
"isWon": true,
"defaultProbability": 100
},
{
"code": "closed_lost",
"name": "Closed Lost",
"description": "Deal lost",
"color": "red",
"sortOrder": 6,
"isDefault": false,
"isClosed": true,
"isWon": false,
"defaultProbability": 0
}
]
},
"message": "Opportunity stages generated"
}Configuration
Environment variables for AI generation. Set these in the .env file of the campaign-service and configuration-service.
| Variable | Default | Description |
|---|---|---|
| OPENAI_API_KEY | — | Your OpenAI API key. When empty, deterministic templates are used. |
| OPENAI_MODEL | gpt-4o-mini | Model to use for generation. |
| OPENAI_BASE_URL | https://api.openai.com/v1 | Base URL for the OpenAI-compatible API. Change for Azure OpenAI or other providers. |
Info
OPENAI_API_KEY is not set. This means the endpoints always return usable results, even without an AI provider configured.