# Campaign API error for Creating New Campaign

**URL:** <https://forum.mautic.org/t/campaign-api-error-for-creating-new-campaign/19712>\
**Category:** Product Support\
**Tags:** development\
**Created:** [June 2, 2021, 12:04pm UTC](https://forum.mautic.org/t/campaign-api-error-for-creating-new-campaign/19712 "2021-06-02T12:04:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidmyeyes](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/davidmyeyes/32/588_2.png) [@davidmyeyes](https://forum.mautic.org/u/davidmyeyes)\
**Post date:** [June 2, 2021, 12:04pm UTC](https://forum.mautic.org/t/campaign-api-error-for-creating-new-campaign/19712/1 "2021-06-02T12:04:59Z")

</div>

**Your software**  
My Mautic version is: latest  
My PHP version is: 7.4.13  
My Database type and version is: mysql 5.7

**Your problem**  
My problem is: I encountered this error when I tried to create a campaign via API. I wondered if anyone had tried this before and what are the main variables I have to include in order to successfully create a new campaign via API. Thanks in advance

These errors are showing:

 ![Screen Shot 2021-06-02 at 10.01.14 PM](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/7/75e5cbb22403adf199acbc5be597fae6cbadebab.png)

---

<div class="post-metadata">

**Author:** ![dirk\_s](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/dirk_s/32/748_2.png) [@dirk\_s](https://forum.mautic.org/u/dirk_s)\
**Post date:** [June 4, 2023, 3:04pm UTC](https://forum.mautic.org/t/campaign-api-error-for-creating-new-campaign/19712/2 "2023-06-04T15:04:42Z")

</div>

Start with reading a campaign structure via the API. Each campaign has either a form or a list (segment) as source. You need to add either of them when creating a campaign.

However current other issues prevent a successful campaign creation via API: [API for campaigns broken? - Support - Mautic Community Forums](https://forum.mautic.org/t/api-for-campaigns-broken/28226)

---

<div class="post-metadata">

**Author:** ![entrepositive](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/entrepositive/32/9645_2.png) [@entrepositive](https://forum.mautic.org/u/entrepositive)\
**Post date:** [September 23, 2025, 9:06pm UTC](https://forum.mautic.org/t/campaign-api-error-for-creating-new-campaign/19712/3 "2025-09-23T21:06:22Z")

</div>

Your request body is likely missing a line like this:

```auto
"lists": 11,

```

or this:

```auto
"forms": 11,

```

where 11 is the ID of the segment (list) or form you are using to trigger the campaign.

Your request body will need more than that to create a functional campaign in Mautic, but this should get you past the error you’re receiving.

You’re going to run into another problem. ‘Nodes’ as they are called – these are the little widgety objects in the Campaign canvas – are dynamically assigned unique IDs when the campaign is created. These IDs are sequentially selected, impossible to predict, and absolutely essential for positioning and connecting the nodes to each other in the canvas.

An impossible task, it seems. I’ll report back with findings.

EP
