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

# Create

> Used to create an automated campaign or create a campaign to be dispatched immediately with the send API method.

To review the parameters supported in the create method see the [campaign model properties](https://docs.xtremepush.com/reference/campaign-model) dedicated guide.

## OpenAPI

````json POST /create/campaign
{
  "openapi": "3.1.0",
  "info": {
    "title": "external-api",
    "version": "1"
  },
  "servers": [
    {
      "url": "https://api.eu.xtremepush.com/api/external"
    }
  ],
  "paths": {
    "/create/campaign": {
      "post": {
        "summary": "Create",
        "description": "Used to create an automated campaign or create a campaign to be dispatched immediately with the send API method.\n\nTo review the parameters supported in the create method see the [campaign model properties](https://docs.xtremepush.com/reference/campaign-model) dedicated guide.",
        "operationId": "campaign-create",
        "deprecated": "false",
        "requestBody": {
          "required": "true",
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "apptoken",
                  "title"
                ],
                "properties": {
                  "apptoken": {
                    "type": "string",
                    "description": "Your App token"
                  },
                  "title": {
                    "type": "string",
                    "description": "The title of your campaign"
                  },
                  "trigger": {
                    "type": "integer",
                    "format": "int32",
                    "description": "The type of campaign to create. Parameter options: 0 - Scheduled campaign (default value) 1 - Geo / iBeacon triggered campaign 2 - Event triggered campaign 3 - Api triggered campaign"
                  },
                  "category_id": {
                    "type": "integer",
                    "format": "int32",
                    "description": "The ID of the engagement category that you want to link to the campaign. A project's configuration may require this parameter to be set."
                  },
                  "target_applications": {
                    "type": "integer",
                    "format": "int32",
                    "description": "The ID or IDs of the app or site that you want to target. This option needs to be enabled beforehand from Settings > Engagement rules and categories."
                  },
                  "email": {
                    "type": "boolean",
                    "description": "Enable email message channel. Default to 0 (off)"
                  },
                  "sms": {
                    "type": "boolean",
                    "description": "Enable sms message channel. Default to 0 (off)"
                  },
                  "android_push": {
                    "type": "boolean",
                    "description": "Enable push message channel on Android. Default to 0 (off)"
                  },
                  "ios_push": {
                    "type": "boolean",
                    "description": "Enable push message channel on iOS. Default to 0 (off)"
                  },
                  "ios_push_production": {
                    "type": "boolean",
                    "description": "Enable push message channel for iOS production builds. Default to 0 (off)"
                  },
                  "ios_push_sandbox": {
                    "type": "boolean",
                    "description": "Enable push message channel for iOS dev builds. Default to 0 (off)"
                  },
                  "web_push": {
                    "type": "boolean",
                    "description": "Enable web push message channel. Default to 0 (off)"
                  },
                  "web_push_chrome": {
                    "type": "boolean",
                    "description": "Enable web push messaging for Chrome and Opera. Default to 0 (off)"
                  },
                  "web_push_firefox": {
                    "type": "boolean",
                    "description": "Enable web push messaging for Firefox. Default to 0 (off)"
                  },
                  "web_push_safari": {
                    "type": "boolean",
                    "description": "Enable web push messaging for Safari. Default to 0 (off)"
                  },
                  "inbox": {
                    "type": "boolean",
                    "description": "Enable inbox message channel. Default to 0 (off)"
                  },
                  "webhook": {
                    "type": "string",
                    "description": "Enable webhook message channel. Default to 0 (off)"
                  },
                  "encryption": {
                    "type": "integer",
                    "format": "int32",
                    "description": "Only applicable — and required to be 1 or 2 — if your project has the encryption feature enabled, and the campaign has the android_push or ios_push channels enabled. Parameter options: 0 - Turned off (default value) 1 - Use where possible 2 - Enforce encryption"
                  }
                }
              },
              "examples": {
                "Android": {
                  "value": {
                    "apptoken": "YOUR_APP_TOKEN",
                    "title": "First Android Test",
                    "android_push": "1",
                    "encryption": "0",
                    "broadcast": "1",
                    "push_title": "First Android Test",
                    "push_text": "Testing Android Ping!",
                    "push_picture_type": "url",
                    "push_picture": "https://example.com/image.png"
                  }
                },
                "iOS": {
                  "value": {
                    "apptoken": "YOUR_APPTOKEN",
                    "title": "First iOS Test",
                    "ios_push": "1",
                    "ios_push_sandbox": "1",
                    "broadcast": "1",
                    "push_text": "Testing iOS Ping!"
                  }
                },
                "iOS with payload": {
                  "value": {
                    "apptoken": "YOUR_APPTOKEN",
                    "title": "El Classico",
                    "ios_push": "1",
                    "ios_push_sandbox": "1",
                    "push_text": "1-0! Messi scores.",
                    "payload_add": [
                      {
                        "key": "score",
                        "value": "1-0"
                      }
                    ],
                    "conditions": {
                      "operator": "AND",
                      "0": {
                        "operator": "AND",
                        "0": [
                          "tags_attribute",
                          "=",
                          "live_scores",
                          [
                            "value",
                            "=",
                            "on"
                          ]
                        ]
                      }
                    }
                  }
                },
                "Web push": {
                  "value": {
                    "apptoken": "YOUR_APPTOKEN",
                    "title": "El Classico",
                    "web_push": "1",
                    "web_push_chrome": "1",
                    "web_push_firefox": "1",
                    "inbox": "1",
                    "messages": {
                      "3": {
                        "push_title": "El Classico",
                        "push_text": "1-0! Messi scores.",
                        "url": "https://mywesbite.com/destination.html?from=push"
                      },
                      "6": {
                        "inbox_type": "1",
                        "push_title": "El Classico",
                        "push_text": "60\" - Messi scores. 1-0",
                        "url": "https://mywesbite.com/destination.html?from=inbox"
                      }
                    }
                  }
                },
                "Webhook": {
                  "value": {
                    "apptoken": "YOUR_APP_TOKEN",
                    "title": "webhookSmsExample",
                    "webhook": "1",
                    "broadcast": "1",
                    "messages": {
                      "8": {
                        "webhook": {
                          "url": "https://api.thirdparty.example.com/api/v2/json",
                          "get_params": [
                            {
                              "key": "text",
                              "value": "The quick brown fox jumped over the lazy dog."
                            },
                            {
                              "key": "value",
                              "value": "12345"
                            },
                            {
                              "key": "api_secret",
                              "value": "THIRD_PARTY_SECRET"
                            },
                            {
                              "key": "api_key",
                              "value": "API_KEY"
                            }
                          ],
                          "request_body_type": "raw",
                          "request_body_data": {
                            "raw": "",
                            "post": "",
                            "json": ""
                          },
                          "request_headers": ""
                        }
                      }
                    }
                  }
                },
                "Multi-language (same URL)": {
                  "value": {
                    "apptoken": "APP_TOKEN",
                    "title": "Inbox Multilanguage with same URL",
                    "inbox": "1",
                    "languages_multi": "1",
                    "languages_list": [
                      "en",
                      "ru"
                    ],
                    "languages_default": "en",
                    "messages": {
                      "6": {
                        "push_title_languages": {
                          "en": "Test",
                          "ru": "Тест"
                        },
                        "push_text_languages": {
                          "en": "Hello",
                          "ru": "Привет"
                        },
                        "url": "https://website-local.xtremepush.com?lang=common"
                      }
                    }
                  }
                },
                "Multi-language (different URL)": {
                  "value": {
                    "apptoken": "APP_TOKEN",
                    "title": "Inbox Multilanguage with diff URL",
                    "inbox": "1",
                    "languages_multi": "1",
                    "languages_list": [
                      "en",
                      "ru"
                    ],
                    "languages_default": "en",
                    "messages": {
                      "6": {
                        "push_title_languages": {
                          "en": "Test",
                          "ru": "Тест"
                        },
                        "push_text_languages": {
                          "en": "Hello",
                          "ru": "Привет"
                        },
                        "url_languages": {
                          "en": "https://website-local.xtremepush.com?lang=en",
                          "ru": "https://website-local.xtremepush.com?lang=ru"
                        }
                      }
                    }
                  }
                },
                "Email content": {
                  "value": {
                    "apptoken": "YOUR_APP_TOKEN",
                    "title": "Email Example via API",
                    "email": "1",
                    "broadcast": "1",
                    "encryption": "0",
                    "messages": {
                      "7": {
                        "email_from_address": "info@example.com",
                        "email_from_name": "Info",
                        "email_subject": "Hi {{first_name}}, check out our sample API email test",
                        "email_unsubscribe": "0",
                        "email_type": "1",
                        "email_template": "1",
                        "email_html": "YOUR FULLY RESPONSIVE EMAIL HTML"
                      }
                    }
                  }
                },
                "SMS": {
                  "value": {
                    "apptoken": "YOURAPPTOKEN",
                    "title": "SMS Example via API",
                    "sms": "1",
                    "broadcast": "1",
                    "messages": {
                      "9": {
                        "sms": {
                          "from": "xtremepush",
                          "text": "{{first_name}}, check out our SMS API test"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": "true",
                      "default": "true"
                    },
                    "code": {
                      "type": "integer",
                      "example": "200",
                      "default": "0"
                    },
                    "message": {
                      "type": "string",
                      "example": "Campaign is successfully created"
                    },
                    "model": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "example": "58943956"
                        },
                        "title": {
                          "type": "string"
                        },
                        "active": {
                          "type": "integer",
                          "example": "1"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "Result": {
                    "value": {
                      "success": "true",
                      "code": "200",
                      "message": "Campaign is successfully created",
                      "model": {
                        "id": "58943956",
                        "project_id": "PROJECT_ID",
                        "type": "1",
                        "trigger": "0",
                        "send_type": "0",
                        "active": "1",
                        "sending": "0",
                        "draft": "0",
                        "status": "0",
                        "is_open": "0",
                        "title": "API example",
                        "ab": "0",
                        "languages_multi": "0",
                        "content_fetch": "0",
                        "encryption": "0",
                        "ios_push": "0",
                        "ios_push_production": "0",
                        "ios_push_sandbox": "0",
                        "ios_push_legacy": "0",
                        "android_push": "1",
                        "android_push_production": "1",
                        "android_push_legacy": "0",
                        "web_push": "1",
                        "web_push_safari": "0",
                        "web_push_chrome": "1",
                        "web_push_firefox": "1",
                        "inbox": "0",
                        "inbox_only": "0",
                        "inbox_same": "0",
                        "inbox_addressable": "0",
                        "inapp": "0",
                        "inapp_ios": "0",
                        "inapp_android": "0",
                        "onsite": "0",
                        "email": "1",
                        "email_addressable": "0",
                        "sms": "0",
                        "webhook_addressable": "0",
                        "broadcast": "0",
                        "conversions": "0",
                        "retry_for": "4",
                        "retry_for_period": "weeks",
                        "activate_time": "1779457650",
                        "last_modified": "1779457650",
                        "redemptions": "0",
                        "automatically_pick_winner": "0",
                        "automatically_pick_winner_sample_percentage": "100",
                        "throttling": "0",
                        "create_time": "1779457650",
                        "custom_variant_share": "0",
                        "early_cancel_event_filter": "0",
                        "target_authorised_devices": "0",
                        "voucher_codes_enabled": "0",
                        "consent_preference": "0",
                        "qualification": "0",
                        "enter_journey_once_ever": "0",
                        "enter_journey_once_at_a_time": "0",
                        "mxa_migration": "0",
                        "new_mxa": "0",
                        "prioritise_rcs": "0",
                        "messages": {
                          "2": {
                            "language": "",
                            "push_title": "Android push title",
                            "push_text": "Android push text"
                          },
                          "3": {
                            "language": "",
                            "push_title": "Webpush title",
                            "push_text": "Webpush text",
                            "push_action": {
                              "action": "url",
                              "url": "https://example.com/"
                            }
                          },
                          "7": {
                            "email_type": "1",
                            "email_html": "<html><body><p>Tests</p></body></html>",
                            "email_subject": "Hi {{first_name}}, check out our sample API email test",
                            "email_from_name": "María",
                            "email_from_address": "info@example.com",
                            "email_unsubscribe": "0",
                            "twig": "1"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": "false",
                      "default": "true"
                    },
                    "code": {
                      "type": "integer",
                      "example": "400",
                      "default": "0"
                    },
                    "message": {
                      "type": "string",
                      "example": "Campaign is not created"
                    },
                    "errors": {
                      "type": "object",
                      "properties": {
                        "title": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "Result": {
                    "value": {
                      "success": "false",
                      "code": "400",
                      "message": "Campaign is not created"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "Campaign Methods"
        ]
      }
    }
  }
}
````

