# Regarding Mautic api create campaign

**URL:** https://forum.mautic.org/t/regarding-mautic-api-create-campaign/29034
**Category:** Product Support
**Created:** [August 23, 2023, 8:25am UTC](https://forum.mautic.org/t/regarding-mautic-api-create-campaign/29034 "2023-08-23T08:25:28Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![shekhar](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@shekhar](https://forum.mautic.org/u/shekhar)
#### Post date: [August 23, 2023, 8:25am UTC](https://forum.mautic.org/t/regarding-mautic-api-create-campaign/29034/1 "2023-08-23T08:25:28Z")

</div>

**Your software**  
My Mautic version is: 4.4.9  
My PHP version is: 8.0.29  
My Database type and version is: 5.7.23- |Doctrine driver|pdo\_mysql|

**Your problem**  
My problem is: I am sending my request through rest api with an array as following(according to Mautic doc):

Code:  
$array = [‘name’ =\> testcampaign-\>name, ‘description’ =\> “testcampaign”-\>description, ‘isPublished’ =\> 0];  
But I get an error 400 bad request: At least one event is required. Use the Launch Campaign Builder.  
I am using Mautic rest api create a campaign end point to create the complete workflow as shown in attached screenshot below. Is there a restful way to create a Campaign for Mautic along with array of data using Rest api?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/4/470b54de6694dcfa1dbf89673216f1d9804cca31.png)

---

<div class="post-metadata">

### Author: ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)
#### Post date: [August 23, 2023, 9:18am UTC](https://forum.mautic.org/t/regarding-mautic-api-create-campaign/29034/2 "2023-08-23T09:18:19Z")

</div>

Hi there!

I checked the new [WIP docs](https://mautic-developer.readthedocs.io/en/latest/rest_api/campaigns.html#create-campaign) and it refers you to the unit tests to find examples of creating a campaign with the UI if you need to add events (which is what the error refers to - you can’t generally create a campaign without any associated events).

Here is a unit test that might be helpful as a starting point?

> <https://github.com/mautic/mautic/blob/c86f0eebf36fa78fa40e44491f021a0806b3ee6b/app/bundles/CampaignBundle/Tests/Controller/Api/CampaignApiControllerFunctionalTest.php#L27>

It would be great to actually document some examples of creating a campaign with events, so if you would like to help with that you can make a PR using the ‘edit on Github’ button top right!
