# API for campaigns broken?

**URL:** https://forum.mautic.org/t/api-for-campaigns-broken/28226
**Category:** Product Support
**Tags:** mautic-4
**Created:** [June 4, 2023, 3:04pm UTC](https://forum.mautic.org/t/api-for-campaigns-broken/28226 "2023-06-04T15:04:22Z")
**Posts on this page:** 9
**Page:** 1

<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/api-for-campaigns-broken/28226/1 "2023-06-04T15:04:22Z")

</div>

I experimented a bit with the API to create campaigns.

I used the data JSON of an existing one and send it to the API. The new campaign was created, but:  
1.) all the nodes of the campaign **ended up top left on the canvas** (they still have the x,y coordinates, when I read the just created campaign via the API),  
2.) **they were not connected** , although I send the “connections part” via API JSON payload (that is still inside the JSON payload when I read it again).

I wonder what the:

- campaignID within some events (long random string starting with “mautic\_”) and sometimes the real short campaignID, and
- “\_token” fields are used for and how they are generated.

Not supplying them ends up with error 400 trying to create the campaign.

Did someone successfully create a new campaign via API in the past? How did Maestro(?) do it - was it via API or via a Plugin with direct database access?

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [June 4, 2023, 3:29pm UTC](https://forum.mautic.org/t/api-for-campaigns-broken/28226/2 "2023-06-04T15:29:19Z")

</div>

Hmm. Works for me. If the json is fine, it should show properly.

---

<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 5, 2023, 6:10am UTC](https://forum.mautic.org/t/api-for-campaigns-broken/28226/3 "2023-06-05T06:10:30Z")

</div>

Mhm, the problem is, the API doesn’t tell much about what went wrong…  
How do you know that the JSON is fine?

So when you do it, the connections / links are working and the node don’t end up top left?

---

<div class="post-metadata">

### Author: ![pegas](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/pegas/32/3816_2.png) [@pegas](https://forum.mautic.org/u/pegas)
#### Post date: [November 29, 2023, 7:11pm UTC](https://forum.mautic.org/t/api-for-campaigns-broken/28226/4 "2023-11-29T19:11:04Z")

</div>

I have the same issue. Was you able to figure anything out how this works?

---

<div class="post-metadata">

### Author: ![pegas](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/pegas/32/3816_2.png) [@pegas](https://forum.mautic.org/u/pegas)
#### Post date: [November 29, 2023, 7:43pm UTC](https://forum.mautic.org/t/api-for-campaigns-broken/28226/5 "2023-11-29T19:43:20Z")

</div>

Okay I might have it figured out. I am doing all of the connections using N8N, What i noticed was the connections array was not matching up with the event IDs due to mautic setting them, so what I did was add a Patch node and edit the campaign an update the source and target ids. I will publish a N8N campaign once i am done

---

<div class="post-metadata">

### Author: ![campiotto](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/campiotto/32/6739_2.png) [@campiotto](https://forum.mautic.org/u/campiotto)
#### Post date: [March 20, 2024, 5:13pm UTC](https://forum.mautic.org/t/api-for-campaigns-broken/28226/6 "2024-03-20T17:13:35Z")

</div>

I have the same problem. Has anyone figured out how to resolve this? Is there an example json?

---

<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 24, 2025, 4:25pm UTC](https://forum.mautic.org/t/api-for-campaigns-broken/28226/7 "2025-09-24T16:25:21Z")

</div>

Any success here? I’d love to see what you came up with and maybe avoid reinventing wheels.

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [November 11, 2025, 8:56am UTC](https://forum.mautic.org/t/api-for-campaigns-broken/28226/8 "2025-11-11T08:56:23Z")

</div>

Altough I use this rarely, I would debug it like:

1. Create a campaign in Mautic
2. Pull out the campaign via API to see how the json looks like
3. Push in the same json and see what happens.

Joey

---

<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: [December 17, 2025, 4:20am UTC](https://forum.mautic.org/t/api-for-campaigns-broken/28226/9 "2025-12-17T04:20:44Z")

</div>

Were you able to do this? LIke a simple campaign duplication from API?
