The best way to create contacts using API

I’m building a custom form that will create a contact in Mautic using APIs and I’m wondering what is the best way to do this?



Few considerations -


  1. User might still be anonymous; but cookied
  2. Known user might be on another device, so anonymous, cookied for now. But when he submits the form, he should be merged.



    My Question -


Which API calls should be ideally used? Could I get some examples?


- Should new user be created? Or an existing anonymous user be updated, by tracking his ID from cookie?
- What if the user is already known, but is on another device? In this case, he will have a different ID in cookie.
- If user submits the form with same email address, will a duplicate contact be created in Mautic? (even if he submits the form using same email address)

I would appreciate some help from fellow developers.

I’m building a custom form that will create a contact in Mautic using APIs and I’m wondering what is the best way to do this?

Few considerations -

  1. User might still be anonymous; but cookied
  2. Known user might be on another device, so anonymous, cookied for now. But when he submits the form, he should be merged.

My Question -

Which API calls should be ideally used? Could I get some examples?

  • Should new user be created? Or an existing anonymous user be updated, by tracking his ID from cookie?
  • What if the user is already known, but is on another device? In this case, he will have a different ID in cookie.
  • If user submits the form with same email address, will a duplicate contact be created in Mautic? (even if he submits the form using same email address)

I would appreciate some help from fellow developers.