Would this be allowed according to Twitter API rules?



I have written a script that analyzes the friends/followers of a given Twitter account (once OAuth’d). It then looks at tweets and other activity from those followers. Using a machine learning algorithm, this script detects users who are likely to be spam accounts, fake accounts, or otherwise abusive accounts (stalkers, rude comments, etc). I think this could be useful not only for our own account, but other accounts too.

Once I have a list of all user_ids belonging to these “junk” followers, obviously I want to unfollow them all, which I can do via POST friendships/destroy. However- I am NOT ALLOWED to automate this. And I do NOT want to break your rules.

My question is this:

How do I enable some “unfollow” feature into my script without breaking any rules? Does it require me to create a UI where I manually click to unfollow them all? All I want is some user-friendly way to get rid of these junky relationships. What can I do?

Thanks in advance.


I think it would require a UI where there’s an unfollow button. In my experience, Twitter wants there to be an explicit click for actions such as Following or Unfollowing.


Thanks Daniel for such a prompt reply.

Can you give me any idea how many buttons per page is allowed?

What is the line between “aggressive unfollowing” and trying to get spam off my feed asap?


I don’t think there’s a limit per page but I can tell you that if you click a large number of the buttons in a minute flat you’re likely to throw a flag and get your account locked as animated actions.

There’s no firm line and Twitter is very vague in this area because with too much detail developers would be able to skirt around it. Just know they use machine learning to detect changes in user behavior so if you go from never unfollowing someone to unfollowing 100 people in a minute, you’re likely to get locked. There’s no major issues with being locked, they just want to confirm your’e a human so you confirm your email and/or phone again and you’re good to go but if you have several accounts do this all at the same time then your app may be restricted until you have a conversation with Twitter about it and hopefully get unrestricted.


Excellent advice. Thank you very much for the help.


No problem. Will you DM me on Twitter (@DanielCHood)? I’m interested in your platform.