API Reference/Documentation
GitHubDashboard
Platform

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

ParameterTypeDescription
promptreq
stringNatural language description of the desired email sequence
industry
stringIndustry context (e.g. B2B SaaS, Real Estate)
tone
stringTone of the emails (e.g. professional, casual, friendly)
emailCount
stringApproximate number of emails (e.g. 3-5, 5-7)
Request
HTTP
http
POST https://api.leadron.io/v1/campaigns/ai/generate-sequence
Content-Type: application/json
X-Tenant-Id: acme-corp
Authorization: Bearer <token>
Body
json
1
2
3
4
5
6
{
  "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"
}
Response200
200 Response
json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
  "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

The generated workflow uses the same node/edge format as the Workflow Definition API. You can directly pass the result to 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

ParameterTypeDescription
promptreq
stringNatural language description of the desired landing page
industry
stringIndustry context
goal
stringPage conversion goal (e.g. lead generation, signup)
tone
stringDesign tone (e.g. professional, modern, playful)
Request
HTTP
http
POST https://api.leadron.io/v1/campaigns/ai/generate-landing-page
Content-Type: application/json
X-Tenant-Id: acme-corp
Authorization: Bearer <token>
Body
json
1
2
3
4
5
{
  "prompt": "A webinar registration page for a product demo. Include hero, features, speaker bio, and registration form.",
  "industry": "B2B SaaS",
  "goal": "webinar registration"
}
Response200
200 Response
json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
  "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

ParameterTypeDescription
promptreq
stringNatural language description of your business/pipeline context
Request
HTTP
http
POST https://api.leadron.io/v1/config/ai/generate-statuses
Content-Type: application/json
X-Tenant-Id: acme-corp
Authorization: Bearer <token>
Body
json
1
2
3
{
  "prompt": "We're a B2B SaaS company. Leads come from website forms, events, and referrals. We qualify, demo, and close."
}
Response200
200 Response
json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{
  "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

ParameterTypeDescription
promptreq
stringNatural language description of your sales process
Request
HTTP
http
POST https://api.leadron.io/v1/config/ai/generate-opportunity-stages
Content-Type: application/json
X-Tenant-Id: acme-corp
Authorization: Bearer <token>
Body
json
1
2
3
{
  "prompt": "Enterprise software sales with a 60-day average cycle. We do discovery, demo, POC, proposal, and negotiation."
}
Response200
200 Response
json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
  "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.

VariableDefaultDescription
OPENAI_API_KEYYour OpenAI API key. When empty, deterministic templates are used.
OPENAI_MODELgpt-4o-miniModel to use for generation.
OPENAI_BASE_URLhttps://api.openai.com/v1Base URL for the OpenAI-compatible API. Change for Azure OpenAI or other providers.

Info

All AI generation endpoints gracefully fall back to built-in templates when OPENAI_API_KEY is not set. This means the endpoints always return usable results, even without an AI provider configured.