---
title: "Create a campaign from a campaign template"
method: POST
path: "/campaign_templates/{id}/campaigns"
tags: ["Campaigns"]
---

# Create a campaign from a campaign template

`POST /campaign_templates/{id}/campaigns`

## Path parameters

- `id` string, required

## Request body

- object
  - `business` string, required — The business ID

## Response `200`

The created `Campaign` object

- Campaign
  - `id` string, required — The ID of the campaign
  - `created_at` string, required — The time when the campaign was created in ISO 8601 format
  - `updated_at` string, required — The time when the campaign was last updated in ISO 8601 format
  - `business` string, nullable, required — The ID of the business
  - `name` string, required — The name of the campaign
  - `enrolled_customers` string[] — The customers enrolled in the campaign
  - `enrolled_customer_ids` string[] — The IDs of the customers enrolled in the campaign
  - `segment` string, nullable, required — The segment attached to the campaign
  - `steps` union[], required — The steps of the campaign
    - union
      - object
        - `type` 'email', required — The step type. Always "email" for this step
        - `custom_step_id` string — Optional. The ID of the custom step to use in this step. The type of the custom step must be "email" as well
        - `email_template_id` string, required — The ID of the email template to use in this step
      - object
        - `type` 'email', required — The step type. Always "email" for this step
        - `custom_step_id` string — Optional. The ID of the custom step to use in this step. The type of the custom step must be "email" as well
        - `subject` string, required — The subject of the email template to use at this step
        - `body` string, required — The body of the email template to use at this step
      - object
        - `type` 'sms', required — The step type. Always "sms" for this step
        - `custom_step_id` string — Optional. The ID of the custom step to use in this step. The type of the custom step must be "sms" as well
        - `sms_template_id` string, required — The ID of the SMS template to use in this step
      - object
        - `type` 'sms', required — The step type. Always "sms" for this step
        - `custom_step_id` string — Optional. The ID of the custom step to use in this step. The type of the custom step must be "sms" as well
        - `message` string, required — The message to send in this step
      - object
        - `type` 'wait', required — The step type. Always "wait" for this step
        - `duration` integer, required — The number of seconds to wait
      - object
        - `type` 'if', required — The step type. Always "if" for this step
        - `filter` string, required — The filter to use in this step
  - `email_address` string, nullable, required — The email address used to send emails in the campaign. Will be the ID of an email-like object
  - `phone_number` string, nullable, required — The phone number used to send SMS messages in the campaign. Will be the ID of a phone number-like object
  - `status` 'draft' | 'scheduled' | 'started' | 'stopped' | 'finished', required — The status of the campaign.
  - `scheduled_at` string, nullable, required — The time when the campaign is scheduled to start in ISO 8601 format
  - `scheduled_end_at` string, nullable, required — The time when the campaign is scheduled to end in ISO 8601 format
  - `statistics` object, required — The statistics of the campaign. Includes information about customers enrolled, email statistics, and custom step statistics
    - `total_customers_enrolled` integer — The number of customers enrolled in the campaign or trigger
    - `total_customers_started` integer — The number of customers who have started receiving messages
    - `total_customers_finished` integer — The number of customers who have finished receiving all the messages
    - `emails` object, required — Email statistics including sent, delivered, opened, bounced, and clicked counts
      - `sent` integer, required — The number of emails sent
      - `delivered` integer, required — The number of emails delivered
      - `opened` integer, required — The number of emails opened
      - `soft_bounced` integer, required — The number of emails that soft bounced
      - `hard_bounced` integer, required — The number of emails that hard bounced
      - `spam_reported` integer, required — The number of emails reported as spam
      - `clicked` integer, nullable, required — The number of emails clicked (null if tracking not enabled)
    - `custom_steps` object[], required — Statistics for custom steps
      - `custom_step` string, required — The ID of the custom step
      - `sent` integer, required — The number of times this custom step was sent
    - `executions` object, required — Execution statistics
      - `total` integer, required — Total number of executions
      - `pending` integer, required — Number of pending executions
      - `started` integer, required — Number of started executions
      - `finished` integer, required — Number of finished executions
      - `errored` integer, required — Number of errored executions
    - `sms` object, required — SMS statistics
      - `sms_sent_count` integer, required — The number of SMS messages sent
      - `sms_sent_segments_count` integer, required — The number of SMS messages segments
      - `mms_sent_count` integer, required — The number of MMS messages sent
      - `mms_sent_segments_count` integer, required — The number of MMS messages segments
  - `consumed_message_segments` object, required — The number of message segments actually used by the campaign
    - `sms` integer, required — The number of SMS segments
    - `mms` integer, required — The number of MMS segments
    - `email` integer, required — The number of email segments
  - `estimated_message_segments` object — The number of message segments estimated to be used by the campaign
    - `sms` integer, required — The number of SMS segments
    - `mms` integer, required — The number of MMS segments
    - `email` integer, required — The number of email segments
  - `attributed_revenue` string, nullable, required — The revenue attributed to the campaign
  - `metadata` object, required — Arbitrary metadata associated with this campaign

---

[API](https://skmtc.dev/pocketflows/apis/pocketflows-api.md) · [All operations](https://skmtc.dev/pocketflows/apis/pocketflows-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/pocketflows/pocketflows-api/revisions/26723490b96f/schema)
