# Update the segment and create a contact from the script

**URL:** <https://forum.mautic.org/t/update-the-segment-and-create-a-contact-from-the-script/31491>\
**Category:** Product Support\
**Created:** [March 30, 2024, 8:16am UTC](https://forum.mautic.org/t/update-the-segment-and-create-a-contact-from-the-script/31491 "2024-03-30T08:16:20Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [April 1, 2024, 4:24pm UTC](https://forum.mautic.org/t/update-the-segment-and-create-a-contact-from-the-script/31491/3 "2024-04-01T16:24:44Z")

</div>

The Mautic Dev documentation is your friend here:  
[https://developer.mautic.org/#create-contact](https://developer.mautic.org/#create-contact)

1. First enable access (Basic Auth) in Mautic.
2. Add a user for the API with required access rights.
3. Implement the calls: You need to check first, if contact already exists, if not add a new one.

Not sure what you mean related to the assignment of the contact to a segment - that would be the way to go: [Mautic Developer Documentation](https://developer.mautic.org/#add-contact-to-a-segment)

---

_[View the full topic](https://forum.mautic.org/t/update-the-segment-and-create-a-contact-from-the-script/31491)._
