@brian_t_anders , this really is a different question, unrelated to publishing courses, so tacking it on here may not grab the attention or expertise it would if it was a separate question. It seems more related to the question you asked here Bulk activate and deactivate students than it does to this one.
That said, I'll go ahead and provide my thoughts.
First, what do you mean by "deactivate" the user? Users are active or deleted. Enrollments are active, deleted, completed, or inactive. There's not a way to deactivate a user at the account level that I know of and it's been a question or feature idea several times, including this one that is currently on Product Radar: https://community.canvaslms.com/ideas/7427-disabledeactive-user-at-account-level . That means that you're probably going to need to change their status in every course. Realize that doing so has ramifications for the teacher who may be grading off-hours when the students are not active in the course.
If you want bulk, then I would use the solution that @MattHanes gave in your other question and use a SIS import. I would make two enrollments.csv files with just those students in it. The name of the file seems to be irrelevant, so I would call them denyaccess.csv and allowaccess.csv or something like that to keep them straight. Since it's the same students, you don't even need to recreate the file, just keep sending the same pair over and over -- one every evening and the other every morning. Do this through SIS Import API. One API call is all it takes each time, rather than one for each student. I would schedule that request so I didn't have to make it manually. Your students would have to have SIS IDs for this to work.
If you want to stick with the API and not mess with SIS imports, then you would need to write a program that would loop through a list of students and send the API request for each one. I would schedule that as well.