Hi,
Thank you for reaching out. To block IP addresses, you could use CampaignCriterionService.mutate() and set the criterion of NegativeCampaignCriterion object to IpBlock. You could refer to this code example on how to implement it. Please let me know if you have any further questions.
Thanks and regards,
Xiaoming, Google Ads API Team