> ## Documentation Index
> Fetch the complete documentation index at: https://docs.seleqt.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Campaigns steps create

## POST /api/v1/public/campaigns/{id}/steps/

Adds a new step to a campaign. Cannot add steps to active campaigns.

Auth: `X-API-Key`

### Path Parameters

* `id` (integer, required): Campaign ID

### Request Body

```json theme={null}
{
  "step_type": "EMAIL",
  "message_template": "Hi {{first_name}}, I hope you're doing well!",
  "subject_line": "Quick question about {{company_name}}",
  "delay_in_hours": 24,
  "subject_line_b": "Alternative subject for {{first_name}}",
  "message_template_b": "Alternative message for {{first_name}}",
  "add_unsubscribe": true,
  "parent_step_id": 123,
  "child_step_id": 456
}
```

### Flow Management Fields

* `parent_step_id` (integer, optional): ID of the step that comes before this one
* `parent_condition_id` (integer, optional): ID of the condition that comes before this one
* `child_step_id` (integer, optional): ID of the step that comes after this one
* `child_condition_id` (integer, optional): ID of the condition that comes after this one

**Note:** You can only specify one parent (either `parent_step_id` OR `parent_condition_id`) and one child (either `child_step_id` OR `child_condition_id`).

### Available Step Types

* `EMAIL`: Send an email
* `LINKEDIN_MESSAGE`: Send a LinkedIn message
* `LINKEDIN_INVITE`: Send a LinkedIn connection request
* `INMAIL`: Send a LinkedIn InMail
* `VISIT_LINKEDIN_PROFILE`: Visit a LinkedIn profile
* `DELETE_LINKEDIN_INVITE`: Delete a LinkedIn connection request
* `LIKE_LAST_LINKEDIN_POST`: Like the prospect's last LinkedIn post

### Available Variables

You can use these variables in message templates and subject lines with double brackets `{{}}`:

* `{{first_name}}` - Prospect's first name
* `{{last_name}}` - Prospect's last name
* `{{job_title}}` - Job title
* `{{company_name}}` - Company name
* `{{location}}` - Location

### Response

```json theme={null}
{
  "success": true,
  "step": {
    "id": 456,
    "step_type": "EMAIL",
    "subject_line": "Quick question about {{company_name}}",
    "message_template": "Hi {{first_name}}, I hope you're doing well!",
    "subject_line_b": "Alternative subject for {{first_name}}",
    "message_template_b": "Alternative message for {{first_name}}",
    "delay_in_hours": 24,
    "add_unsubscribe": true,
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z"
  },
  "campaign": {...}
}
```

### Example

```bash theme={null}
curl -X POST -H "X-API-Key: <key>" \
  -H "Content-Type: application/json" \
  -d '{
    "step_type": "EMAIL",
    "message_template": "Hi {{first_name}}, I hope you are doing well!",
    "subject_line": "Quick question about {{company_name}}",
    "delay_in_hours": 24
  }' \
  "https://api.seleqt.ai/api/v1/public/campaigns/123/steps/"
```

### Building a Campaign Flow

Here's an example of how to build a complete campaign flow:

#### 1. Create the first step (LinkedIn invite)

```bash theme={null}
curl -X POST -H "X-API-Key: <key>" \
  -H "Content-Type: application/json" \
  -d '{
    "step_type": "LINKEDIN_INVITE",
    "message_template": "Hi {{first_name}}, I would love to connect!",
    "delay_in_hours": 0
  }' \
  "https://api.seleqt.ai/api/v1/public/campaigns/123/steps/"
```

#### 2. Create a follow-up email step

```bash theme={null}
curl -X POST -H "X-API-Key: <key>" \
  -H "Content-Type: application/json" \
  -d '{
    "step_type": "EMAIL",
    "message_template": "Hi {{first_name}}, I hope you are doing well!",
    "subject_line": "Quick question about {{company_name}}",
    "delay_in_hours": 24,
    "parent_step_id": 456
  }' \
  "https://api.seleqt.ai/api/v1/public/campaigns/123/steps/"
```

#### 3. Create a final LinkedIn message

```bash theme={null}
curl -X POST -H "X-API-Key: <key>" \
  -H "Content-Type: application/json" \
  -d '{
    "step_type": "LINKEDIN_MESSAGE",
    "message_template": "Thanks for connecting {{first_name}}! I would love to discuss how we can help {{company_name}}.",
    "delay_in_hours": 48,
    "parent_step_id": 789
  }' \
  "https://api.seleqt.ai/api/v1/public/campaigns/123/steps/"
```

This creates a flow: LinkedIn Invite → Email (24h delay) → LinkedIn Message (48h delay)
