{"id":16424117,"url":"https://github.com/funkatron/mc-delete-segment-contacts","last_synced_at":"2026-05-29T16:31:19.498Z","repository":{"id":50198625,"uuid":"164936764","full_name":"funkatron/mc-delete-segment-contacts","owner":"funkatron","description":"A python script to delete all contacts in a Mailchimp list segment","archived":false,"fork":false,"pushed_at":"2022-12-08T01:31:44.000Z","size":5,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-29T21:48:54.343Z","etag":null,"topics":["mailchimp","mailchimp-api","python","python3"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/funkatron.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-09T20:57:06.000Z","updated_at":"2022-03-14T10:53:15.000Z","dependencies_parsed_at":"2023-01-24T21:00:11.398Z","dependency_job_id":null,"html_url":"https://github.com/funkatron/mc-delete-segment-contacts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/funkatron/mc-delete-segment-contacts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funkatron%2Fmc-delete-segment-contacts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funkatron%2Fmc-delete-segment-contacts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funkatron%2Fmc-delete-segment-contacts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funkatron%2Fmc-delete-segment-contacts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/funkatron","download_url":"https://codeload.github.com/funkatron/mc-delete-segment-contacts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/funkatron%2Fmc-delete-segment-contacts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33662205,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mailchimp","mailchimp-api","python","python3"],"created_at":"2024-10-11T07:43:08.979Z","updated_at":"2026-05-29T16:31:19.469Z","avatar_url":"https://github.com/funkatron.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MailChimp Delete Segment Contacts Script\n\nThis is a python script I wrote to delete the thousands of spam signups we had on a MailChimp mailing list.\n\nTo clean a list of spam addresses, MailChimp suggests you [create a multi-part segment](https://mailchimp.com/help/create-and-send-to-a-segment/)\nto quarantine the contacts, and then delete them by hand in the UI. The UI only allows you to select 100 list members\nat a time, though, and we had about 60 times that number.\n\nBecause I am a programmer, I can't stand doing repetitive tasks, even when it would take more time to write a script. So\nI wrote a script.\n\nThis has not been tested extensively. It Works For Me. YMMV. \n\n***THIS DELETES THINGS PERMANENTLY FROM YOUR LISTS. BE SURE YOUR HAVE THE RIGHT CONTACTS IN YOUR SEGMENT***\n\n## Setup and Execution\n\nThis assumes you are running at least **Python 3.5**. I'd also suggest using a virtual environment. Assuming you agree,\ndo this:\n\n1. Clone this repo\n2. `cd` into the cloned repo directory\n3. `python -m venv venv` to make the virtual environment\n4. `python venv/bin/activate` to activate the virtual environment\n5. `pip install -r requirements.txt` to get the required packages\n6. `cp .env.sample .env` to copy the sample .env file\n7. Fill out the values in the `.env` file:\n\n    - `MC_API_KEY` - see [this doc here](https://mailchimp.com/help/about-api-keys/)\n    - `MC_LIST_ID` - the ID for the list you'll be cleaning up. Get this via [the API Playground](https://us6.api.mailchimp.com/playground/)\n    - `MC_SEGMENT_ID` - the ID for the _segment_ of the list you'll be cleaning up. Get this via [the API Playground](https://us6.api.mailchimp.com/playground/), in the **subresources** for the list\n    - `MC_DC` - The Data Center code for your account. This should be [the suffix of your API key](https://developer.mailchimp.com/documentation/mailchimp/guides/get-started-with-mailchimp-api-3/#resources).\n\n8. Run the script with `python mc-delete-segment-contacts.py`. ***THIS WILL PERMANENTLY DELETE ALL THE CONTACTS IN THE SEGMENT***. Also, this could take a while, so you might want to get a cup of coffee.\n\nHave fun, and be careful out there.\n\n-Ed\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffunkatron%2Fmc-delete-segment-contacts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffunkatron%2Fmc-delete-segment-contacts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffunkatron%2Fmc-delete-segment-contacts/lists"}