The list of course web service API functions can be found here: https://docs.moodle.org/dev/Web_service_API_functions
There doesn't appear to be anything matching what you describe, the closest is core_completion_mark_course_self_completed
, but that only works for the current user. It may be a useful place to start if you want to implement your own function for this.